Help with a 50/50 item effect!

Joined
Apr 20, 2015
Messages
23
Reaction score
0
First Language
English
Primarily Uses
So in my game there's this coin item that has a 50% percent chance of giving the effect of either increased attack or defense. The problem is that there's no way I can find to make the 50/50 chance work! I tried to have the item call a common event that randomly chooses one or the other but the problem is that I have to specify which actor to effect. There's also an option to affect an actor using a variable but I have no clue how to set that up. Help is very appreciated!:)
 

Rhaeami

The Sleepy-Eyed One
Veteran
Joined
Jun 2, 2014
Messages
252
Reaction score
178
First Language
English
Primarily Uses
RMVXA
The easy (albeit tedious) answer is to have a different version of the skill for each actor; that way you can link to different versions of the common event which can simply specify each of their given actors as the targets.

As for specifying it with a variable, I believe you can use something like $game_variables[#] = a.id in the damage formula, though it may cause some weirdness with messaging if you aren't dealing damage or healing. It'll throw out a "no effect" battle message, for instance. Not sure how to use damage formulas on non-damaging skills without a failure message, short of using a script.

Obviously, any number of scripts could streamline all of this. :kaoswt2:
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
Should be easy with a damage formula.

Code:
rand < 0.5 ? b.add_state(atk_state_id) : b.add_state(def_state_id)
or if its a buff

Code:
rand < 0.5 ? b.add_buff(2, 5) : b.add_buff(3, 5)
 
Joined
Apr 20, 2015
Messages
23
Reaction score
0
First Language
English
Primarily Uses
Should be easy with a damage formula.

Code:
rand < 0.5 ? b.add_state(atk_state_id) : b.add_state(def_state_id)
or if its a buff

Code:
rand < 0.5 ? b.add_buff(2, 5) : b.add_buff(3, 5)
Thank you so much! It works now!:D
 

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

Latest Threads

Latest Profile Posts

I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:
attack on titan final season is airing tomorrow, I'm excited and scared at the same time!

Forum statistics

Threads
105,882
Messages
1,017,230
Members
137,607
Latest member
Maddo
Top