View Full Version : Question about NPCs fighting

Godric Volturi
09-23-2009, 06:34 PM
Okay, like you guys know how the NPCs on Korriban will fight each other... well, I was wondering how to make it to where two new NPCs could do a similar feat... like they would fight but you are able to talk to them too... because they heal after a while and they stop sparring.

09-23-2009, 07:24 PM
I know to make them fight you need to set their faction in the .utc one to predator and one to prey and they will fight not sure about the other bit though.

Godric Volturi
09-23-2009, 07:30 PM
Or Gizka 1 and Gizka 2 lol but I need the other part xD

09-24-2009, 04:58 AM
I think I figured it out!
Right you do the thing I said before and then write a script to change their faction to neutral. Attach the script to some other dialogue say a random twi'lek standing around so when you talk to it the things (in my case Zakkeg and rancor) stop fighting and that should work. Haven't tested it though .

09-24-2009, 07:41 AM
That's pretty much it. You also have to check the box on the utc's Advanced tab for Minimum 1HP, so the npc's will not die before you tt them. You also need a script, if you want them to regain their strengh after fighting. I use this one, it seems to work:

void main() {

object oNPC1 = GetObjectByTag("YOURTAGHERE");
object oNPC2 = GetObjectByTag("YOURTAGHERE");

int nHealth1 = GetMaxHitPoints(oNPC1) - GetCurrentHitPoints(oNPC1);
int nHealth2 = GetMaxHitPoints(oNPC2) - GetCurrentHitPoints(oNPC2);

effect eHeal1 = EffectHeal(nHealth1);
effect eHeal2 = EffectHeal(nHealth2);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal1, oNPC1);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal2, oNPC2);