Jump to content

How to spawn enemies by an Trigger


LordDenethor

Recommended Posts

Put a xmarker where you want NPCs to spawn. Put a trigger and attach this

 

Scriptname ArenaSpawnTrigger extends ObjectReference

ActorBase property NPCtoSpawn auto

ObjectReference property myMarker auto

Event OnTriggerEnter(ObjectReference akActionRef)
    if akActionRef == Game.GetPlayer()
         myMarker.PlaceActorAtMe(NPCToSpawn, x).StartCombat(Game.GetPlayer())
    endif
endEvent

 

Where the "x" near StartCombat you have to replace with a number between 0 and 3. 0 = easy, 1 = medium, 2 = hard, 3 = boss. If the actor you want to place isn't a leveled actor, just avoid putting the number.

 

This script will spawn the exact ActorBase everytime you enter the trigger. If you want more variety depending on how many times you enter, let me know.

Edited by gasti89
Link to comment
Share on other sites

Scriptname ArenaSpawnTrigger extends ObjectReference

ActorBase property NPCtoSpawn auto

ObjectReference property myMarker auto

Door property myDoor auto

Event OnTriggerEnter(ObjectReference akActionRef)
    if akActionRef == Game.GetPlayer()
         myMarker.PlaceActorAtMe(NPCToSpawn, x).StartCombat(Game.GetPlayer())
         myDoor.SetOpen()
    endif
endEvent

 

If you arena is repeatable, you may want another trigger that teleports you outside and closes the door?

 

EDIT: the script is put on the trigger. Select the trigger box, scripts, new script, name it ArenaSpawnTrigger. Then right click, edit source and paste this.

 

After that save and exit, then double click on the script and fill the properties.

Edited by gasti89
Link to comment
Share on other sites

this is my script :

 

Scriptname ArenaSpawnTrigger extends ObjectReference

 

ActorBase property encBear auto

 

ObjectReference property arenaspawn auto

 

Door property arenadoor auto

 

Event OnTriggerEnter(ObjectReference akActionRef)

if akActionRef == Game.GetPlayer()

arenaspawn.PlaceActorAtMe(encbear, 3).StartCombat(Game.GetPlayer())

arenadoor.SetOpen()

endif

endEvent

 

xmarker=arenaspawn

door= arenadoor

trigger=arenatrigger

wanted enemy= encbear

 

but nothing happens, when i putt the trigger-

 

When i saved the script it apears an error: compilation failed.

SetOpen is not a function or does not exist

No output generated for ArenaSpawnTrigger, compilation failed.

 

what does this mean?

Edited by LordDenethor
Link to comment
Share on other sites

xmarker=arenaspawn

door= arenadoor

trigger=arenatrigger

wanted enemy= encbear

 

This part has nothing to do with the script. If you're putting it in the script then it will fail to compile.

 

You have to 1st create a trigger box, then double click on it and attach this script in the scripts tab.

 

I suggest you to read this tutorial before working with scripts http://www.creationkit.com/Bethesda_Tutorial_Papyrus_Hello_World

Link to comment
Share on other sites

Scriptname ArenaSpawnTrigger ObjectReference  

ActorBase property encBear auto

ObjectReference property arenaspawn auto

Objectreference property arenadoor auto


Event OnTriggerEnter(ObjectReference akActionRef)
if akActionRef == Game.GetPlayer()
arenaspawn.PlaceActorAtMe(encbear, 1).StartCombat(Game.GetPlayer())
arenadoor.SetOpen()
endif
endEvent

 

It does compile, but I don't tested if it works correctly

Edited by Ghaunadaur
Link to comment
Share on other sites

The NorPullChain isn't a trigger.

 

It is an activator.

 

Scriptname ArenaSpawnTrigger ObjectReference  

ActorBase property encBear auto

ObjectReference property arenaspawn auto

Objectreference property arenadoor auto


Event OnActivate(ObjectReference akActionRef)
    if akActionRef == Game.GetPlayer()
        arenaspawn.PlaceActorAtMe(encbear, 3).StartCombat(Game.GetPlayer())
        arenadoor.SetOpen()
    endif
endEvent

 

This is for activators

Link to comment
Share on other sites

  • Recently Browsing   0 members

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