I want to create cursed item for example "sword" that cant be removed/un-equip till character death or (even beyond) :p

Problem is I don't know which "event" in Item or Mobile/PlayerMobile I need to handle to prevent "sword" from being un-equip by player -
OnEquip in baseweapon or what ... ?

Could someone point me at right direction here ? ^^

Thx.
 
Not sure if this will work. In your custom sword, you can set the LootType to be LootType.Cursed. Not sure if that will actually prevent the item from being removed or not. Perhaps add something like this to your custom sword script:

Code:
        public override void OnRemoved(object parent)
        {
            if (parent is PlayerMobile)
            {
                ((PlayerMobile) parent).EquipItem(this);
            }
        }
 
thx, i'll try ;] I didn't know about existance OnRemoved method - now it will be easy ;]

LootType.Cursed means that it can't be insured and thats all but it might be needed anyway.
 
The trouble with using OnRemoved is that it would also trigger when the player dies, equipping the sword to his ghost.

You might want to look at public override bool OnDragLift(Mobile from) instead. It's inherited from Item
 
You'll also have to change the DeathMoveResults in Playermobile. I'm fairly certain, because this overrides any scripts "underneath" Playermobile. So they would be something similar to this:
Code:
        public override DeathMoveResult GetParentMoveResultFor(Item item)
        {
            if (!this.Young) 
                if (CheckInsuranceOnDeath(item)) 
                    return DeathMoveResult.RemainEquiped;

            DeathMoveResult res = base.GetParentMoveResultFor(item); 
            { 

                if (res == DeathMoveResult.MoveToCorpse && item.Movable && this.Young) 
                    res = DeathMoveResult.RemainEquiped; 

                if (res == DeathMoveResult.MoveToBackpack && !this.Young) 
                    res = DeathMoveResult.RemainEquiped; 

                return res; 
            }
        }

        public override DeathMoveResult GetInventoryMoveResultFor(Item item) 
        { 
            if (!this.Young) 
                if (CheckInsuranceOnDeath(item)) 
                    return DeathMoveResult.MoveToBackpack; 

            DeathMoveResult res = base.GetInventoryMoveResultFor(item); 

            if (res == DeathMoveResult.MoveToCorpse && item.Movable && this.Young) 
                res = DeathMoveResult.MoveToBackpack; 

            if (res == DeathMoveResult.MoveToBackpack && !this.Young) 
                res = DeathMoveResult.RemainEquiped; 


            return res; 
        }

This keeps certain items equipped on the player upon death (blessed, cursed, quest items, etc).
 
Back