Jump to content

Trigger box that kills every actor with a specific keyword.


morrowind1979

Recommended Posts

So like the title says I am trying to make a trigger box with a script that kills every actor who enters it with the custom Keyword "KeybladeActor". The script will just not work this is teh best I can do:

Scriptname DWKBWarriorKillScript extends ObjectReference  

Keyword Property KBW  Auto

Event OnTriggerEnter(ObjectReference akTriggerRef)
	If(akTriggerRef.HasKeyword(KBW))
	akTriggerRef.kill()
	EndIf
EndEvent

But the CK returns the error:

Starting 1 compile threads for 1 files...
Compiling "DWKBWarriorKillScript"...
C:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\DWKBWarriorKillScript.psc(7,14): kill is not a function or does not exist
No output generated for DWKBWarriorKillScript, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on DWKBWarriorKillScript

Does anyone know how I can make this work?

 

p.s adding an actor property instead is not an option as I have multiple actors in the same cell

Link to comment
Share on other sites

Got it working with:

Scriptname DWKBWarriorKillScript extends ObjectReference  

Keyword Property KBW  Auto

ObjectReference Property fr  Auto  

Sound Property XDie  Auto 

EVENT onTriggerEnter(ObjectReference triggerRef)
	Actor triggerActor = triggerRef as Actor
	if (triggerActor.HasKeyword(KBW))
		fr.enable()
		XDie.Play(Game.GetPlayer())
		; kill Keyblade Warrior
		triggerActor.Kill()
		utility.wait(1.0)
		fr.disable()
	endif
endEVENT
Link to comment
Share on other sites

I think the only problem with your original script was that you were trying to kill an ObjectReference.

 

This should also work (and is simpler):

 

 

 

Scriptname DWKBWarriorKillScript extends ObjectReference 

Keyword Property KBW Auto

Event OnTriggerEnter(ObjectReference akTriggerRef)
    If (akTriggerRef.HasKeyword(KBW))
         (akTriggerRef as Actor).kill()
    EndIf
EndEvent

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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