Forum

> > Stranded II > Scripts > Scripting Questions
ForenübersichtStranded II-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Scripting Questions

2.429 Antworten
Seite
Zum Anfang Vorherige 1 243 44 45121 122 Nächste Zum Anfang

alt Re: Scripting Questions

DC
Admin Off Offline

Zitieren
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.

alt Re: Scripting Questions

Raven Shadow
User Off Offline

Zitieren
jockmo42 hat geschrieben
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.

alt Re: Scripting Questions

jockmo42
User Off Offline

Zitieren
Raven Shadow hat geschrieben
jockmo42 hat geschrieben
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!

alt Re: Scripting Questions

bezmolvie
User Off Offline

Zitieren
Bloodshot hat geschrieben
Alright: baby raptor script (page before) why dosn't s2 register the hour?
Anyone?

alt Re: Scripting Questions

bezmolvie
User Off Offline

Zitieren
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?
1× editiert, zuletzt 05.09.08 01:56:50

alt Re: Scripting Questions

Raven Shadow
User Off Offline

Zitieren
@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

alt Re: Scripting Questions

DontKnowToScript
User Off Offline

Zitieren
there is a typo in the end:
1
if ($ifespan<20) {
its lifespan,not ifespan
EDIT:can units have a plague_target behaviour?
1× editiert, zuletzt 05.09.08 15:27:08

alt hope I'm right here...

Vince87
User Off Offline

Zitieren
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?

alt Re: Scripting Questions

HudaJan
Super User Off Offline

Zitieren
not $hour=hour;
but
$hour=hour();
fucking detail
and another detail, you have to assign script to event
Zitat
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

alt fixing building

darksol
User Off Offline

Zitieren
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
1× editiert, zuletzt 05.09.08 22:21:56

alt Re: Scripting Questions

HudaJan
Super User Off Offline

Zitieren
Ok, let's make an analysis
Zitat
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:
Zitat
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

alt Re: Scripting Questions

Raven Shadow
User Off Offline

Zitieren
*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

alt Re: Scripting Questions

bezmolvie
User Off Offline

Zitieren
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)
	}

alt Re: Scripting Questions

DontKnowToScript
User Off Offline

Zitieren
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?
1× editiert, zuletzt 08.09.08 12:50:03

alt Re: Scripting Questions

Mc Leaf
Super User Off Offline

Zitieren
HudaJan hat geschrieben
DontKnowToScript hat geschrieben
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.)
Zum Anfang Vorherige 1 243 44 45121 122 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtStranded II-ÜbersichtForenübersicht