How do I make Skills with different effects based on target (Friend or Foe)?

Joined
Jul 8, 2015
Messages
13
Reaction score
4
First Language
English
Primarily Uses
Hello! This is my first post/question. I am trying to figure out the best and most efficient way to create a set of special spell skills and basically need to know what scripts I may need to implement for it to work. I'd like to achieve the effect with as few scripts as possible, and I already know that i will need to have some kind of Targeting Script, but I'm hoping this request will only need 1 or 2 scripts as opposed to 4 or 5.

Basically, what I want to achieve is limiting the amount of crap on my spell list by having them have effects that change depending on who is targeted (Ally or Enemy).

Example: a fire spell that would deal fire damage on enemies and a chance to inflict a burn (with perhaps different damage depending on single target or multiple targets), but the when same spell is used on an ally, it would not deal damage but give them a Fire Charge buff instead (with perhaps a lowered chance of applying the buff if used on entire party).

Essentially rolling a Single Target Fire spell, Multi-Target Fire spell, and a Fire Power-Up spell as ONE singular versatile skill.

This way, I can give my spell caster character 10 spells that have multiple uses as opposed to 30+ spells that are just, well Final Fantasy style mark up spells. I'm trying to be creative with the spells and am even interested in trying to figure out how to implement them outside of battle as well (burning down something blocking your path, Lighting a signal for some story event, etc.)

I'm currently running the following Scripts:

(In this order)

YEA Ace Battle Engine

YEA Victory Aftermath

YEA Party System 

YEA Command Party Addon

Yami Battle Symphony

YEA Message System

YEA Extra Drops

YEA Battle Command List

YEA Parameter Bonus Growth

State Graphics (Neon Black)

Basic Enemy HP Bar

Hover Alerts (Modern Algebra) 

Hime Shop Manager

Hime Sell Only Shop

So yeah, I don't want to have to add too many more scripts if I don't have to. I worry about getting hit with issues with compatibility. I've already got enough tags on items, characters, and abilities as it is, and I don't know if there are any limits on the number of scripts that you can run, but I don't want to overload the game with too much fluff. I am not a scripter by any means but I have been doing well enough with the instructions on scripts and would love to know what I can use to achieve these spell effects.

I have been looking for this for the better part of the past 4 hours today, as well as here and there for the last week as I work on developing other aspects of my game. I just haven't seen the right fit yet.

Thanks in advance  :)
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Add effects via the damage formula... You'll have more control using that
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Assuming you already have a way to allow skill to target allies or enemies (not available by default), you can set the effects using the damage formula:

a.opposite?( B) ? (on enemy effect) : (on ally effect)

For your give example, you'd use:

a.opposite?( B) ? if rand(10) < 4; b.add_state(20); end; a.mat - b.mdf : b.add_state(32); 0

But you will need to be careful with the amount of space you have in the damage formula.  If your formula is too long, you can evaluate the whole thing in a script method instead and call that method from the formula (or a common event).
 
Last edited by a moderator:
Joined
Jul 8, 2015
Messages
13
Reaction score
4
First Language
English
Primarily Uses
Assuming you already have a way to allow skill to target allies or enemies (not available by default), you can set the effects using the damage formula:

a.opposite?( B) ? (on enemy effect) : (on ally effect)

For your give example, you'd use:

a.opposite?( B) ? if rand(10) < 4; b.add_state(20); end; a.mat - b.mdf : b.add_state(32); 0

But you will need to be careful with the amount of space you have in the damage formula.  If your formula is too long, you can evaluate the whole thing in a script method instead and call that method from the formula (or a common event).
Alright, I will give this a shot tomorrow after applying a script to change the scope and see. Thanks for the reply!
 
Last edited by a moderator:
Joined
Jul 8, 2015
Messages
13
Reaction score
4
First Language
English
Primarily Uses
Alright so I've tried to implement this and I got past the easy part and was able to get a targeting script, so that part is taken care of

