Jump to content

Recommended Posts

Posted

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

Posted
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.
Posted

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() event

in the OnDying() block add some xp to the quest scripts counter

  • Recently Browsing   0 members

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