Well...I have a small problem for my campaign mission.
The last bit of the mission is for the Commando class only (and it has to be....the final objective is way too easy if you've got access to rocketeer). It's fine to AddUnitClass the commando only at the later section when he's needed....but I can't remove the other classes (which are used in the first half of the mission). Anyone know how to get rid of them via lua?
Removing Units in Campaign
Moderator: Moderators
- Sky_216
- Droid Pilot Assassin

- Posts: 2086
- Joined: Mon Feb 13, 2006 3:28 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
-
Master_Ben
- Lieutenant General

- Posts: 675
- Joined: Wed Nov 12, 2008 9:50 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Watching your PC over your shoulder. No, the other sholder....
Re: Removing Units in Campaign
Well, I'm not sure if you could do something like, assault = "" in a second setup_teams at that point. I don't think that has much hope
, so you could set the PointsToUnlock value to some giant number in the Objective.OnStart function.
- Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: Removing Units in Campaign
You can't "remove" a unit once it's been added, sorry, no way to do that.
The workaround I like to use, though, is setting the pointstounlock to an obscenely high number (a la 9999) for all the units you want to "remove." They'll still be visible, but as long as you make sure your next objective can only be triggered by a commando unitclass, the player will be forced to switch and then will be unable to use the other units.
The workaround I like to use, though, is setting the pointstounlock to an obscenely high number (a la 9999) for all the units you want to "remove." They'll still be visible, but as long as you make sure your next objective can only be triggered by a commando unitclass, the player will be forced to switch and then will be unable to use the other units.
- Sky_216
- Droid Pilot Assassin

- Posts: 2086
- Joined: Mon Feb 13, 2006 3:28 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: Removing Units in Campaign
@Mav:
Hmmmm...could you possibly show me the code you need to make sure the objective is triggered by a commando class only? The objective for it is a simple "goto" objective.
Oh and thanks for the info.
Hmmmm...could you possibly show me the code you need to make sure the objective is triggered by a commando class only? The objective for it is a simple "goto" objective.
Oh and thanks for the info.
- Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: Removing Units in Campaign
All I really meant was make sure that the story can't move ahead without the commando class being equipped/used. I usually do this with some kind of impassible area (or a trigger that doesn't happen) until the class in question is being used. You can test the character class with this statement:
The "number" of the character class is its position on the team list - the first unit loaded is "0," second is "1," etc. If your commando is unit seven, then it would be:
And that's in the context of an OnEnterRegion function.
Code: Select all
if GetCharacterClass(player) == 0 thenCode: Select all
if GetCharacterClass(player) == 6 then