Kuugari Posted June 20, 2017 Share Posted June 20, 2017 Hi guys i am new to papyrus scripting and i am learning.. I am trying to make a simple mod to understand how script runs on background. I have read some post and some a just not clear enough.Things i want to accomplish is OnDeath any npc that died drop equipped helmet if there is one. I used this from somewhere in this forum: ScriptName DropHelmetOnDeath extends Actor {script to drop helmet from actor on death} Armor Function GetActorHelmet(Actor akActor) If(akActor != none) int headSlotMask = 0x00000001 Armor headSlotItem = akActor.GetWornForm(headSlotMask) as Armor If(headSlotItem != none && headSlotItem.IsHelmet()) return headSlotItem EndIf EndIf return none EndFunction Function DropActorHelmet(Actor akActor) int headSlotMask = 0x00000001 Form headSlotItem = akActor.GetWornForm(headSlotMask) If(headSlotItem != none && (headSlotItem as Armor).IsHelmet()) akActor.UnequipItem(headSlotItem) akActor.DropObject(headSlotItem) EndIf EndFunction i changed the extends to Quest and add use it on papyrus fragment in CreationKit but it only runs onInit event. Link to comment Share on other sites More sharing options...
foamyesque Posted June 22, 2017 Share Posted June 22, 2017 You're not understanding the relations between objects and scripts. OnDeath events go to Actor objects, or to aliases filled by Actors, which means that they won't work on anything that doesn't extend either Actor or ReferenceAlias. This also means that if you want to get those scripts to run, they need to be attached to the correct sort of form in the CK. In the case of a ReferenceAlias script, it would go on the aliases of a quest; in the case of an Actor script, it will go on either an ActorBase form, which will apply it to everything that uses that ActorBase (for example, guards or bandits), or to a specific Actor reference placed in the world. Link to comment Share on other sites More sharing options...
Recommended Posts