How do I tell the lua to remove two units when a unit dies?
Moderator: Moderators
- RED51
- Jedi

- Posts: 1024
- Joined: Sun Sep 07, 2008 6:25 pm
How do I tell the lua to remove two units when a unit dies?
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?
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: How do I tell the lua to remove two units when a unit dies?
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.
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.
- Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: How do I tell the lua to remove two units when a unit dies?
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:
It usually will not get much easier to find - make sure you read through comments made in a lua; they can often be informative.
-- 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)- RED51
- Jedi

- Posts: 1024
- Joined: Sun Sep 07, 2008 6:25 pm
Re: How do I tell the lua to remove two units when a unit dies?
Argh...I didn't even notice that! Thanks. I hope this will balance my maps.
