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 239 40 41121 122 Next To the start

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
jockmo42 has written
DontKnowToScript has written
np
wait
under the script=start there is store item copy the loot items then paste them into store item


Not quite getting how that's layed out. Want to paste just the catch script with the revision?

no. make the big snail and change the first loot number to the id of the item u want,and the second number its how many items from that type .if u want u can make more loots to have the animal with more items.do the same in store item in catch script

old Re: Scripting Questions

jockmo42
User Off Offline

Quote
DontKnowToScript has written
jockmo42 has written
DontKnowToScript has written
np
wait
under the script=start there is store item copy the loot items then paste them into store item


Not quite getting how that's layed out. Want to paste just the catch script with the revision?

no. make the big snail and change the first loot number to the id of the item u want,and the second number its how many items from that type .if u want u can make more loots to have the animal with more items.do the same in store item in catch script


Right... I'll figure it out.

old Re: Scripting Questions

Raven Shadow
User Off Offline

Quote
HudaJan has written
I'm not sure if I understan you right, but if yes, you could use s2 cmd image
Make the image (pink color r 255, g 0, b 255) is showed as transparent...

how do you delete an image created with the
s2 cmd image command?
I tried repeating the command using empty quotes,
and the same id, but that didn't work.

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
I'm trying to make a baby raptor that you can hatch from a raptor egg and grow to full health, and might even make a nest so she and you can grow new baby raptors. But it says-"on" must not be subordinated to conditions >Script unit 100 (baby raptor type 60)
>event start
>Row 39
>Col 8
>script: on:use{

and this is the script:
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
114
115
116
117
118
119
120
121
122
###Baby Raptor
id=60
name=Baby Raptor
group=animal
icon=gfx\raptor.bmp
model=gfx\raptor.b3d
scale=0.065
colxr=15
colyr=30
behaviour=monkey
health=40
speed=$speed
eyes=7
turnspeed=3.0
attackrange=65
damage=24
ani_idle1=4,8,0.02
ani_move=2,3,0.06
ani_die=8,11,0.05
ani_attack=12,16,0.07
sfx=raptor
rideoffset=5
acceleration=0.08
maxdepth=35
loot=9,1
loot=94,8
loot=95,4
loot=96,3
loot=4982,6
loot=71,5
script=start
	$hour=hour;
	if ($hour==7) {
		local $hunger;
		$hunger++;
		msg "The baby raptor's hungry!",1;
	}
	if ($hour==12) {
		local $hunger;
		$hunger++;
		msg "The baby raptor's hungry!",1;
	}
	if ($hour==18) {
		local $hunger;
		$hunger++;
		msg "The baby raptor's hungry!",1;
	}
	on:changeday {
		if ($hunger>2) {
			kill "self";
		}
	$lifespan++;
	local $lifespan;
	if ($lifespan==5) {
		scale 0.13;
		$speed=1.5;
	}
	if ($lifespan==10) {
		scale 0.25;
		$speed=1.8;
	}
	if ($lifespan==16) {
		scale 0.35;
		$speed=2.1;
	}
	if ($lifespan==20) {
		scale 0.5;
		$speed=2.5;
	}
	on:use {
	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 "negitive";
	}
	}
	on:ai_attack {
		if (random(8)==1){
			if (gotstate("unit",1,17)==0){
				if (random(5)<2){
					addstate "unit",1,1;	
				}else{
					addstate "unit",1,7;
				}
			}
		}
	}	
	
	on:kill {
		event "iskill_hunt","global";
	}
	on:create {
		timer "self",3000,0;
		local $babyraptor;
		$babyraptor=1;
		$speed=1.25;
	}
	on:start {
		timer "self",3000,0;
		local $babyraptor;
		$babyraptor=1;
		$speed=1.25;
	}
	on:timer {
		if (health("self")>0){
			ai_mode "self","goto","unit","1";
			ai_center;
		}
		if (count_stored("self")>0){
			addstate "self","particles";
		}else{
			freestate "self","particles";
		}
	}
script=end

old Re: Scripting Questions

HudaJan
Super User Off Offline

Quote
speed=$speed

Variables are not allowed in definitions. Unfortunalty

But u can use

addstate "unit",ID,"speed";
statevalue "unit",ID,"speed",SPEED;

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
does any1 know WHERE i can find a 3d creating software?if so,how i will make to b3d?plz tell me
EDIT:forget about this.
BTW,how do i make a lion tamable?
edited 2×, last 24.08.08 07:23:08 pm

old Re: Scripting Questions

Raven Shadow
User Off Offline

Quote
HudaJan has written
just
freeimage id;
look s2 cmd freeimage

already thought of that ... too bad there is no such command

I did eventually realize that S2 has problem with variable and command recognition under certain conditions.....

using image ID,""; works.
edited 1×, last 24.08.08 07:47:05 pm

old Re: Scripting Questions

Raven Shadow
User Off Offline

Quote
DontKnowToScript has written
can anyone help me where i can find a free model creating software and how i make them into b3d


www.blender.org
Do search of the blender forums for a 3rd party b3d exporter and you'll find it

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
HudaJan has written
addstate "unit",ID,"tame";

i dont mean this,i mean when u give him big meat,then when he eats certain amount,he become tamed

old Re: Scripting Questions

Raven Shadow
User Off Offline

Quote
Bloodshot has written
I'm trying to make a baby raptor that you can hatch from a raptor egg and grow to full health, and might even make a nest so she and you can grow new baby raptors. But it says-"on" must not be subordinated to conditions >Script unit 100 (baby raptor type 60)
>event start
>Row 39
>Col 8
>script: on:use{

and this is the script:
1
2
3
4
5
6
7
script=start
	$hour=hour;
	if ($hour==7) {
		local $hunger;
		$hunger++;
		msg "The baby raptor's hungry!",1;
	}

this is the problem ....
Script contained in a definition, is only accepted when it's part of a trigger.
i.e.
on:start{
//all code here (just an example)
}

any code placed outside of a trigger just confuses S2,
probably because it doesn't know WHEN to excute it.

old Re: Scripting Questions

DC
Admin Off Offline

Quote
Raven Shadow is right. script outside of a "trigger" or "event" (the on:... stuff) makes not much sense. but this doesn't lead to an error at all. in fact it is allowed. SII will execute such code whenever any events which are stated in the same script happen.

the real problem is that you forgot an }
you used the on:changeday event before but you did not "close" this event.

of course it is not possible/allowed to have an event in another event. that's what you did:
1
2
3
4
on:changeday {
	...
	on:use { ... }
}

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
Tyvm to you all... I'll test it after dinner. I was checking on:use and not change day so that's why i didn't find a problom. alright, what's wrong here-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
on:use {
	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 "negitive";
	}
	}
