Jump to content

CK Help with NPC spawn script


JPdreamer

Recommended Posts

Hi everyone

Trying to get a script to work that will spawn some bandits at a set of spawn xMarkers every time the player walks through a trigger box when its enabled using a parent xMarker. 

This is what I have so far, but haven't been able to work out what I need to actually get the spawn to work. Tested trigger box actually triggers with debug messages so thats good to go but no luck with NPC spawns, hoping to make it absolute as well so NPCs will spawn everytime player walks in trigger box

Scriptname NL_BMT_EnemySpawn extends ObjectReference
 
;Player
Actor Property PlayerREF Auto
 
;Bandit Raid
Actor property NL_Bandit auto
ActorBase NL_BanditBase
 
ObjectReference Property BMT_FalkreathMarker auto
 
ObjectReference Property BMT_SpawnMarker auto
 
Event OnTriggerEnter(ObjectReference akActionRef)
    if (akActionRef == PlayerREF && BMT_FalkreathMarker.IsEnabled())
  
    NL_BanditBase = NL_Bandit.GetBaseObject() as ActorBase
    BMT_SpawnMarker.PlaceActorAtMe(MyActorBase
 
            debug.messagebox("spawn")
    endif
endEvent
Link to comment
Share on other sites

I made a mod Haunted graveyard that is somewhat similar. The source code for the scripts and a readme saying how I set it up is included. I only posted the LE version but the scripts would work the same in SE. Essentially when you entered a graveyard at night the ghost appears. I did it by having a holding cell for the ghost and moving it to a marker when the trigger was entered. If killed I moved it back to the holding cell and resurrected it.  I used RegisterForUpdateGameTime and Event OnUpdateGameTime to time when it could be spawned again. For a larger time frame I might use RegisterForSingleUpdateGAmeTime instead. There are only 3 scripts. You might look at them to see if a modification of one of them might work for you. I would spawn the bandits behind a rock or bushes so you couldn't see them appear.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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