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 248 49 50121 122 Next To the start

old Re: Scripting Questions

ESKARN
User Off Offline

Quote
jockmo42 has written
Bloodshot has written
Because when you sleep, it registers how high you are. set a timer for a half a second or so, and then order it to check the players height


Would that be expensive system-wise?


what and where do you put it and ingame or out

and my previous question

is there anyway to make a raptor (or any unit) attack another unit
eg raptor attack a monkey

old Re: Scripting Questions

jockmo42
User Off Offline

Quote
So unsurprisingly, on a big island full of stuff, looping global timers makes for a slight bit of choppiness. Wetness is out for now, unless someone knows a more efficient way to do it.

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
hmm... maybe do the same thing but create a timer instead of:
1
2
...
timer "unit",1,500,1,"getwet";
and this to the player unit:
1
2
3
on:getwet {
addstate "unit",1,"wet";
}

old Re: Scripting Questions

ESKARN
User Off Offline

Quote
DontKnowToScript has written
hmm... maybe do the same thing but create a timer instead of:
1
2
...
timer "unit",1,500,1,"getwet";

put this where

and this to the player unit:
1
2
3
on:getwet {
addstate "unit",1,"wet";
}

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
1
2
3
on:getwet { 
addstate "unit",1,"wet"; 
}
this to the player unit.
and this to game inf:
1
2
... 
timer "unit",1,500,1,"getwet";

old Re: Scripting Questions

jockmo42
User Off Offline

Quote
DontKnowToScript has written
hmm... maybe do the same thing but create a timer instead of:
1
2
...
timer "unit",1,500,1,"getwet";
and this to the player unit:
1
2
3
on:getwet {
addstate "unit",1,"wet";
}


Hmm, but then I'd still need to check if the player was underwater. That's what's slowing it down.

old Re: Scripting Questions

DontKnowToScript
User Off Offline

Quote
see on:sleep {
1
2
3
4
5
6
7
8
if (gety("unit",1)>0){
...
}else{
msg "sleeping in the water?",3;
msg "not a good idea..",3;
}
...
script=end

old Re: Scripting Questions

ESKARN
User Off Offline

Quote
DontKnowToScript has written
see on:sleep {
1
2
3
4
5
6
7
8
9
on:sleep {
		if (getplayervalue(4)>5){
			local $y;
			$y=gety("unit",1);
			if ($y>0){
				timer "unit",1,500,1,"getwet"; 
				if (playerspotted()==0){
					//Exhaustion
					consume 0,-35,-35,100;

i put it there but it dosent work am i ment to put it some where else in sleeping

old Re: Scripting Questions

jockmo42
User Off Offline

Quote
DontKnowToScript has written
see on:sleep {
1
2
3
4
5
6
7
8
if (gety("unit",1)>0){
...
}else{
msg "sleeping in the water?",3;
msg "not a good idea..",3;
}
...
script=end


Yep. But I'm trying to check if the player is in the water at any given moment. You need a timer hooked to it, and looping a global timer to check if the player is in the water is very expensive game-wise.

old Re: Scripting Questions

jockmo42
User Off Offline

Quote
DontKnowToScript has written
do on:start {
timer "unit",1,500,0,"getwet";
}
and to player unit:
on:getwet {
addstate "unit",1,"wet";
}


But that'll get you wet whether you're in the water or not, and won't the timer stop after that?

old Re: Scripting Questions

HudaJan
Super User Off Offline

Quote
Hmmm...
This one will work, but not right for your case.
Better do this
1
2
3
4
5
6
7
8
9
10
11
on:start {
	timer "unit",1,500,0,"getwet";
} //this part is right
//and to player unit:
on:getwet {
	if (gety("unit",1)>0){
		if(statevalue("unit",1,"wet")>0){
			addstate "unit",1,"wet";
		}
	}
}
To the start Previous 1 248 49 50121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview