Forum

> > Stranded II > Scripts > Unit getting state
Forums overviewStranded II overview Scripts overviewLog in to reply

English Unit getting state

3 replies
To the start Previous 1 Next To the start

old Unit getting state

MarteszHU
User Off Offline

Quote
I am working on an unit called robot. It has 450 health. How to make it smoking at 250, burning at 150 and shocking at 50 health?

old Re: Unit getting state

Hurri04
Super User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
on:hit {
	$health = health("self");
	if($health <= 50) {
		addstate "self", "electroshock";
	}elseif($health <= 150) {
		addstate "self", "smoke";
	}elseif($health <= 250) {
		addstate "self", "fire";
	}
}

note that 450 hp is very much in S2. the player's normal hit without anything in his hands does 3 damage. at least for testing purposes I'd recommend to lower it to 45 hp (and the values in the script respectively).

if you want to do something a bit more advanced >


Edit: fixed the spelling error in the script
edited 1×, last 16.03.14 06:07:20 pm

old Re: Unit getting state

Nova
User Off Offline

Quote
This script always adds the states when the hp is lower than the value and the robot gets hit, even if the robot already has them. Just keep that in mind, if you want to change the script.

old Re: Unit getting state

MarteszHU
User Off Offline

Quote
Thanks for the help!

EDIT:I needed to fix the script, but its working fine. Thanks again.
edited 1×, last 16.03.14 03:52:26 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview