Jump to content

[LE] Ambush NPC coming out of ambush incorrectly.


cumbrianlad

Recommended Posts

Hi.

 

I've got an ambush armoured skeleton boss, who is meant to come out of a coffin ambush on trigger only. The trigger box is inside a guard house which can't be entered until some pole gates are lowered. I've ticked the 'Parent activate only' box on the activate parents tab of the NPC.

 

It all works correctly if the player is the only one in the vicinity. The player can even jump up and down on the coffin lid and it remains in hiding. My problem is that the player can solve a puzzle earlier in the level and spawn allies around the area, including the part with my ambush actor in his coffin. The allies patrol around the area and are meant to aid the player after the ambush is triggered. However, whenever the player reaches this part, with allies enabled, they've somehow triggered the ambush and killed him. They can't get to the trigger box and I know they haven't triggered it, because if they had, another 2 enemies would spawn. These enemies haven't spawned, but do when the player enters the trigger.

 

I found that by setting the allies agression from 'aggressive' to 'unagressive' this cured the problem. In this instance it works okay, although its not exactly what I want.

 

Clearly, the aggressive actors are detecting the ambush actor in the coffin and somehow triggering it to come out of ambush.

 

Any ideas of how to stop this whilst still having 'aggressive' allies?

Link to comment
Share on other sites

If you are using the "defaultActivateSelf" vanilla script on the trigger box, then in its property check the "PlayerOnly" option (no one else but Player can trigger the ambush) or "PlayerAndAlliesOnly" if you need followers and allies to be able to trigger the ambush (i guess you don't, so don't check this).


If you are using a custom made script to trigger the ambush, then add to your script a "PlayerOnly" condition.


Also on the "MasterAmbushScript" check in its property the "AmbushOnTrigger" = TRUE option.


You can also add a "Fail Safe" to the trigger box, have the trigger box "initially disable" and enable it only when your puzzle is solve, you can use a "defaultEnableOnActivate" script (i think that's how the script is called, not sure and i'm not near my PC to check it).

Edited by maxarturo
Link to comment
Share on other sites

Thanks for the reply. I am using the default trigger box. "Ambush on trigger" was set to "true". As I said in my post the trigger box is inside an area that the allies can't get to, Just in case, I tried your suggestion of setting the script property to "Player Only", reverted my allies back to aggressive and tested...

 

... they'd killed him before I got there, again.

 

I then made an xmarker the enable parent of the ambush actor set it to "initially disabled" and added a "DefaultEnableDisableLinkedRef" trigger, set to "Player Only". I put this in the ambush room. When my character entered this trigger and enabled the ambush NPC, the allies immediately headed for the coffin and the ambush actor emerged from it. Fight breaks out. Same result: dead enemy! It looks to me like the aggressive allies are detecting the presence of the unaggressive ambush actor and initiating combat with it, which is what is dragging it out of ambush.

 

It's getting really late now and I'm too tired. I'll look at it again tomorrow.

 

Thanks again for the suggestions.

Link to comment
Share on other sites

"the allies immediately headed for the coffin and the ambush actor emerged from it"
Aggressive allies triggering the ambush (Sleep) even if all triggers are set to "PlayerOnly" and the ambush is set up correctly....
This is not supposed to happen since the actor/npc is in "ambush sleep mode" and it's set to "PlayerOnly", but.. Skyrim is full of bugs and i have never set up such a scene to test and see if there is such a bug.
Two quick workarounds that will require custom scripting:
1) Same as the first suggestion, but this time have the Actor & Sleep Furniture "Initially Disabled" and on trigger enter > enable the Actor & Sleep Furniture > give it a few milliseconds like 0.2 or 0.5 to ensure that no CTD will occur after enabling the actor & furniture > then Activate the ambush.
Alternative
2) Have the Sleep Actor somewhere far from the Sleeping Coffin and On Trigger Enter > MoveTo() the actor to the Coffin > again give it a few milliseconds for the same reasons > then Activate the ambush.
And of course all of the above with a "Player Only" condition.
Simple Script Example for 1st workaround:
* This needs to be inserted on the Trigger Box, no need for other script. Link REF the Actor & Ambush Furniture from the Script's Properties.
* This will only get triggered by the Player.



ObjectReference Property AmbushFurniture Auto
{Link REF the Ambush Furniture to Enable and to trigger the Ambush}
 
Actor Property SleepActor Auto
{Link REF the initially Disable Sleeping Actor on the Ambush}
 
Bool Property DoOnce = False Auto
{Set it to TRUE if you want this to Fire only ONCE then delete itself, else if FALSE it will fire every time you enter it}
 
float property WaitBeforeTrigger = 0.5 auto
{Time to wait before this gets Triggered, Default = 0.5 seconds}
 
 
Auto State WaitingPlayer
Event OnTriggerEnter(ObjectReference akActionRef)
      if (akActionRef == Game.GetPlayer())
          AmbushFurniture.Enable()
          SleepActor.Enable()
          Utility.Wait(WaitBeforeTrigger)
          AmbushFurniture.Activate(Self)
            
          If (DoOnce == True)
              GoToState("AllDone")
        Else
              GoToState{"WaitingPlayer")
       EndIf
   EndIf
EndEvent
EndState
 
 
State AllDone
EVENT onTriggerLeave(objectReference akActionRef)
      if (akActionRef == Game.GetPlayer())
          Self.Disable()
          Utility.Wait(0.2)
          Self.Delete()
   EndIf
EndEvent
EndState

 

Edit: Added a simple script example in case you are not familiar with scripting.

 

Merry Christmas and a Happy New Modding Year !.

Edited by maxarturo
Link to comment
Share on other sites

maxarturo,

 

Thanks ever so much for that. The ambush is set up correctly, since it works perfectly without the pesky 'allies' (:

 

What I may do is sort of the reverse. I'll move the editor locations of the allies and their patrol routes so that they don't enter the coffin chamber until after the player has triggered the ambush enemies. At simplest, I merely move them to a more remote part of the cell (It's pretty big), but close enough to come to the aid of the player when they trigger the ambush. Slightly more complex, I add a trigger with a script to add and evaluate travel packages to make them come running!

 

I am pretty rubbish at scripting, so if this doesn't work, I'll happily take your offered script and give that a go. I think I can manage the package script.

 

Thanks again.

Link to comment
Share on other sites

 

Happy to help.
If you need any help setting up the script given or further expanding it, don't hesitate to ask for it !.

 

no, that's fine for now... I've got a few tests to do!

 

The good thing about the forum is bouncing ideas around. You've given me ideas and that triggered off new ones of my own. Sometimes you get so frustrated by CK and Skyrim, you lose focus. Thanks again.

 

P.S. sorted. I moved the allies back behind a locked door, and made them unable to open doors in their race (They're a separate race). The door is quite close to the chamber and it works fine. It might also have been good to make a separate faction for the levelled ambush characters and made that so that their faction would not be enemies of the allies, but allies of their non-ambush equivalents. I didn't test that, but there is no need now.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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