Natfoth submitted a new resource:

Passive Item System - Items that provide passive events to fire

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

Read more about this resource...
 
  • Like
Reactions: Rex
Make sure to add

using Server.Custom.Natfoth.PassiveItems;

to the playermobile.cs and basecreature.cs #region references
 
Not sure why but when I add any of the passive items the name isn't there when I highlight over the item. The name does show under properties but that's it.
 
Trying to add this but am getting the following errors, (also - i've added the line Izex mentioned in the above Using area. )
[article]
Errors:
+ Custom/PassiveItems/HealingDruidPassiveItem.cs:
CS1502: Line 65: The best overloaded method match for 'Server.Timer.DelayCall(System.TimeSpan, System.TimeSpan, int, Server.TimerStateCallback, object)' has some invalid arguments
CS1503: Line 65: Argument 1: cannot convert from 'method group' to 'System.TimeSpan'
CS1503: Line 65: Argument 2: cannot convert from 'Server.Mobile' to 'System.TimeSpan'
CS1503: Line 65: Argument 4: cannot convert from 'Server.Mobile' to 'Server.TimerStateCallback'
+ Custom/PassiveItems/LightningImpPassiveItem.cs:
CS1502: Line 67: The best overloaded method match for 'Server.Timer.DelayCall(System.TimeSpan, System.TimeSpan, int, Server.TimerStateCallback, object)' has some invalid arguments
CS1503: Line 67: Argument 1: cannot convert from 'method group' to 'System.TimeSpan'
CS1503: Line 67: Argument 2: cannot convert from 'Server.Mobile' to 'System.TimeSpan'
CS1503: Line 67: Argument 4: cannot convert from 'Server.Mobile' to 'Server.TimerStateCallback'
CS0117: Line 114: 'Server.Spells.SpellHelper' does not contain a definition for 'GetSpellDamageBonus'
CS1061: Line 118: 'object' does not contain a definition for 'Enemy' and no extension method 'Enemy' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
CS1061: Line 119: 'object' does not contain a definition for 'DamageReduction' and no extension method 'DamageReduction' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
+ Custom/PassiveItems/PassiveBladeSpirits.cs:
CS0103: Line 17: The name 'Siege' does not exist in the current context
+ Mobiles/PlayerMobile.cs:
CS1061: Line 2865: 'System.Array' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
[/article]
here is my playermobile.cs.
[article]
#region Mondain's Legacy
if (InvisibilityPotion.HasTimer(this))
{
InvisibilityPotion.Iterrupt(this);
}
#endregion

#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

base.OnDamage(amount, from, willKill);
}
[/article]
 
Karavoc did you put using Server.Custom.Natfoth.PassiveItems; with the other references in both playermobile.cs and basecreature.cs?
 
Izex, I had the same two errors. And yes, I added the namespace.
[doublepost=1550188925][/doublepost]
Code:
        public override void OnDamageGiven(Mobile target, int amount, Mobile from, bool willKill) {
            if (!IsOnCooldown() && ChanceCheck()) {
                //The call must be delayed so that the system has enough time to process the damage request
                Timer.DelayCall(PerformSpell, target, amount, from, willKill);
                StartCooldown();
            }
        }
Is the problem
[doublepost=1550189613][/doublepost]Also, I'm not sure how to use this? I [add the dragon one and it created a little rock with a cooldown time. I put it in my backpack and clicked on it and it didn't do anything.
 
Hey,

Having the same issue with the item name not displaying you hover over the item it displays the weight line?

<summary>
/// Summons a blade spirit to assist the mobile. Acts as a summoned pet.
/// </summary>
[Constructable]
public BladeSpiritPassiveItem() : base(0xE73)
{
Name = "a captured blade spirit";
Weight = 8;
this.LootType = LootType.Blessed;
Hue = 3;
Movable = true;
Chance = 500; // 5%
}

I've also only managed to get it to be blessed by doing the this.LootType but it displays in yellow text on the item as the Items name as well?

thanks a lot
 
#region Natfoth Passive Item System Edit #1
if (from != null && from.Backpack != null && from.Backpack.Items.Count > 0) {

var passiveItems = from.FindItemsByType(typeof(BasePassiveItem)).ToList();
foreach (var passiveItem in passiveItems) {
((BasePassiveItem)passiveItem).OnDamageGiven(this, amount, from, willKill);
}

}
#endregion

Currently, the passive triggers multiple time if the person is carrying the item multiple times, I believe this is where I should be fixing it but I am unsure how, anyone manage to do it so it only triggers once?
 
Back