Jump to content

[LE] [Help] Kill actors/npc's on enter trigger


Rigmor

Recommended Posts

I tried to use this code:

Event OnTriggerEnter(ObjectReference akActionRef)
 If akActionRef == Game.GetPlayer()
  Game.GetPlayer().ModActorValue("health", 0)
 Else
   akActionRef.kill()
 EndIf
EndEvent

I get the error kill is not a function.

 

Is there a way so that npc's entering a trigger will be killed.

I want them to "drown" in water, npc's that I don't want killed I successfully transport them back to the boat.

Swimming actors I don't want alive, once they drift out behind the boat are killed.

Link to comment
Share on other sites

I'm pretty sure

 

Game.GetPlayer().ModActorValue("health", 0)

 

will modify the player's health 0 points. Meaning it will do nothing to their health.

 

I would change it slightly to

 

 

Event OnTriggerEnter(ObjectReference akActionRef)
 If akActionRef == Game.GetPlayer()
  Float PlayerHealth = (Game.GetPlayer()).GetAV("health")
  (Game.GetPlayer()).ModActorValue("health", -PlayerHealth)
 Else
   (akActionRef as Actor).kill()
 EndIf
EndEvent

 

 

Link to comment
Share on other sites

Hey candlepin, thank you so much, it's not the player I want to kill, but the people in the water, if it does nothing to the players health, all the better. so it should go with the else if, and kill anyone that enters the trigger, and it does.

If I dont kill the floaters, the other guys are wasting time trying to pin them with arrows from the deck and i need to release them from combat.

 

If my guys get blown into the water, they have a package checks they're swimming, and if they are it moves them back onto the ship. I am pretty proud of that one :P

Link to comment
Share on other sites

If you're just trying to kill everyone but the player you can simplify the script to:

 

Event OnTriggerEnter(ObjectReference akActionRef)

If akActionRef != Game.GetPlayer()

(akActionRef as Actor).kill()

EndIf

EndEvent

 

Nothing else required.

Link to comment
Share on other sites

If you're just trying to kill everyone but the player you can simplify the script to:

 

Event OnTriggerEnter(ObjectReference akActionRef)

If akActionRef != Game.GetPlayer()

(akActionRef as Actor).kill()

EndIf

EndEvent

 

Nothing else required.

Fantastic, kudos and a mention for you sir o/

compiled and in game.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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