PDA

View Full Version : Another Scripting question


brwarner
10-15-2005, 10:43 PM
How would I go about using a script to cause a NPC of Faction 2 attack another NPC of faction 2. I have tried a few things but they don't work.

Darth333
10-15-2005, 11:27 PM
Change their factions to prey and predator:

void main()
{
ChangeToStandardFaction(GetObjectByTag("object1_tag"), STANDARD_FACTION_PREDATOR);
ChangeToStandardFaction(GetObjectByTag("object2_tag"), STANDARD_FACTION_PREY);
}

Depending on what you want to do, you may also use the SetMinOneHP function .

brwarner
10-16-2005, 09:00 AM
I put this in the OnDialog script on a Younge Rancor in a custom module because I wanted it to just attack another object when I clicked on it yet when I do it simply stands there and I can't talk to it anymore. Not that it has a conversation.

Darth333
10-18-2005, 10:59 AM
Try this:

void main()
{
object oNPC1= GetObjectByTag("insert_object_tag");
object oNPC2= GetObjectByTag("insert_object_tag");
ChangeToStandardFaction(oNPC1, STANDARD_FACTION_PREDATOR);
ChangeToStandardFaction(oNPC2, STANDARD_FACTION_PREY);

//these 2 lines will make them immortal and they will fight forever - remove them if you don't want this.
SetMinOneHP(oNPC1,TRUE);
SetMinOneHP(oNPC2,TRUE);

DelayCommand(1.0, AssignCommand(oNPC1, ActionAttack(oNPC2));
}