Forum

> > Stranded II > Scripts > Unit getting state
ForenübersichtStranded II-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Unit getting state

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Unit getting state

MarteszHU
User Off Offline

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

alt Re: Unit getting state

Hurri04
Super User Off Offline

Zitieren
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
1× editiert, zuletzt 16.03.14 18:07:20

alt Re: Unit getting state

Nova
User Off Offline

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

alt Re: Unit getting state

MarteszHU
User Off Offline

Zitieren
Thanks for the help!

EDIT:I needed to fix the script, but its working fine. Thanks again.
1× editiert, zuletzt 16.03.14 15:52:26
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtStranded II-ÜbersichtForenübersicht