Page 1 of 1
How do I tell the lua to remove two units when a unit dies?
Posted: Tue Mar 17, 2009 3:29 pm
by RED51
In the Death Star, when the attackers(or was it the defenders...) lose a unit, they lose two units off of their reinforcement count. I've looked at the lua for it, but no hit. So how do I do it?
Re: How do I tell the lua to remove two units when a unit dies?
Posted: Tue Mar 17, 2009 5:58 pm
by Fiodis
Argh! This is one of the things that I know right until someone asks me. Then it goes right outta my head. It's on the tip of my tounge....
Darn. I can't remember the exact line, but look in the space LUAs. Maybe there's something in those that removes (or adds) a certain amount of points as a frigate/critical system is destroyed. Unless that's in the ODF. I believe it's something like AddAssaultPoints with a negative value. Not sure too much, though. Sorry I couldn't be more help.
Re: How do I tell the lua to remove two units when a unit dies?
Posted: Tue Mar 17, 2009 6:28 pm
by Maveritchell
There are lots of ways you
can do it. One way is particularly conspicuous in the Death Star .lua you said you looked at; it is right up at the top and even has the comment:
-- handle reinforcment loss and defeat condition
Code: Select all
OnCharacterDeathTeam(function(character, killer) AddReinforcements(1, -1) end, 1)
OnTicketCountChange(function(team, count) if count == 0 then MissionDefeat(team) end end)
It usually will not get much easier to find - make sure you read through comments made in a lua; they can often be informative.
Re: How do I tell the lua to remove two units when a unit dies?
Posted: Tue Mar 17, 2009 6:49 pm
by RED51
Argh...I didn't even notice that! Thanks. I hope this will balance my maps.