Jump to content

Teleport Deathclaws to Marker if They Enter Trigger


ProjectEW

Recommended Posts

So...yeah, I'm having some trouble doing exactly what the title says. I currently have a trigger that encompasses the area I don't want them to be, with a script attached to it. This is the script (I use maybe one or two NVSE functions):

scn xyzAntiDeathclawTriggerSCRIPT

int markerX
int MarkerY
int MarkerZ
ref ActionRef

BEGIN OnTriggerEnter

Set MarkerX to xyzAntiDeathclawMarker.GetPos X
Set MarkerY to xyzAntiDeathclawMarker.GetPos Y
Set MarkerZ to xyzAntiDeathclawMarker.GetPos Z
Set ActionRef to GetActionRef

if ActionRef.GetBaseObject == (QJDeathclawAlphaMale || QJDeathclawAmbusher || QJDeathclawBaby || QJDeathclawDead || QJDeathclawEater || QJDeathclawHawkins || QJDeathclawMother || QJDeathclawWanderer01 || QJDeathclawWanderer02 || QJDeathclawWanderer03 QJDeathclawWanderer04 || QJDeathclawWanderer05)
	ActionRef.SetPos X MarkerX
	ActionRef.SetPos Y MarkerY
	ActionRef.SetPos Z MarkerZ
endif

END

This does absolutely nothing. I am in Quarry Junction, so these should be the right Deathclaws to filter out, right? The area is a little mobile home, where I have one human NPC, and I will have to enter the place as well. Also, xyzAntiDeathclawMarker does exist, in fact, it's in the same cell only about 10 feet away. Can someone here please shed some light as to why this doesn't work? Thanks.

Edited by ProjectEW
Link to comment
Share on other sites

Sometimes certain functions won't work if inside an IF statement. I like to separate out and not try to use compound function statements - for the base object, set a ref variable, like what David said, then test it. Also, you can use a form list to simplify.

 

 

scn xyzAntiDeathclawTriggerSCRIPT 

int markerX 
int MarkerY 
int MarkerZ 
ref ActionRef 
ref rBaseObject
short iIndex

;These are in DeathClawFormList: (QJDeathclawAlphaMale || QJDeathclawAmbusher || QJDeathclawBaby || QJDeathclawDead || QJDeathclawEater || QJDeathclawHawkins || QJDeathclawMother || QJDeathclawWanderer01 || QJDeathclawWanderer02 || QJDeathclawWanderer03 QJDeathclawWanderer04 || QJDeathclawWanderer05) 

BEGIN OnTriggerEnter 

Set MarkerX to xyzAntiDeathclawMarker.GetPos X 
Set MarkerY to xyzAntiDeathclawMarker.GetPos Y 
Set MarkerZ to xyzAntiDeathclawMarker.GetPos Z 
Set ActionRef to GetActionRef 

set rBaseObject to ActionRef.GetBaseObject

set iIndex to ListGetFormIndex DeathClawFormList rBaseObject

if iIndex > -1 ;its in the list
ActionRef.SetPos X MarkerX 
ActionRef.SetPos Y MarkerY 
ActionRef.SetPos Z MarkerZ 
endif 

END

 

 

 

 

Link to comment
Share on other sites

Thank you davidlallen! Using the GetFaction function worked! And using a variable shortened it enough to fit in a single line. I feel dumb for not thinking to use a variable for that...

Thanks for the suggestion rickerhk, but I forgot to refresh the page, and I didn't see your post.

Edited by ProjectEW
Link to comment
Share on other sites

  • Recently Browsing   0 members

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