Jump to content

Adding item won't start script


needsaname

Recommended Posts

Part of my mod requires the player to pick up a skull and get a power from it, but for some reason it isn't working, Can anyone help? Here's the script:

 

MiscObject Property Skull  Auto  
Spell Property LesserSkull auto

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
 if (akBaseItem == Skull)
    	if (Game.GetPlayer().GetItemCount(Skull) == 1)
 	game.getplayer().addspell(LesserSkull)
endIf
endif
endevent

Edited by needsaname
Link to comment
Share on other sites

Where are you putting this script? This event is for the reference TAKING the object, so if you put it on the object it won't work.

 

For your purpose i think it's better to use a OnContainerChanged Event and put the the script on the skull itself.

Link to comment
Share on other sites

Ok, that worked! Thanks for the help!

Here's what I did with the script if any1 wants to know:

MiscObject Property Skull  Auto  
Spell Property LesserSkull auto

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
 if (akNewContainer == Game.GetPlayer())
    	if (Game.GetPlayer().GetItemCount(Skull) == 1)
 	game.getplayer().addspell(LesserSkull)
endIf
endif
endevent

Link to comment
Share on other sites

  • Recently Browsing   0 members

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