Quote:
|
I need to do the talk fight talk thing but I want it to be one of my party members to fight (not me). How could I do this?
|
You can accomplish this by using different Faction values in the
ChangeToStandardFaction function.
In the script that initates combat, set your party member(s) faction to
Code:
STANDARD_FACTION_PREDATOR
and the NPC's faction to
Code:
STANDARD_FACTION_PREY
(or vice versa).
This will make them hostile to each other but neutral to everyone else. Just remember to set your party members' factions back to 2 (friendly) in the UserDefine script for the NPC.
Example:
Code:
//Fight script
void main() {
object oNPC=GetObjectByTag("npc_tag");
object oCarth=GetObjectByTag("carth");
// don't let Carth die...
SetMinOneHP(oCarth,1);
ChangeToStandardFaction(oNPC, STANDARD_FACTION_PREY);
ChangeToStandardFaction(oCarth, STANDARD_FACTION_PREDATOR);
// and if there are any thugs to fight...
object oThug1 = GetObjectByTag("npc1_tag");
object oThug2 = GetObjectByTag("npc2_tag");
object oThug3 = GetObjectByTag("npc3_tag");
ChangeToStandardFaction(oThug1, STANDARD_FACTION_PREY);
ChangeToStandardFaction(oThug2, STANDARD_FACTION_PREY);
ChangeToStandardFaction(oThug3, STANDARD_FACTION_PREY);
ExecuteScript("k_ai_master", oNPC, 1005);
ExecuteScript("k_ai_master", oCarth,1005);
}
Code:
//ScriptUserDefine for npc.utc
void main()
{
int nCurrentHP;
int nUser = GetUserDefinedEventNumber();
if(nUser == 1006) // DAMAGED
{
nCurrentHP=GetCurrentHitPoints();
if (nCurrentHP<10) {
CancelCombat (OBJECT_SELF);
ClearAllActions();
ChangeToStandardFaction(OBJECT_SELF, 5);
ChangeToStandardFaction(GetObjectByTag("carth"), 2);
//record that we have fought
SetLocalBoolean(OBJECT_SELF,0,TRUE);
//Turn off the imortality
SetMinOneHP(OBJECT_SELF,FALSE);
SetMinOneHP(GetObjectByTag("carth"),FALSE);
object oPC=GetFirstPC();
ActionDoCommand(ActionStartConversation(oPC));
}
}
}