Results 1 to 1 of 1
  1. #1
    Invader_Zim's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Location
    Atlas 2
    Posts
    546
    Reputation
    10
    Thanks
    300
    My Mood
    Tired

    Implementation of LeachHealth Descriptor

    This is mainly for Lord Ruthven, but this will be a short tutorial on how to implement this descriptor.

    Step 1. On your enemy object, add <LeachHealth/> to its XML.

    Step 2. In file 'Descriptors.cs', make a public bool variable named 'LeachHealth', preferably under the other object descriptions. Then in the class 'ObjectDesc', write to your variable using your XML tag.
    Code:
    public bool LeachHealth { get; private set; }
    
    LeachHealth = elem.Element("LeachHealth") != null;
    Step 3. In file 'Player.cs', find 'public void Damage', and add this code underneath the reduction of player HP. We do this just because it's after the damage calculations.
    Code:
                    if (chr.ObjectDesc.LeachHealth)
                    {
                        Enemy enemy = chr as Enemy;
    
                        if (enemy.HP > 0 && enemy.HP < chr.ObjectDesc.MaxHP)
                        {
                            enemy.HP += dmg;
    
                            chr.Owner.BroadcastPacket(new ShowEffectPacket
                            {
                                EffectType = EffectType.Potion,
                                TargetId = chr.Id,
                                Color = new ARGB(0xffffffff)
                            }, null);
                            chr.Owner.BroadcastPacket(new NotificationPacket
                            {
                                ObjectId = chr.Id,
                                Text = "{\"key\":\"blank\",\"tokens\":{\"data\":\"+" + dmg + "\"}}",
                                Color = new ARGB(0xff00ff00)
                            }, null);
                        }
                    }
    Then you're done. Now your Lord Ruthven will heal itself from damaging players. You could take this a step further by making the tag a projectile descriptor, which should be self explanatory.

     
    Last edited by Invader_Zim; 05-12-2019 at 03:25 AM.

    My weapon is a backpack.

Similar Threads

  1. [Solved] How To Implement This Into TF2 Hax
    By blackstab1337 in forum C++/C Programming
    Replies: 2
    Last Post: 07-01-2012, 03:52 PM
  2. Replies: 3
    Last Post: 06-21-2012, 07:48 PM
  3. New Check Implemented?
    By trogdor0071 in forum Vindictus Help
    Replies: 2
    Last Post: 08-19-2011, 04:01 AM
  4. Activity Bar, & Points count implementation.
    By Jabuuty671 in forum General
    Replies: 40
    Last Post: 03-03-2010, 12:44 AM