Jump to content

CK How do I make a timed trigger so that my NPC spawn only when the player trigger a specific action


Andrewupkins

Recommended Posts

So Yeah I am in concord and added 3 minutemen defending the museum and a few more raiders to match them but in game by the time I go near them they are all dead because they are directly spawn I wanted to know how to make a time trigger don't even know how to create the "M" spawn placeholder only see people using the vanilla one so if I could set a trigger so they only spawn when the player is in front of the museum so he can help them or see them dying

Link to comment
Share on other sites

I'd go with a marker solution

 

Step 1 - Make them all "Initialy Disabled" by double clicking on their world references

Additionally check Enable Parent on all but one. Link all to one parent.

 

This means you will only need to script enable one NPC and the others will automatically appear

 

Step 2 - Place an Xmarker near them

Step 3 - Use a script on it

I'd go with

ObjectReference Property TheGuyIwanttoEnable Auto

Event OnCellLoad()

TheGuyIwanttoEnable.enable()

EndEvent

Otherwise you can also use a Trigger with a script like

Event OnTriggerEnter (ObjectReference AkActionRef)
If AkActionRef == Game.Getplayer()

TheGuyIwanttoEnable.enable()

Endif
EndEvent

Event OnTriggerLeave (ObjectReference AkActionRef)
If AkActionRef == Game.Getplayer()

TheGuyIwanttoEnable.disable()

Endif
EndEvent

For the latter option you need to place an defaultemptytrigger (Activator) and make it enough

Link to comment
Share on other sites

