How do I tell the lua to remove two units when a unit dies?

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
RED51
Jedi
Jedi
Posts: 1024
Joined: Sun Sep 07, 2008 6:25 pm
Games I'm Playing :: SWBFII

How do I tell the lua to remove two units when a unit dies?

Post 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?
User avatar
Fiodis
Master of the Force
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?

Post 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.
User avatar
Maveritchell
Jedi Admin
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?

Post 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.
User avatar
RED51
Jedi
Jedi
Posts: 1024
Joined: Sun Sep 07, 2008 6:25 pm
Games I'm Playing :: SWBFII

Re: How do I tell the lua to remove two units when a unit dies?

Post by RED51 »

Argh...I didn't even notice that! Thanks. I hope this will balance my maps.
Post Reply