Increase a units health through lua?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Increase a units health through lua?

Post 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?
User avatar
SW_elite
Filthy Thief
Filthy Thief
Posts: 507
Joined: Sat Jan 02, 2010 6:43 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia!!!

Re: units heal

Post 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
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: units heal

Post 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
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: units heal

Post 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).
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: units heal

Post by skelltor »

Ok so just add that line into the lua?
User avatar
Filipinio
Master Sergeant
Master Sergeant
Posts: 178
Joined: Fri Jan 22, 2010 3:29 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Mygeeto's Bridge Battle's

Re: units heal

Post by Filipinio »

No, into the units odf under properties, either the defualt odf, or the units odf.
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: units heal

Post by skelltor »

oh well i am asking for a way to do it through the lua.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: units heal

Post 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.
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: units heal

Post by skelltor »

ok thx everyone :D. Hey would the setclassproperty also work with wepons or mshs?
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: units heal

Post 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.
Post Reply