Or you can set these NPCs "Protected" in the Creation Kit and then simply place them in Concord. (If they're flagged as protected, only the player could kill them). Then place a DefaultEmptyTrigger and attach this script to it:

Actor Property PlayerRef Auto Const

Group MinutemenRefs
ObjectReference Property Minuteman01 Auto Const
ObjectReference Property Minuteman02 Auto Const
ObjectReference Property Minuteman03 Auto Const
endGroup

Event OnTriggerEnter (ObjectReference akActionRef)

   If akActionRef == PlayerRef

        Minuteman01.SetProtected(false)
        Minuteman02.SetProtected(false)
        Minuteman03.SetProtected(false)

        Self.Disable()

   EndIf

EndEvent

After you enter this triggerbox, the NPCs won't be protected and the trigger will disable itself.

Link to comment
Share on other sites

I'd go with a marker solution

 

Step 1 - Make them all "Initialy Disabled" by double clicking on their world references

Additionally check Enable Parent on all but one. Link all to one parent.

 

This means you will only need to script enable one NPC and the others will automatically appear

 

Step 2 - Place an Xmarker near them

Step 3 - Use a script on it

I'd go with

ObjectReference Property TheGuyIwanttoEnable Auto

Event OnCellLoad()

TheGuyIwanttoEnable.enable()

EndEvent

Otherwise you can also use a Trigger with a script like

Event OnTriggerEnter (ObjectReference AkActionRef)
If AkActionRef == Game.Getplayer()

TheGuyIwanttoEnable.enable()

Endif
EndEvent

Event OnTriggerLeave (ObjectReference AkActionRef)
If AkActionRef == Game.Getplayer()

TheGuyIwanttoEnable.disable()

Endif
EndEvent

For the latter option you need to place an defaultemptytrigger (Activator) and make it enough

 

 

Or you can set these NPCs "Protected" in the Creation Kit and then simply place them in Concord. (If they're flagged as protected, only the player could kill them). Then place a DefaultEmptyTrigger and attach this script to it:

Actor Property PlayerRef Auto Const

Group MinutemenRefs
ObjectReference Property Minuteman01 Auto Const
ObjectReference Property Minuteman02 Auto Const
ObjectReference Property Minuteman03 Auto Const
endGroup

Event OnTriggerEnter (ObjectReference akActionRef)

   If akActionRef == PlayerRef

        Minuteman01.SetProtected(false)
        Minuteman02.SetProtected(false)
        Minuteman03.SetProtected(false)

        Self.Disable()

   EndIf

EndEvent

After you enter this triggerbox, the NPCs won't be protected and the trigger will disable itself.

Thanks you both for the detailled reply, so I tried to set them as protected and then place the default entry trigger added to it the new script of LarannKiar only replacing the Minuteman01 by the ID I gave to my 3 minuteman. Then I scaled the trigger box to all the concord street englobing the minutemen as well as the player position. But when I go in game they don't change to unprotected because the 3 of them fall on the ground then get back up and that previous time they were all dead. So it's not enough for the minutemen to be in the trigger box with the script added ? Do I have to link them via reference ? And for Zorkaz solution if I have understood the idea is to disable all including vanilla raiders so that they are passive until the player come near them ? Because if I don't disable all of them the raider will kill the passive minuteman ?

Edited by Andrewupkins
Link to comment
Share on other sites

The NPCs don't have to be in the triggerbox. It doesn't really matter as the OnTriggerEnter event fires only if the player enters the triggerbox (akActionRef == PlayerRef).

 

If the triggerbox is too large, raiders can easily kill the three Minutemen by the time you arrive at the Museum of Freedom in Concord..

 

Both solutions (1. start initially disabled then enable them. 2. protected to unprotected) are good, just make sure to place high leveled Minutemen (level 50+ if the raiders are Raider Veterans or Raider Survivalists).

 

You can also create a "friend faction" for the raiders and the minutemen. When you enter the triggerbox, the NPCs would turn hostile to each other.

Link to comment
Share on other sites

The NPCs don't have to be in the triggerbox. It doesn't really matter as the OnTriggerEnter event fires only if the player enters the triggerbox (akActionRef == PlayerRef).

 

If the triggerbox is too large, raiders can easily kill the three Minutemen by the time you arrive at the Museum of Freedom in Concord..

 

Both solutions (1. start initially disabled then enable them. 2. protected to unprotected) are good, just make sure to place high leveled Minutemen (level 50+ if the raiders are Raider Veterans or Raider Survivalists).

 

You can also create a "friend faction" for the raiders and the minutemen. When you enter the triggerbox, the NPCs would turn hostile to each other.

Ok, in fact I didn't saved the script that's why, but now that I have I get a fail, I had copy this in the script of the trigger box :

 

Actor Property PlayerRef Auto Const

Group MinutemenRefs
ObjectReference Property RaiC&M_pvt_Arthur_Onegoodeye Auto Const
ObjectReference Property RaiC&M_Minuteman_ConcordFront_01 Auto Const
ObjectReference Property RaiC&M_Minutemen_ConcordFront_03 Auto Const
endGroup
Event OnTriggerEnter (ObjectReference akActionRef)
If akActionRef == PlayerRef
RaiC&M_pvt_Arthur_Onegoodeye.SetProtected(false)
RaiC&M_Minuteman_ConcordFront_01.SetProtected(false)
RaiC&M_Minutemen_ConcordFront_03.SetProtected(false)
Self.Disable()
EndIf
EndEvent
Link to comment
Share on other sites

 

Ok, in fact I didn't saved the script that's why, but now that I have I get a fail, I had copy this in the script of the trigger box :

 

Actor Property PlayerRef Auto Const

Group MinutemenRefs
ObjectReference Property RaiC&M_pvt_Arthur_Onegoodeye Auto Const
ObjectReference Property RaiC&M_Minuteman_ConcordFront_01 Auto Const
ObjectReference Property RaiC&M_Minutemen_ConcordFront_03 Auto Const
endGroup
Event OnTriggerEnter (ObjectReference akActionRef)
If akActionRef == PlayerRef
RaiC&M_pvt_Arthur_Onegoodeye.SetProtected(false)
RaiC&M_Minuteman_ConcordFront_01.SetProtected(false)
RaiC&M_Minutemen_ConcordFront_03.SetProtected(false)
Self.Disable()
EndIf
EndEvent

 

 

You shouldn't use "&" in a script. Also, leave the Scriptname untouched.

Edited by LarannKiar
Link to comment
Share on other sites

 

 

Ok, in fact I didn't saved the script that's why, but now that I have I get a fail, I had copy this in the script of the trigger box :

 

Actor Property PlayerRef Auto Const

Group MinutemenRefs
ObjectReference Property RaiC&M_pvt_Arthur_Onegoodeye Auto Const
ObjectReference Property RaiC&M_Minuteman_ConcordFront_01 Auto Const
ObjectReference Property RaiC&M_Minutemen_ConcordFront_03 Auto Const
endGroup
Event OnTriggerEnter (ObjectReference akActionRef)
If akActionRef == PlayerRef
RaiC&M_pvt_Arthur_Onegoodeye.SetProtected(false)
RaiC&M_Minuteman_ConcordFront_01.SetProtected(false)
RaiC&M_Minutemen_ConcordFront_03.SetProtected(false)
Self.Disable()
EndIf
EndEvent

 

 

You shouldn't use "&" in a script. Also, leave the Scriptname untouched.

 

Ok I didn't get it because this all script thing is kind of overwhelming to me, so I don't have to change the text script that you gave me, so first question on which aspect of the NPC the "minuteman01, 02" etc are based ? Is it the Editor ID, the faction or other, because my 3 minuteman NPC are modified copied NPC not vanilla one so if I undrestand correclt copying your text script without modifying anything should work with them ? I just try to understand how this work so I can apply this to others

Link to comment
Share on other sites

"Minuteman01" is the Editor ID. They are object references and script properties. You have fill these properties with their Ref ID. If you typed their Editor IDs in the script, you can fill them using "Auto Fill". After filling these properties, the script should work.

Link to comment
Share on other sites

"Minuteman01" is the Editor ID. They are object references and script properties. You have fill these properties with their Ref ID. If you typed their Editor IDs in the script, you can fill them using "Auto Fill". After filling these properties, the script should work.

I don't understand how do I "auto fill" in the script ? do I need to type "autofill" in the script if so those script seem kind of technical were can I be iniated to basic script command so I know what I am doing were I writing stuff

Link to comment
Share on other sites

  • Recently Browsing   0 members

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