Forum

> > Stranded II > Scripts > Scripting Questions
Forums overviewStranded II overview Scripts overviewLog in to reply

English Scripting Questions

2,429 replies
Page
To the start Previous 1 243 44 45121 122 Next To the start

old Re: Scripting Questions

DC
Admin Off Offline

Quote
2 as second parameter means that there are two different keys for the combination (l and r).
you can also use 3 different keys (l,r,u)
or even 4 different keys (l,r,u,d) to make harder combinations.

old Re: Scripting Questions

Raven Shadow
User Off Offline

Quote
jockmo42 has written
I was wondering with the getstatevalue, how would I make it refer to only the crab I hit? I know about $local, just not quite how to apply it in this case. Any help?


It's easier if you script the crab with an on:kill event
, that way it always referes to the crab being hit.
It this case you should be able to use "self" in place of
the getstatevalue's ID requirement, as long as the
script belongs to the crab beinbg hit.

old Re: Scripting Questions

jockmo42
User Off Offline

Quote
Raven Shadow has written
jockmo42 has written
I was wondering with the getstatevalue, how would I make it refer to only the crab I hit? I know about $local, just not quite how to apply it in this case. Any help?


It's easier if you script the crab with an on:kill event
, that way it always referes to the crab being hit.
It this case you should be able to use "self" in place of
the getstatevalue's ID requirement, as long as the
script belongs to the crab beinbg hit.


I was hoping I could use self, thanks!

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
Bloodshot has written
Alright: baby raptor script (page before) why dosn't s2 register the hour?
Anyone?

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
script=start
	[B]if ($hour==7) {
		if ($lifespan<20) {
			local $hunger;
			$hunger++;
			msg "The baby raptor's hungry!",1;
		}
	}
	if ($hour==12) {
		if ($lifespan<20) {
			local $hunger;
			$hunger++;
			msg "The baby raptor's hungry!",1;
		}
	}
	if ($hour==18) {
		if ($lifespan<20) {
			local $hunger;
			$hunger++;
			msg "The baby raptor's hungry!",1;
		}
	}
