Name may be misleading, not sure if this is actually "advanced," but I've been messing around with the targeting system and yanfly's targeting system to make more advanced skills and spells. For this question, I wanted to make a spell that deals damage to enemies and heals allies. Making the skill target everyone, including or excluding the caster isn't difficult. I need help figuring out the code to check if the target is an ally or enemy. Is it as simple as putting a bool in the skill formula bar to check if the target is friend or foe? Any help would be super appreciated
Advanced Targeting
RPG Maker VXAce Support
Code:
b.is_a?(Game_Enemy)
b.is_a?(Game_Actor)
Awesome thank you! Would I need to put that in an if statement or would the code just work like this
mag = a.mat * 4 - b.mdf * 2; b.is_a?(Game_Enemy) b.hp -= b.hp - mag; b.is_a?(Game_Actor) b.hp += b.hp + a.mat * 4; mag
mag = a.mat * 4 - b.mdf * 2; b.is_a?(Game_Enemy) b.hp -= b.hp - mag; b.is_a?(Game_Actor) b.hp += b.hp + a.mat * 4; mag
You only need to use one of them.
mag = a.mat * 4 ; b.is_a?(Game_Actor) ? (b.hp += mag ; 0) : mag - b.mdf * 2
Something like that... The method simply returns true or false, so some Boolean logic is required.
mag = a.mat * 4 ; b.is_a?(Game_Actor) ? (b.hp += mag ; 0) : mag - b.mdf * 2
Something like that... The method simply returns true or false, so some Boolean logic is required.
I see now, I took a look at your tutorials and it makes a lot more sense. Thanks for the help! I don't have much experience with Ruby
Original thread: https://forums.rpgmakerweb.com/threads/advanced-targeting.68302/