Scripts18 Posted March 2, 2012 Share Posted March 2, 2012 The OnDeath event doesnt work since its a objectreference script any one can help me on this? ScriptName LevelingUpWeapon extends ObjectReference int property xp auto ObjectReference property LevelingUpWeapon01 auto ObjectReference property LevelingUpWeapon02 auto ObjectReference property LevelingUpWeapon03 auto Event OnEquipped(Actor AkActor ) If akActor == Game.GetPlayer() if (xp < 10) Debug.notification("Level 1 Up Weapon Was Equiped") elseif (xp >= 10) && (xp <25) Debug.notification("Level 2 Up Weapon Was Equiped") elseif (25 <= xp) Debug.notification("Level 3 Up Weapon Was Equiped") endIf EndIf EndEvent Event OnDeath(Actor akKiller) If (akKiller == game.getplayer()) Debug.Notification("You Killed An Enemy") Debug.notification("Your Weapon Gained 1 xp") xp += 1 if xp < 10 Game.GetPlayer().RemoveItem(LevelingUpWeapon01,1,true) Game.GetPlayer().AddItem(LevelingUpWeapon02,1,true) Game.GetPlayer().EquipItem(LevelingUpWeapon02,false,true) elseif xp >= 25 Game.GetPlayer().RemoveItem(LevelingUpWeapon02,1,true) Game.GetPlayer().AddItem(LevelingUpWeapon03,1,true) Game.GetPlayer().EquipItem(LevelingUpWeapon03,false,true) endif Endif EndEvent Event OnUnEquipped(Actor AkActor ) If akActor == Game.GetPlayer() if (xp < 10) Debug.notification("Level 1 Up Weapon Was UnEquiped") elseif (xp >= 10) && (xp <25) Debug.notification("Level 2 Up Weapon Was UnEquiped") elseif (25 <= xp) Debug.notification("Level 3 Up Weapon Was UnEquiped") endIf EndIf EndEvent Link to comment Share on other sites More sharing options...
dmjay Posted March 3, 2012 Share Posted March 3, 2012 I think you should look at the code for the soul trap spell. You could create a magic effect that your sword puts on the enemy that you are hitting. In the OnEffectFinish event you would just check it the enemy is dead and then give the weapon the xp. Link to comment Share on other sites More sharing options...
cscottydont Posted March 3, 2012 Share Posted March 3, 2012 would be better if you controlled the exp/item addition removal from a quest script then you put a scripted enchantment effect on your weapon that has an OnDying() eventin the OnDying() block add some xp to the quest scripts counter Link to comment Share on other sites More sharing options...
Recommended Posts