[/B]
	on:changeday {
		if ($hunger>2) {
			kill "self";
			$babyraptor=0;
		}
	$lifespan++;
	local $lifespan;
	if ($lifespan==5) {
		scale 0.13;
		$speed=1.5;
		addstate "self", "speed";
		statevalue "self", "speed", $speed;
	}
	if ($lifespan==10) {
		scale 0.25;
		$speed=1.8;
		addstate "self", "speed";
		statevalue "self", "speed", $speed;
	}
	if ($lifespan==16) {
		scale 0.35;
		$speed=2.1;
		addstate "self", "speed";
		statevalue "self", "speed", $speed;
	}
	if ($lifespan==20) {
		scale 0.5;
		$speed=2.5;
		addstate "self", "speed";
		statevalue "self", "speed", $speed;
		$eggs1=random (1,3);
		if ($eggs2==0) {
			if ($eggs1==2) {
				create "object",230,getx "self",gety "self",getz "self";
				$motherid=currentid;
			}
		}
	}
	if ($lifespan==40) {
		kill "self";
		$babyraptor=0;
		$motherid=0;
	}
	}
	on:use {
	if ($lifespan>20){
		ride;
	}else{
		if($hunger>-1) {
			if(playergotitem (9)>0) {
				$hunger--;
				freestored "unit",1,9,1;
				play "eat.wav";
			}elseif(playergotitem (11)>1){
				$hunger--;
				freestored "unit",1,11,2;
				play "eat.wav";
			}else{
				msg "I need raw meat to feed him!",3;
				speech "negative";
			}
		}
	}
	}
	on:kill {
		event "iskill_hunt","global";
	}
	on:create {
		timer "self",5000,0;
		local $babyraptor;
		$babyraptor=1;
		$speed=1.25;
		[B]$hour=hour;[/B]
	}
	on:start {
		timer "self",5000,0;
		local $babyraptor;
		$babyraptor=1;
		$speed=1.25;
		[B]$hour=hour;[/B]
	}
	on:timer {
		if (health("self")>0){
			if ($ifespan<20) {
				ai_mode "self","goto","unit","1";
				ai_center;
		}

	}
script=end
Also, for the scriptkeys in the game.inf, how do you assing the "scriptkey" to a keyboard key?
edited 1×, last 05.09.08 01:56:50 am

old Re: Scripting Questions

Raven Shadow
User Off Offline

Quote
@Bloodshot
once the necessary code is included in game.inf the
specific hotkey has to be assigned by the player, via
the game option menu on the main screen

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
there is a typo in the end:
1
if ($ifespan<20) {
its lifespan,not ifespan
EDIT:can units have a plague_target behaviour?
edited 1×, last 05.09.08 03:27:08 pm

old hope I'm right here...

Vince87
User Off Offline

Quote
I have a question:
How do I get self made animals into stranded 2?

modeling and animation already done in milkshape.

what i have to do now?
any tutorial or somthing like that out there?

old Re: Scripting Questions

HudaJan
Super User Off Offline

Quote
not $hour=hour;
but
$hour=hour();
fucking detail
and another detail, you have to assign script to event
Quote
script=start
if ($hour==7) {
if ($lifespan<20) {

should be
1
2
3
4
script=start 
   on:some_event {
     if ($hour==7) { 
          if ($lifespan<20) {
of course dont forget extra } at the end

old fixing building

darksol
User Off Offline

Quote
i am making a mod. i am trying to make it so gathering the material is not the long part and the proses of making the building is the long part would i add a script like
1
2
3
4
on:build_finish {
		event "building",0,0;
		process "building",1000;
	}
and how do you make it so that you don't have to take a long time putting materials on to the building site
edited 1×, last 05.09.08 10:21:56 pm

old Re: Scripting Questions

HudaJan
Super User Off Offline

Quote
Ok, let's make an analysis
Quote
i am making a mod and i am trying to make it so that win you build a building it takes time to make it like win you are making a stuff and not the gathering part?

"win" is probably "when", that's key word of it. So now it should look like this:
Quote
i am making a mod and i am trying to make it so that when you build a building it takes time to make it like when you are making a stuff and not the gathering part?


hmm.. anyone else can continue analysis, cause I'm in dead-end

old Re: Scripting Questions

Raven Shadow
User Off Offline

Quote
*sigh s/he said he wants to know how increase construction time.
Right now more time is spent gathering the materials needed then the actual construction.
Everytime the player right clicks on a construction site,
s/he wants to add a time requirement, such as how the s2 cmd process command does when combining items
or eating does.



unquote

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
I guess you could make a combo for the materials required and add this script to the building in buildings.inf
1
2
3
4
5
6
7
script=start
	on:build_finish{
		process "building", 10000;
		//you can change the 10000 to whatever you want
		jade 40;
		//increases the hunger, thirst, and exaustion all by 40 (you can also change)
	}

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
you forgot abour the script end in the end of the code.
1
2
3
4
5
6
7
script=start 
     on:build_finish{ 
          process "building", 10000; 
          //you can change the 10000 to whatever you want 
          jade 40; 
          //increases the hunger, thirst, and exaustion all by 40 (you can also change) 
     }
but it needs to be like this:
1
2
3
4
5
6
7
8
script=start 
     on:build_finish{ 
          process "building", 10000; 
          //you can change the 10000 to whatever you want 
          jade 40; 
          //increases the hunger, thirst, and exaustion all by 40 (you can also change) 
     } 
script=end
that should work
EDIT:can something have 2 behaviours?
edited 1×, last 08.09.08 12:50:03 pm

old Re: Scripting Questions

Mc Leaf
Super User Off Offline

Quote
HudaJan has written
DontKnowToScript has written
can something have 2 behaviours?

Nonsence

No, it isn't. You may think of a behaviour like "bird" and "raptor" both, anyway an aggressive bird. But unfortunately it isn't possible, but not nonsence.

(Damn, I often wonder why DC didn't thought about that possibility and implemented it! Maybe 'cause lack of abstract thinking here.)
To the start Previous 1 243 44 45121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview