Page 1 of 1

Increase a units health through lua?

Posted: Sat Apr 17, 2010 7:47 pm
by skelltor
I want to make a new mode where it is some units vs a hero but want the hero to be stronger.is there a way to increase a units health through lua or make him heal if so how? or do i need to make a new hero that heals?

Re: units heal

Posted: Sat Apr 17, 2010 7:58 pm
by SW_elite
You can add more health through the odf but I found a piece of code in the coruscant campaign script and I think it set the health for the bookcases, I say have a look at the script and see what you think, but I know you can add health using this line in the odf: MaxHealth= X

Just make sure you add that lin under the properties line.

Please do not type in all bold, it is against the rules, -Staff

Re: units heal

Posted: Sat Apr 17, 2010 8:13 pm
by myers73
SetClassProperty("cis_inf_rifleman", "MaxHealth", 5000) --makes super b-droid have health of normal hero
do and search here on the forrums and you will get plenty of other examples

Re: units heal

Posted: Sat Apr 17, 2010 8:35 pm
by AQT
skelltor wrote:or make him heal
Instead of MaxHealth, you can try AddHealth with the SetClassProperty function (following value indicates how much health a unit recovers per second).

Re: units heal

Posted: Sun Apr 18, 2010 2:48 pm
by skelltor
Ok so just add that line into the lua?

Re: units heal

Posted: Sun Apr 18, 2010 3:31 pm
by Filipinio
No, into the units odf under properties, either the defualt odf, or the units odf.

Re: units heal

Posted: Sun Apr 18, 2010 3:50 pm
by skelltor
oh well i am asking for a way to do it through the lua.

Re: units heal

Posted: Sun Apr 18, 2010 4:40 pm
by AQT
SetClassProperty is a LUA function so that would mean the line goes in your LUA. MaxHealth and AddHealth are ODF functions by themselves.

Re: units heal

Posted: Sun Apr 18, 2010 4:55 pm
by skelltor
ok thx everyone :D. Hey would the setclassproperty also work with wepons or mshs?

Re: units heal

Posted: Sun Apr 18, 2010 6:16 pm
by kinetosimpetus
Yes and No, depends on whether you want multiplayer to work.

Player models, addon meshes, first persons can be swapped, playermodels will affect new spawning units, the others affect all, and weapons will crash multiplayer.

SetClassProperty cannot be called directly on a weapon odf.