I have a script which turns 2 members of a faction hostile in a certain interior area. They are the only ones in the area. Later, other members of that faction from a different area are hostile after this point, even though global effect is not checked. I’ve saved everything and even done a build. What is going on?
You’re probably changing faction reputation. Try changing personal reputation instead. By all means post your script, if that helps.
// Make “COW1” dislike the PC more.
oTarget = GetObjectByTag(“COW1”);
DelayCommand(3.0, AdjustReputation(oPC, oTarget, -100));
// Make "COW2" dislike the PC more. oTarget = GetObjectByTag("COW2"); DelayCommand(3.0, AdjustReputation(oPC, oTarget, -100));
Should I use SetIsEnemy instead?
Yep, as Proleric suspected.
Debugging rule of thumb: When stuff goes wrong, look up what the functions you’re using do.
// Adjust how oSourceFactionMember's faction feels about oTarget by the // specified amount. // Note: This adjusts Faction Reputation, how the entire faction that // oSourceFactionMember is in, feels about oTarget. // * No return value // Note: You can't adjust a player character's (PC) faction towards // NPCs, so attempting to make an NPC hostile by passing in a PC object // as oSourceFactionMember in the following call will fail: // AdjustReputation(oNPC,oPC,-100); // Instead you should pass in the PC object as the first // parameter as in the following call which should succeed: // AdjustReputation(oPC,oNPC,-100); // Note: Will fail if oSourceFactionMember is a plot object. void AdjustReputation(object oTarget, object oSourceFactionMember, int nAdjustment)
Try using SetIsTemporaryEnemy instead.
Does it matter whether both potential enemies turn hostile?
As it stands, when you make one a temporary enemy (or attack them, which has the same effect for a local faction), the other will only become hostile if they’re close enough to hear a combat shout.
That might suit your purpose, but, if not, you can loop through all the creatures in the area, making all members of the faction temporary enemies. That will have no effect on other areas.
In my case, there were no more nearby members of this faction. The closest one was 2 areas away (speaking walking wise) so setting the ones I wanted as temporary enemy for 90 seconds was quite sufficient.