get MAX_ID;// return the maximum ID that could be used in the game. I was told that currently Spring use ID 0 to 4999, but could allocate more if the (number of player) x (unit per player) required it. And anyway that sort of things is prone to be upped. Or maybe even downed in case you do some optimisation to allocate less if less are needed. I know I could assume a MAX_ID of 16*5000-1, but that is a bit too many ID to check for my script that use "for" on all ID. (Also, to be more TA-like, you could start numbering ID at 1, but it doesn't really matter that much.)
get MY_ID; // return the ID of the unit that is running this script. ID as the 0-4999 number that is given to each new unit. Currently, I can work around by checking which ID verify get UNIT_XZ(id)==get PIECE_XZ(base), but I'd rather have it read cleanly.
get UNIT_TEAM(id);//return the team number of the unit. In TA all player had a reserved id range, so the id itself was enough to determine the ownership of a unit, but it's not the case anymore in Spring, so I'd like a way for me to know if a unit of given ID belongs to which player. I guess it could return something like -1 if there is not unit at this ID. It would be nice to also know if the unit of said Id is allied or not. But maybe it's becoming a bit too hacky to try to load so many information on a single value. Actually, maybe that more than the team number, it would be more interesting to know if it belong to the player, to an ally, or to an enemy.
set UNIT_HEALTH(id) to num;// It's like set HEALTH, but changing health of other units. First argument being the ID of the unit to which to change the health, second argument being the health in % (for instance 100 for max health) to set it to. I guess we could have a get UNIT_HEALTH too, but I see much less use for that one.
set UNIT_HITPOINTS(id) to num;// It's like the previous, but instead of having a second argument in % it takes direcly the number of hitpoint in the unit used in the MaxDamage FBI tag. For instance 29918 for a full health krogoth. Oh, and support a get UNIT_HITPOINTS(id) too.
Yes, those two last are very similar. Probably so similar only one of the two would do, but I figured out it would be quicker to add them both in the same time than only one and find out later the other would have been more useful. Personnaly I prefer the HitPoints one, since it would allow to have scripted pseudo weapon, for instance:
set UNIT_HITPOINTS(id) to get UNIT_HITPOINTS(id) - 40;
to simulate a small blow.
and also things like set UNIT_HITPOINTS(id) to 1; I could turn the unit to "barely living only one more blow and it's gone" etc..
If the UNIT_HEALTH or the UNIT_HITPOINTS is set to below zero, then the unit to which we do that should die. (I'm not not sure its <= or <, but whatever). Killing a unit of given IDvia script would be the most important use of these. However, I think it would be good to allow two ways of killing units.
- One way with the killed unit running its Killed(...) script, leaving wreck, displaying fireworks, and the killer increasing its veterancy and the the killer player increasing its killcount etc..
- One way where the killed unit would be silently erased, without killer veterancy increased, without player killcount increased, without any explosion sequence.
I suggest that setting UNIT_HITPOINTS to zero or below zero, and that setting UNIT_HEALTH to zero, do the regular death, while only setting UNIT_HEALTH to stricly below zero do the silent unit erasure.
About what to do you set them to something higher than the max: I'd suggest that with set UNIT_HIGHTPOINTS, it gets ceiled at the MaxDamage defined in the FBI, while set UNIT_HEALTH allow overboosting the health.
TA use the set get from 1 to 20, TA:K from 21 to at least 34, so for Spring, start using get set from, let's say, 50, or 64.
so let's define use for instance:
#define MAX_ID 71
#define MY_ID 72
#define UNIT_HEALTH 73
#define UNIT_HITPOINTS 73
which will have to be pasted into every script using the new set/get functions, until you get bored and add it in some .h
So, can any dev code me that? please?
