Wiki on SetPlayerEnemy():
Function SetPlayerEnemy(bool abIsEnemy = true) native
"True if the player should be an enemy of the faction, false if the player shouldn't be."
Ok so You call it on a faction, and if set to True, the player will be made an enemy of the faction. Easy enough.
Let's look at SetEnemy():
Function SetEnemy(Faction akOther, bool abSelfIsNeutralToOther = false, bool abOtherIsNeutralToSelf = false) native
akOther: The Faction to form a relationship with.
abSelfIsNeutralToOther: If true, the faction this function is called on will be neutral to the other faction. If false, it will be an enemy.
Default: False
abOtherIsNeutralToSelf: If true, the other faction will be neutral to this faction. If false, it will be an enemy.
Default: False
abSelfIsNeutralToOther: If true, the faction this function is called on will be neutral to the other faction. If false, it will be an enemy.
Default: False
abOtherIsNeutralToSelf: If true, the other faction will be neutral to this faction. If false, it will be an enemy.
Default: False
I read this, and I think: Ok, so I should be able to accomplish the same thing as SetPlayerEnemy with SetEnemy, as long as the player is in the faction I use, right?
I took this code from the werewolf script. It makes anyone and everyone hostile against the player.
Game.GetPlayer().AddToFaction(PlayerWerewolfFaction) Game.GetPlayer().AddToFaction(WerewolfFaction) int cfIndex = 0 while (cfIndex < CrimeFactions.GetSize()); Debug.Trace("WEREWOLF: Setting enemy flag on " + CrimeFactions.GetAt(cfIndex)) (CrimeFactions.GetAt(cfIndex) as Faction).SetPlayerEnemy() cfIndex += 1 endwhileBased off of JUST that code, this should work right? Or am I just doing it wrong?
Game.GetPlayer().AddToFaction(PlayerWerewolfFaction) Game.GetPlayer().AddToFaction(WerewolfFaction) int cfIndex = 0 while (cfIndex < CrimeFactions.GetSize()); Debug.Trace("WEREWOLF: Setting enemy flag on " + CrimeFactions.GetAt(cfIndex)) (CrimeFactions.GetAt(cfIndex) as Faction).SetEnemy(WerewolfFaction, False, True) cfIndex += 1 endwhileI have a custom faction that I'm using, but it's literally the same block of code. I'm trying to make it work for more than just the player, so I don't want to use the SetPlayerEnemy() function. If I use SetPlayerEnemy, the code works fine. If I use SetEnemy, it seems like everyone except guards hates me. Which is weird, because it's the exact same list of factions that I am running it on. In the above example I have tried SetEnemy(WerewolfFaction, False, False) and SetEnemy(WerewolfFaction, True, True), just to be make sure I wasn't crazy--no luck. It seems as though the guards remain allies unless I use SetPlayerEnemy() and truthfully I don't know what else remains an ally. With this code, the guards go on a killing spree in town because the peasents try to kill me. While funny, it is not my intended effect.
Anyone got any ideas?
