I have two questions
1) Why is my current code not running (it is compiling, and I can confirm the event is firing)
Here is my broken code
Scriptname MySummonScript extends activemagiceffectEvent onEffectStart(Actor akTarget, Actor akCaster) Game.getPlayer().additem((Game.GetForm(0x0002f2f4) As ObjectReference).GetBaseObject(), 1)endEvent
Actual runnable code that will add an item in a similar fashion (via a magicEffect) would be greatly appreciated.
I realize there are things that need to be changed (Game.getPlayer() to aKTarget for ex) but i'm just using this as a simple test.
Other info:
For the MagicEffect magicEffectArchetype i'm using script
With debug.messageBox from within effectStart I can confirm the method is called.
I understand (and have implemented) a bound weapon duplicate would fix this for this particular item (woodcutter's axe) without the need for a script but i wanted a general solution that could work with a formlist later.
2) How do I know which item id i want to pass to Game.getForm, and how do I pass it appropriately?
I've noticed the hex codes that appear in the creation kit are the same as are used in the console to add an item/spell/etc
if I were to create a custom item and then have it be added via this script how would i reference it appropriately.
What I'm worried about is if I hardcode the item id or even create a property within the script and hardcode the hex code (as an int) within the edit properties dialog that it would run fine on my computer, but if I ever published this mod or even tried to run it on another computer later that same hexcode may have been used by some other mod and I would add an incorrect item, CTD, or just fail. How do I essentially say MyEsp.getForm( uniqueItemId ).
Should I not be using itemids at all?
Thx