Removing unitclass

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
MandeRek
Sith Master
Sith Master
Posts: 2766
Joined: Tue Oct 02, 2007 10:51 am
Projects :: Battlefront Zer0
Games I'm Playing :: SWTOR
xbox live or psn: No gamertag set
Location: Ghosting around GT
Contact:

Removing unitclass

Post by MandeRek »

Hey there! I'm making this script and I got a little question. I used the Grievous lines from Utapau to add a 'hero' which you need to kill.

I get this error:

Code: Select all

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(3441)
Slot 0 out of range [0..0)
uf_updateClassIndex(): Added class:    lis_hero_shaakti
So, I thought I could just do it as I usually do, by just adding in AddUnitClass(..)
But, after the objective, the class keeps spawning, and I want to remove it.
How can I remove a unitclass I added like this?

Thanks in advance
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: Removing unitclass

Post by skelltor »

After you add a unit class I don't think you can remove it. What I would do is make his unit amount lines 0 ie soldier = { "rep_inf_501st_rifleman",0, 0},
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Removing unitclass

Post by Teancum »

Or you can set the team's reinforcements accordingly.
MandeRek
Sith Master
Sith Master
Posts: 2766
Joined: Tue Oct 02, 2007 10:51 am
Projects :: Battlefront Zer0
Games I'm Playing :: SWTOR
xbox live or psn: No gamertag set
Location: Ghosting around GT
Contact:

Re: Removing unitclass

Post by MandeRek »

skelltor wrote:After you add a unit class I don't think you can remove it. What I would do is make his unit amount lines 0 ie soldier = { "rep_inf_501st_rifleman",0, 0},
How would I do that in an function? So change it?

SetUnitClass("rep_inf_501st_rifleman", 0, 0) or summin?
Hidden/Spoiler:
Forgive me, I never was the most advanced scripter...
fasty
1st Lieutenant
1st Lieutenant
Posts: 438
Joined: Thu Apr 15, 2010 4:17 am
Projects :: Server modding
Games I'm Playing :: SWBF2
Contact:

Re: Removing unitclass

Post by fasty »

It would be easier to make a third team and then spawn him with an ambush.
MandeRek
Sith Master
Sith Master
Posts: 2766
Joined: Tue Oct 02, 2007 10:51 am
Projects :: Battlefront Zer0
Games I'm Playing :: SWTOR
xbox live or psn: No gamertag set
Location: Ghosting around GT
Contact:

Re: Removing unitclass

Post by MandeRek »

Right, I'll read the tutorial for that part :) Thanks for all help so far, I'll keep you all updated
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: Removing unitclass

Post by skelltor »

MandeRek wrote:
skelltor wrote:After you add a unit class I don't think you can remove it. What I would do is make his unit amount lines 0 ie soldier = { "rep_inf_501st_rifleman",0, 0},
How would I do that in an function? So change it?

SetUnitClass("rep_inf_501st_rifleman", 0, 0) or summin?
Hidden/Spoiler:
Forgive me, I never was the most advanced scripter...
I think that should work :)
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Removing unitclass

Post by AQT »

SetUnitCount is for setting the number of units on a particular team, not for setting the minimum or maximum spawn count for a specific unit class.
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: Removing unitclass

Post by THEWULFMAN »

Doing what Fasty suggested should work fine, an ambush team would do the job.
Post Reply