I am adding Dungeon Treasure Hunters to my encounter mod Sands of Time and need the npc to find dead bodies in the dungeons and loot them. I have a simple initial script that is attached to the npc and indeed finds a nearby dead actor. But the npc then ignores the idle command. I wanted to use the idle markers but they need to be placed beforehand which s impractical . I thought about a ai package but dd not see any way to use the search dead body idle. The properties are filed in, I have been scripting for over a year but not with idles. Any help appreciated.
Tonycubed2
Script:
Scriptname Treasure extends Actor
Idle Property IdleSearchBody Auto
Idle Property IdleSearchingChest Auto
Event OnInit()
RegisterForSingleUpdate(10)
if DebugSOT.GetvalueInt() == 5 && DebugWalking.GetValueInt() == 5
Debug.Notification("Treasure Hunters Script Initialized!")
endif
GoToState("Normal")
EndEvent
event OnUpdate()
RegisterForSingleUpdate(10)
GoToState("Normal")
EndEvent
State busy
event OnUpdate()
if DebugSOT.GetvalueInt() == 5 && DebugWalking.GetValueInt() == 5
Debug.Notification("Treasure Hunters Script Firing In Busy State!")
endif
EndEvent
EndState
State Normal
event OnUpdate()
GoToState("busy")
if DebugSOT.GetvalueInt() == 5 && DebugWalking.GetValueInt() == 5
Debug.Notification("Treasure Hunters Script Firing!")
endif
Actor closest = Game.FindClosestActorFromRef(self, 500.0)
if closest.isdead()
Debug.Notification("Dead Body Found")
self.PlayIdleWithTarget(IdleSearchBody, closest)
EndIf
RegisterForSingleUpdate(10)
GoToState("Normal")
EndEvent
EndState
GlobalVariable Property DebugSOT Auto
GlobalVariable Property DebugWalking Auto