Page 1 of 1

Health settable via script

Posted: 25 Jun 2005, 01:00
by Dragon45
Download Link: http://fileuniverse.com/?page=showitem&ID=1049

For the coders:
On line 816 in CobInstance.cpp, add the line

Code: Select all

unit->health = ((param/100.0f)*unit->maxHealth);
it should be in the SetUnitVal function definition after the "case HEALTH:" and before the "break".



For the modders:
Use the syntax

Code: Select all

set HEALTH to 25;
to set the health to to a percentage of its max health. In this case, the health is set to 25% of the max health. You can use more than 100% too, so something like

Code: Select all

set HEALTH to 300;
would set the unit's health to 3 times its maximum value.



IMHO, this should be made a part of standard/regular Spring, since it in no way breaks the old units, but really extends modding potential.

Posted: 28 Jul 2005, 23:40
by Guessmyname
heh, sorry to rez, but this will make kill scripts work now (Have script detect when a unit is at very low health, have a nice little death animation, then set the health to 0)

Posted: 28 Jul 2005, 23:46
by AF
Have the SY's given support for this to be included in the engine? Or will ti be assigned to project forks and custom executables?