Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void StopCombat(object oPC, object oEnemy, int nRounds, int bAll = FALSE)
- {
- float fTime = RoundsToSeconds(nRounds);
- int x = 1; // iterations of combatant loop
- int y = 0; // iterations of pc loop
- int z; // iterations of associate type
- int max = x+50; // maximum combatants of each character to neutralize
- object oNPC; // associates of oPC
- object oCombatant; // additional enemies of oPC or oNPC
- while (GetIsObjectValid(oPC))
- {
- // targeted enemy of PC
- SetCommandable(TRUE, oPC);
- SetCommandable(TRUE, oEnemy);
- AssignCommand(oPC, ClearAllActions(TRUE));
- SetIsTemporaryFriend(oEnemy, oPC, TRUE, fTime);
- AssignCommand(oEnemy, ClearAllActions(TRUE));
- SetIsTemporaryFriend(oPC, oEnemy, TRUE, fTime);
- if (bAll)
- {
- // next loop through all remaining enemies of oPC
- x = 1;
- oCombatant = GetNearestEnemy(oPC, x);
- while (GetIsObjectValid(oCombatant))
- {
- SetCommandable(TRUE, oCombatant);
- AssignCommand(oCombatant, ClearAllActions(TRUE));
- SetIsTemporaryFriend(oPC, oCombatant, TRUE, fTime);
- SetIsTemporaryFriend(oCombatant, oPC, TRUE, fTime);
- if (++x==max) break;
- oCombatant = GetNearestEnemy(oPC, x);
- }
- }
- // loop through all Associates of oPC
- for (z = 1; z <= 5; z ++)
- {
- int w = 1;
- oNPC = GetAssociate(z, oPC, w);
- while (GetIsObjectValid(oNPC))
- {
- // first enemy of NPC
- SetCommandable(TRUE, oNPC);
- AssignCommand(oNPC, ClearAllActions(TRUE));
- SetIsTemporaryFriend(oEnemy, oNPC, TRUE, fTime);
- AssignCommand(oEnemy, ClearAllActions(TRUE));
- SetIsTemporaryFriend(oNPC, oEnemy, TRUE, fTime);
- if(bAll)
- { // next loop through all remaining enemies of NPC
- x = 1;
- oCombatant = GetNearestEnemy(oNPC, x);
- while (GetIsObjectValid(oCombatant))
- {
- if (x==max) break;
- SetCommandable(TRUE, oCombatant);
- AssignCommand(oNPC, ClearAllActions(TRUE));
- SetIsTemporaryFriend(oCombatant, oNPC, TRUE, fTime);
- AssignCommand(oCombatant, ClearAllActions(TRUE));
- SetIsTemporaryFriend(oNPC, oCombatant, TRUE, fTime);
- oCombatant = GetNearestEnemy(oNPC, ++x);
- }
- }
- oNPC = GetAssociate(z, oPC, ++w);
- }
- }
- // only continue loop in multiplayer games
- if(!MULTIPLAYER)
- break;
- else
- {
- // loop through PC party members
- if (++y==1)
- oPC = GetFirstFactionMember(oPC);
- else
- oPC = GetNextFactionMember(oPC);
- }
- } // loop through PC party members
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement