How to get an npc to perform the search dead body

Post » Fri Jun 21, 2013 2:50 am

Greetings,

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
User avatar
sunny lovett
 
Posts: 3388
Joined: Thu Dec 07, 2006 4:59 am

Return to V - Skyrim