becorath 0 Posted November 26, 2017 Share Posted November 26, 2017 What I have.. internal void CastSpell(Spell Spell, int shards, int playerHP, int targetHP) { if ((Spell.KnownSpell && Spell.IsSpellUsable && Spell.IsDistanceGood) && (ObjectManager.Me.SoulShards > shards) && (ObjectManager.Me.HealthPercent <= playerHP && ObjectManager.Target.HealthPercent <= targetHP)) { Logging.Write("Doing Stuff.. " + Spell.Name); Spell.Launch(); return; } } What I want to do... (left blank areas between , for reference) CastSpell(Agony, 3); CastSpell(Siphon, , 30, 20); CastSpell(Reap, 3); CastSpell(DrainSoul, , 30, 15); Some spells require knowing how many shards I have, so not, same with player and target HP. How would I go about making this work without having to input a value for each? Note: This works for all 4 variables(to be expanded on later), but I want it where I only have to input what is necessary. I feel this is something I should already know, but it seems to be eluding me. Any suggestions or recommendations? I'f i'm going down the wrong path, please let me know. Link to comment https://wrobot.eu/forums/topic/7835-c-question/ Share on other sites More sharing options...
becorath 0 Posted November 28, 2017 Author Share Posted November 28, 2017 Overloading! I knew it was simple. Link to comment https://wrobot.eu/forums/topic/7835-c-question/#findComment-35849 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now