Add buff to ally other than user + damage to enemies

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
Adding a buff to the user while dealing damage to the enemy is quite straightforward, I just use the damage formula e.g.
a.add_buff(3,3); a.atk * 4 - 2.def * 2

However, I want to add the buff to another ally (ideally it would always be actor 3) as well as deal damage to the enemy. Is there a way of doing this?

An escalation of the query would be - could this be done for all allies and all enemies?

Thanks
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
formulas run directly through the kernel, with the difference of having "a" and "b" as stand ins for actor and enemy, and "$game_variables" as an implicit argument.
so, you just run the code for grabbing actor 3 out of the actors object: "$game_actors(3).add_buff(x,y); formula"

this is a formula I used to decide damage with a condition.
Code:
b.hp / b.mhp < 0.25 ? {b.add_state(1); return b.mhp * 0.25} : return -1;
instantly kills anyone below 25% HP and heals the user for that amount.

check for enemy belonging to enemy type group before returning damage.
Code:
[b.element_rate(35), b.element_rate(34)].any?{|el| el > 1} ? 20 : -1;
damages only undead and demons

reverse damage calculation from function returned from third-party plugin (my personal favorite)
Code:
-a.xstat.patk + (b.hp.to_f * 0.26 / 70.0 * b.xstat.pdf.to_f).round
returns a negative damage to bypass the battle system's damage calculation, and any enemy defense, to deal a fixed 26% HP damage.


you just run the code.
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
you just run the code.
Sadly, if I could just "run the code" I would not be posting here.
None of the examples you gave apply to my particular query, so I am unable to use any of them as a basis on which to build.

Thank you, though, for taking the time to answer.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
I think you would replace "a.add_buff" with "$game_actors[3].add_buff", though this would add it to Actor ID 3, if they exist in your battle party. If you wanted the actor in the 3rd slot, there's a way to reference that too, but I forget the syntax.
 
  • Like
Reactions: Kes

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
sorry, should have been $game_actors[3], not $game_actors(3)

I thought it would be evident the different combinations of code to run that you can make by using the damage formula, but I guess it wasn't.....
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
@Wavelength It is actor 3 that I wanted, so that is fine. Thank you very much.
Would you happen to know the syntax for a skill which would apply the buff to all allies?
 

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,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top