Page 1 of 1

Removing unitclass

Posted: Thu Feb 09, 2012 2:25 pm
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

Re: Removing unitclass

Posted: Thu Feb 09, 2012 3:58 pm
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},

Re: Removing unitclass

Posted: Thu Feb 09, 2012 4:03 pm
by Teancum
Or you can set the team's reinforcements accordingly.

Re: Removing unitclass

Posted: Thu Feb 09, 2012 5:26 pm
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...

Re: Removing unitclass

Posted: Thu Feb 09, 2012 5:46 pm
by fasty
It would be easier to make a third team and then spawn him with an ambush.

Re: Removing unitclass

Posted: Thu Feb 09, 2012 6:23 pm
by MandeRek
Right, I'll read the tutorial for that part :) Thanks for all help so far, I'll keep you all updated

Re: Removing unitclass

Posted: Thu Feb 09, 2012 7:44 pm
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 :)

Re: Removing unitclass

Posted: Thu Feb 09, 2012 8:57 pm
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.

Re: Removing unitclass

Posted: Fri Feb 10, 2012 12:20 am
by THEWULFMAN
Doing what Fasty suggested should work fine, an ambush team would do the job.