no real errors but even when i have meat it says "I need raw meat to feed him!"
edited 1×, last 25.08.08 01:05:38 am

old Re: Scripting Questions

Raven Shadow
User Off Offline

Quote
DC has written
Raven Shadow is right. script outside of a "trigger" or "event" (the on:... stuff) makes not much sense. but this doesn't lead to an error at all. in fact it is allowed. SII will execute such code whenever any events which are stated in the same script happen.

the real problem is that you forgot an }
you used the on:changeday event before but you did not "close" this event.

of course it is not possible/allowed to have an event in another event. that's what you did:
1
2
3
4
on:changeday {
	...
	on:use { ... }
}

Thank you for the confirmation

but i need to disagree on 1 point, "errors" do occure
when code is used outside of an event.
Here's an example of a bit of code i was struggling
with earlier today:
1
2
3
4
5
6
7
8
9
10
11
script=start
	$var1=0;
	$var2=0;
	on:sample1 {
		if ( $var1==0) {
			$var=1;
		}else{
			$var=0;
		}
	}
script=end
in this sample the value of $var1 is set to 1 only once,
every other time the event is triggered, it remains zero
and if you get the IF to run correctly the value will still
be reset to zero before the IF is even gotten to.

it's as if ALL code outside of an ON: code is executed
eah time any event with the "script=" is executed.

And and i've found that any IF conditions within an ON:
event fail to be correctly caculated if it rely on any
variables created or even referenced as in the code above.

old Re: Scripting Questions

jockmo42
User Off Offline

Quote
Okay, so I've got all my crazy net fun working, (I'm so glad DC has icons for everything) and now I'm trying to make a Firefly Lantern that lights a small area when you drop it. Right now, I've got it working as a torch, but that's silly.

How would I make it light up an area around it when it's on the ground? I'm also having trouble getting a combination for it from a bottle and three fireflies, but I'll save that for later.

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
put this, not in the script, but in the definition-
"weoponstate=24" or, if you want it really bright "weoponstate=22" without the quotes. DKTS, put this script on the unit that you want.
1
2
3
4
5
6
7
8
9
10
11
12
on:changeday{
	local $kiwiX,$kiwiY,$kiwiZ,$daycount;
	$kiwiX= getx "self";
	$kiwiZ= getz "self";
	$kiwiY= gety "self";
	$daycount++;
	if ($daycount==3) { 
		//The 3 means every three days, you can change this
		create "object",197,$kiwiX,$kiwiY,$kiwiz;
		$daycount=0;
	}
}
That is for the kiwi, change the object number next to '"object",' to the proper spawning object for the different animals. You don't have to change the variables. For birds add this to the script
1
$KiwiY-=$how_high_the_bird_flys;//or $birdY-=$how_high_the_bird_flys;
Mesure how high a bird flies and replace that variable with that number. Both: if u guys are making mods, why don't you help with a mod that's out, like "My Stranded"?

Bloodshot has written
Tyvm to you all... I'll test it after dinner. I was checking on:use and not change day so that's why i didn't find a problom. alright, what's wrong here-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
on:use {
	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 "negitive";
	}
	}
no real errors but even when i have meat it says "I need raw meat to feed him!"
Still unanswered
To the start Previous 1 239 40 41121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview