Removing Player From Unfriendly Faction

Post » Tue Jun 19, 2012 4:53 pm

Slight stumper here. As part of my alternate start mod, the player can begin the game as a vampire, or a bandit (and soon to be a Forsworn too) which works fine.

Currently I have deployed a trigger script that will remove the player from the faction upon leaving friendly territory, and puts them back upon returning. That appears to work too.

What I'm stumped on though is how to get the player removed from one of these factions should they choose to go ballistic and start killing members of it before they've left the area. Right now, someone can abuse this with impunity and kill each NPC/Creature one by one until they're all dead and none of the others will do anything about it. I think it's because BanditFaction and VampireFaction are evil and attacking evils has no mechanism for dealing with the player being a member.

All I need to be able to do is check generically for attacks on one of these factions while also within certain cells, then boot the player, and set a variable elsewhere to prevent my trigger boxes from adding you back in if you went hostile.
User avatar
Mandi Norton
 
Posts: 3451
Joined: Tue Jan 30, 2007 2:43 pm

Post » Tue Jun 19, 2012 5:24 pm

Eh, well, this is seriously crude, not 100% effective, but it's better than having zero response at all. Perhaps it will be of help to others. This somewhat specific to the mod it's going into but should be adaptable enough to make it generic.
Scriptname ARTHLALTriggerScript extends ObjectReference  {Takes the player out of a normally hostile faction upon leaving the area. Puts them back if they return.}ARTLALStartQuest Property NewStartQuest AutoPlayerVampireQuestScript Property VampireQuest AutoFaction Property FriendlyFaction AutoInt Property MenuChoice AutoInt Property BanditCamp AutoActor Property CombatTarget AutoEvent OnUpdate()    CombatTarget = Game.GetPlayer().GetCombatTarget()        if( CombatTarget && CombatTarget.IsInFaction(FriendlyFaction) )        debug.trace( "Hostile Intent!!!" )        NewStartQuest.HostileIntent = true ; Oh boy, here we go!        Game.GetPlayer().RemoveFromFaction(FriendlyFaction)        if( VampireQuest.VampireStatus == 4 )            Game.GetPlayer().SetAttackActorOnSight(true)        endif    EndIf        if( NewStartQuest.HostileIntent == true )        UnregisterForUpdate()        Self.Disable()    EndIfEndEventEvent OnTriggerLeave ( ObjectReference ActorRef )    if( ActorRef == Game.GetPlayer() )        if( NewStartQuest.MainMenuChoice == MenuChoice && NewStartQuest.HostileIntent == false )            Game.GetPlayer().RemoveFromFaction(FriendlyFaction)            if( VampireQuest.VampireStatus == 4 )                Game.GetPlayer().SetAttackActorOnSight(true)            endif        EndIf                UnregisterForUpdate()    endifEndEventEvent OnTriggerEnter ( ObjectReference ActorRef )    if( ActorRef == Game.GetPlayer() )        if( NewStartQuest.HostileIntent == false )            if( NewStartQuest.MainMenuChoice == MenuChoice && (BanditCamp == -1 || BanditCamp == NewStartQuest.BanditRandom) )                Game.GetPlayer().AddToFaction(FriendlyFaction)                if( MenuChoice == 10 ) ;Vampire                    if( VampireQuest.VampireStatus == 4 )                        Game.GetPlayer().SetAttackActorOnSight(false)                    endif                endif                RegisterForUpdate(0.5)            Else                Self.Disable()            EndIf        EndIf    EndIfEndEvent
User avatar
Russell Davies
 
Posts: 3429
Joined: Wed Nov 07, 2007 5:01 am


Return to V - Skyrim