First I added this to the list of defines up top:
Code: Select all
#define VETERAN_LEVEL 32 // get

I then went in and added these lines to the switch in GetUnitVal:
Code: Select all
case VETERAN_LEVEL:
return(unit->experience);
I tried making the unit's max speed obtainable from the script. Well, actually, I tried to make it settable by adding to the SetUnitVal function. I added #define SET_MAX_SPEED 21 to the top, and this to the function's switch:
Code: Select all
case SET_MAX_SPEED:
unit->speed = val;[code]
However, the compiler complains about not being able to convert the value from int to float, and well, I'm lost at that point. If I try to just use it as a get value instead, it complains about float to int :P I understand the relationships between the variable types, I just don't know how I'd go about fixing such a thing in a large and complex program such as Spring.
It'd be nice to plug in other things from the FBI to set/get in the script, such as the unit's stealth ability and other various things. I know Dragon45 worked out setting health from the script a while back, and I know zwzsg wants to be able to forcefully kill other units from his scripts, which looks like it should be possible.
So uhh, yeah, help please? :)