Jump to content

Need to check distance to player and disable and delete npc ic over 15


tonycubed2

Recommended Posts

The npc is a highwayman placed on skyrim wiht a encounter script that uses placeatme .

 

I have three scritps now on the poor npc trying to determine the accurate distance to the player to see if he can self disable and self delete. But it is not working. The values returned are crazy huge even when the player is a nose away.

 

Worked fine when I had the npc placed on the gates of riverwood for testing, does not if the npc is spawned while playing the game.

 

Here are the scripts:

 




Actor dude3
Float howfar 



Event OnPackageStart(Package akNewPackage)
RegisterForSingleUpdate(60)
Debug.MessageBox("Registered")
EndEvent



Event OnUpdate()
;dude3 = HighWayManConjurer.GetActorReference()
;howfar = Game.GetPlayer().GetDistance(Self)
if (self.GetActorReference().getDistance(game.getplayer()) > 13000)
HighwayKBoss.SetValueInt(5)
Debug.MessageBox("Conjurer to be Deleted"+howfar)
Else
;Debug.MessageBox("adding another 5 seconds")
RegisterForSingleUpdate(15)
EndIf
EndEvent



ReferenceAlias Property HighwayManConjurer  Auto  

GlobalVariable Property Highway  Auto  

 

 

 

Scriptname highwayifidie2 extends ObjectReference  

ReferenceAlias Property HighwayManConjurer  Auto  
Actor dude


Event OnDeath(Actor akKiller)
RegisterForSingleUpdate(120)
endEvent

Event OnUpdate()
Self.Disable()
Self.Delete()
EndEvent

 

 

 

 

Scriptname HighwayKillBigBoss extends ObjectReference  



GlobalVariable Property HighwayKBoss  Auto  



Event OnPackageStart(Package akNewPackage)
RegisterForSingleUpdate(5)
EndEvent


Event OnUpdate()
If HighwayKBoss.getvalueint() == 5
HighwaykBoss.setvalueint(0)
self.disable()
self.delete()
Debug.MessageBox("Conjurer  Deleted!")
else
RegisterForSingleUpdate(5)
EndIf
EndEvent

Link to comment
Share on other sites

  • Recently Browsing   0 members

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