Resource icon

Passive Item System 1.02

No permission to download
A set of items that can be carried on a player or a creature that provide events to occure automatically as long as they are being carried. Each item has a seperate cooldown and percent chance that an event may occure.

It is setup right now so it works if it is in a players backpack while fighting creatures. Or if its in a creatures backpack fighting other creatures. It is not setup for Player vs Player but it is an easy addition.

Blade Spirit
Description
: Summons a blade spirit to assist the mobile. Acts as a summoned pet.
Cooldown: 60s
Chance: 5%
SnD98KO.gif


Druid
Description
: Heals a mobile based on a random chance each time they take damage
Cooldown: 60s
Chance: 5%
OzFM5KD.gif


Lightning
Description
: Summons a lightning bolt to hit your target
Cooldown: 10s
Chance: 5%
KHdE8fT.gif


Dragon
Description
: Summons a dragon to help the mobile. Acts as a summoned pet.
Cooldown: 60s
Chance: 1%
kL1Y7Ff.gif


Treasure Goblin
Description
: Give the player a small random amount of gold
Cooldown: 60s
Chance: 5%
R4c89OK.gif


BaseCreature.cs
Inside the "public override void OnDamage(int amount, Mobile from, bool willKill)" function. At the very bottom above "base.OnDamage(amount, from, willKill);"

Code:
#region Natfoth Passive Item System Edit #1
            if (from != null && from.Backpack != null && from.Backpack.Items.Count > 0) {
                //Check damage given first
                var passiveItems = from.Backpack.FindItemsByType(typeof(BasePassiveItem)).ToList();
                foreach (var passiveItem in passiveItems) {
                    ((BasePassiveItem)passiveItem).OnDamageGiven(this, amount, from, willKill);
                }

                //Then check for damage received in MVM
                if (Backpack != null) {
                    passiveItems = Backpack.FindItemsByType(typeof(BasePassiveItem)).ToList();
                    foreach (var passiveItem in passiveItems) {
                        ((BasePassiveItem) passiveItem).OnDamageReceived(this, amount, from, willKill);
                    }
                }
            }
            #endregion

PlayerMobile.cs
Inside the "public override void OnDamage(int amount, Mobile from, bool willKill)" function. At the very bottom above "base.OnDamage(amount, from, willKill);"
Code:
#region Natfoth Passive Item System Edit #2
            if (Backpack != null && Backpack.Items.Count > 0) {
                var passiveItems = Backpack.FindItemsByType(typeof(BasePassiveItem)).ToList();
                foreach (var passiveItem in passiveItems) {
                    ((BasePassiveItem) passiveItem).OnDamageReceived(this, amount, from, willKill);
                }
            }
            #endregion
Author
Natfoth
Downloads
120
Views
2,146
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Natfoth

Latest Updates

  1. Treasure Goblin Update

    - Treasure Goblin Update
  2. Text update

    1.01: Quick text update for the treasure goblin
Back