Jump to content

[LE] How to stop followers attacking enemies for a time?


Recommended Posts

Hi.

 

I have a situation where I want several enemies to watch, gladiator style while the player and any followers defeat a pair of trolls in a Nord pit below them. Once the trolls are dead, the boss orders port gates around the stairs out of the pit to be opened and some of the watching enemies charge down and attack. After this, the boss and his two senior gang members attack in the final battle.

 

To do this, I've already set up the trolls, junior gang members and bosses with combat override hold position packages, which works a treat. I can have them ditch these packages at appropriate stages. I can also disable player controls at the times in a scene when the boss is giving his speeches.

 

My problem is that any pets and followers will attack the enemies, including doing the miraculous fast travelling through the port gates to get at them.

 

Here's what I'm hoping to do to stop the loyal (but annoying) follower behaviour.

 

  1. I have three factions set up for my enemies, a troll faction, gang faction and boss faction.
  2. I hoped to run a script on container change event (when the player gets the key to access the pit area). The script has to add the factions to the player and set the factions to friends.
  3. When the lever is activated to release the trolls I could use an on activate event and remove the troll faction from the player and set the troll faction back to being an enemy.
  4. I use the same procedure to make the junior gang members and the bosses enemies again at the appropriate point.

So my script would be something like this:

 

Actor Property PlayerRef Auto

Faction Property KetilTrollFaction Auto

Faction Property KetilGangFaction Auto

Faction Property KetilBossFaction Auto

Faction Property PlayerFaction Auto

 

Event OnActivate(ObjectReference akActionRef)

;

PlayerRef.AddToFaction(KetilTrollFaction)

PlayerRef.AddToFaction(KetilGangFaction)

PlayerRef.AddToFaction(KetilBossFaction)

;

PlayerFaction.SetReaction(KetilTrollFaction, 3)

PlayerFaction.SetReaction(KetilGangFaction, 3)

PlayerFaction.SetReaction(KetilBossFaction, 3)

;

EndEvent

 

Will this work, or would I have to do the same thing for any followers and pets present? I was hoping that making the enemies temporarily friendly to the player would stop the followers attacking them. If not then I need some other way of doing it,

 

I tried a similar script with lines like KetilTrollFaction.SetPlayerEnemy(False) inside the event but it didn't seem to work. Maybe because the enemy aliases have already been filled and the updated information doesn't get through.

Link to comment
Share on other sites

I've not tried it myself, but read a lot about factions. I would make a new faction and put all the hostile npcs inside. Do this via script and also remove them from their normal factions. If scene is finished, add them again to their normal factions and remove them from the friend faction that you've created. I would try it this way, but I'm in no way an expert with this.

 

Greeting, Tasheni

Link to comment
Share on other sites

Have a look to the following scripts: FollowerAliasScript.psc, DialogueFollowerScript.psc

    GlobalVariable PROPERTY pPlayerFollowerCount auto
    GlobalVariable PROPERTY pPlayerAnimalCount   auto

    ReferenceAlias PROPERTY pFollowerAlias auto        ; huscarl
    ReferenceAlias PROPERTY pAnimalAlias   auto        ; pet

You could use the next code in your script. No idea what is about UFO mod.

 

  Quest PROPERTY DialogueFollower auto        ; fill with the vanilla Skyrim quest

  Bool bNoTeam_Follower
  Bool bNoTeam_Animal

;-------------------------------
FUNCTION myF_TeamMate(Bool bSet)
;-------------------------------
    DialogueFollowerScript ps = DialogueFollower as DialogueFollowerScript
    actor aRef

IF ( ps )
ELSE
    RETURN    ; - STOP -    script is <None>
ENDIF
;---------------------
IF ( bSet )                                            ; bSet == TRUE
    aRef = ps.pFollowerAlias.GetActorReference()
    IF ( aRef )
        aRef.SetPlayerTeammate(False)
        bNoTeam_Follower = TRUE
    ENDIF

    aRef = ps.pAnimalAlias.GetActorReference()
    IF ( aRef )
        aRef.SetPlayerTeammate(False)
        bNoTeam_Animal = TRUE
    ENDIF
ELSE                                                ; bSet == False
    aRef = ps.pFollowerAlias.GetActorReference()
    IF (aRef) && (bNoTeam_Follower)
        aRef.SetPlayerTeammate(TRUE)
        bNoTeam_Follower = False
    ENDIF

    aRef = ps.pAnimalAlias.GetActorReference()
    IF (aRef) && (bNoTeam_Animal)
        aRef.SetPlayerTeammate(TRUE)
        bNoTeam_Animal = False
    ENDIF
ENDIF
ENDFUNCTION

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...