(kind of - I still can't have it switch between Single Target and Multiple Target while also swapping between hitting a friend or foe,

but that's ok, I will take that over nothing!)

However, I have been unsuccessful in getting the formula to work. I must say, first of all, thank you again for your suggestion.

I do not understand the more advanced skill formulas to be honest (math was always a bad subject, and programming...well they didn't even try to teach me that!). I don't know why it wasn't working, but I was getting an error message.

Script 'Game Battler' line 352: SyntaxError occurred.
 ​
Then it said unexpected , , expecting  and then showed the formula....

I also don't know how to run a formula through eventing/common events, so I don't even know what else to attempt. I'm really just now learning how to use the more detailed intricacies of RPG Maker, when I started, it was mostly out of a passion for making maps and telling stories in an interesting medium, so the technical stuff can sometimes go way over my head.

Maybe you could explain how to implement it in more simple/instructional terms? And it would be great if you would tell me in basic terms what it all means so that once I get this one skill done I can apply the knowledge to other skills as well.

At any rate, I do appreciate it, and if all else fails, at least I can commit suicide with my fire spells now :D
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,669
First Language
German
Primarily Uses
RMMV
Please give a screenshot of both the error message and the skill with the damage formula - in syntax errors, we need the exact lettering because even a space can cause a syntax error, and somewhere you mistyped.
 
Joined
Jul 8, 2015
Messages
13
Reaction score
4
First Language
English
Primarily Uses
Here is the formula I used first:

a.opposite?( B) ? if rand(10) < 4; b.add_state(26); end; a.mat - b.mdf : b.add_state(21); 0

State 26 is Burn and State 21 is a Fire Buff. I've attached the error message "Screenshot (1)"

I did get this to work using this formula, but it doesn't include a chance to add my Burn state to enemies. I want to include that if possible because my Burn state increases the damage enemies take from fire.

a.opposite?( B) ? (a.mat * 4 - b.mdf * 2) : (b.add_state(21))

Only other problem is that while it does give my characters the buff I want without damaging them, the still get a No Effect and Resist popup

which makes it look like it was supposed to be bad. I've attached that screenshot as well "Screenshot (2)"

Screenshot (1).png

Screenshot (2).png
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Here is the formula I used first:

a.opposite?( B) ? if rand(10) < 4; b.add_state(26); end; a.mat - b.mdf : b.add_state(21); 0

State 26 is Burn and State 21 is a Fire Buff. I've attached the error message "Screenshot (1)"

I did get this to work using this formula, but it doesn't include a chance to add my Burn state to enemies. I want to include that if possible because my Burn state increases the damage enemies take from fire.

a.opposite?( B) ? (a.mat * 4 - b.mdf * 2) : (b.add_state(21))

Only other problem is that while it does give my characters the buff I want without damaging them, the still get a No Effect and Resist popup

which makes it look like it was supposed to be bad. I've attached that screenshot as well "Screenshot (2)"
The error is apparently because it needs the "otherwise" branch before a new line.  My bad.

You could try this formula which includes extra parentheses; I'm not sure whether or not it would work:

a.opposite?( B) ? (if rand(10) < 4; b.add_state(26); end; a.mat - b.mdf) : b.add_state(21); 0

If it doesn't work, use the long form:

if a.opposite?( B) ; if rand(10) < 4; b.add_state(26); end; a.mat - b.mdf; else; b.add_state(21); 0; end

As you can see, the second formula is longer, and you'll have less room to add content and still have it fit in the formula box.

As far as the popups, that's behavior from Yanfly's script that's happening whenever you have a formula that deals damage and that damage is zero (or something similar); you'll have to figure out how to turn it off there.  Can't help you with that.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
For your popup problem, I had something similar happening (though I was doing something different to you).  I tried Yanfly's anti-fail message script, but it didn't work.  After lots of messing around I had to settle for dealing 1HP damage to an enemy or 1HP healing to an ally.  That still gives a popup telling you that change, but at least it looks less ridiculous than the others.

I know this is not an elegant solution, but if nothing better comes up it might be preferable to what's currently happening.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
There's definitely a way, if you know some scripting, to suppress the popupsif (for example) a state is applied in the damage formula.  I just don't know it offhand and it could take hours to figure out, which is time I don't have.

It would be a reasonable RGSS3 Request to make though, since tons of people use the Yanfly scripts and improving it for one person would mean improving it for all.
 
Joined
Jul 8, 2015
Messages
13
Reaction score
4
First Language
English
Primarily Uses
Thanks! So the first formula seemed to work except for the damage part, it burned the enemies but dealt no damage. The second one is too long, is there some way to calculate it outside of the formula box?

And is it possible to add the state after damage calculation. After doing a few test battles, I realized that since my burn state increases the damage you take from fire element, that's why the RESIST pop up is appearing when I use it on my allies, and a WEAKNESS pop up on the enemies.

The state is applied right away and prompts the Weakness/Resist pop-up in my Battle Engine.

So If it could calculate damage first (0 for allies, formula for enemies), then add the states, it would reduce 2 pop-ups I don't need appearing without having to disable them permanently or alter the script.

As far as the NO EFFECT pop up on my party, I can either live with it or have it deal 1 damage or restore a little mp or something (all my characters use my mp-replacement in the story, so I could argue that they absorb some MP from the buff, idk) so instead of the NO EFFECT, it would just show Mp Recovery, which is fine by me.

The only problem I have now is wrapping my head around getting the long form formula to work >_>
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Thanks! So the first formula seemed to work except for the damage part, it burned the enemies but dealt no damage.
Then let's try moving the parentheses around.  Try the two following formulas and see if either work for you:

a.opposite?( B) ? (if rand(10) < 4; b.add_state(26); end); a.mat - b.mdf : b.add_state(21); 0

a.opposite?( B) ? (if rand(10) < 4; b.add_state(26); end;) a.mat - b.mdf : b.add_state(21); 0

The second one is too long, is there some way to calculate it outside of the formula box?
Yes: read through this.

And is it possible to add the state after damage calculation. After doing a few test battles, I realized that since my burn state increases the damage you take from fire element, that's why the RESIST pop up is appearing when I use it on my allies, and a WEAKNESS pop up on the enemies.
The state is applied right away and prompts the Weakness/Resist pop-up in my Battle Engine.

So If it could calculate damage first (0 for allies, formula for enemies), then add the states, it would reduce 2 pop-ups I don't need appearing without having to disable them permanently or alter the script.
I don't think so, not using this approach at least.  The reason is that the damage formula can be calculated before the state is added, but things like elemental adjustments are applied slightly later on in the battle processing, after all the work using the formula box is done.  So you'd either need to split the skills back into unique skills to be used on allies or enemies (which I know you don't want to do), or you'd have to do some scripting (probably in Game_Battler) to get it to work how you want it to.  I could probably script this single skill for you, but it's not necessarily explandable to other skills since different calculations (like elemental resistances, crit calculations, etc.) are all being done at different parts of the process, so I don't know how useful a single skill being scripted for you would really be if you have no RGSS experience.

One other thought is that I'm working on a "Battle Effects" script that might be able to solve this, by tagging the skill to apply the Fire Charge state if the target is a friend and a Fire Weakness state if the target is a foe.  I think this would be applied after all default damage calculations so it would meet your needs.  And while this kind of functionality is already in the script, the problem is that I haven't completed it yet so I haven't even started to work on script compatibility - there's almost no chance it's compatible with Yanfly's Battle System right now.  But if you're not releasing your game for a few months, that's definitely one script you'll want to look out for.
 
Last edited by a moderator:
Joined
Jul 8, 2015
Messages
13
Reaction score
4
First Language
English
Primarily Uses
Awesome, I will read that and try to get the long form figured out. I've been experimenting for an hour now and so far I've only managed to get a

"close-enough" version with this:

if a.opposite?( B) ; a.mat * 4 - b.mdf * 2; else; b.add_state(21); 1; end

Then I altered the Fire buff state to just give you Fire Elemental damage to the auto-attack and is unable to be burned, with a slight buff to attack. That eliminated the unwanted pop-ups, so now I just get the Fire Buff pop-up(which I want) and the 1 damage my allies take (which is odd, but its better than anything else).

Then I just added the burn state back into the regular spot for apply states in the skill effects box. It will work for now. I'm not anywhere close to being done with the game, especially since I can't even grasp formulas fully yet, so as far as your script, that sounds like it would be awesome and I look forward to trying it out when it is finished!

Thanks again for all your suggestions. When I have a bit of time I will re-try your long-form formula after I learn how to have it calculate outside the formula box.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top