Random Buff/Debuff (state) each round?

Grinn

The Game Dev Wonder
Veteran
Joined
May 5, 2012
Messages
66
Reaction score
17
First Language
English
Primarily Uses
Ok, so I have tried this with some in battle scripted events, but I can't come up with a good way to randomize it. I'm not a programmer so I was hoping someone could help me with a simple script call?

It would be like: At the start of each round, all characters (enemies and allies) collectively get either a buff or debuff (apply a state) that is removed at the end of the entire round (or start of the next combat turn). What state is applied is selected from a predefined list.

 Has anyone done something like this before? Anyone want to take a crack at it?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,960
First Language
English
Primarily Uses
RMMV
state_id = rand($data_states.size - 1) + 2

($game_party.alive_members + $game_troop.alive_members).each  { |member| 

member.add_state(state_id) }

This will apply a random state from the database (excluding Death) to every living combatant.

Or if you want to have a predetermined list like you said, you could do this:

allowed_states = [2, 5, 16, 17, 20]

state_id = allowed_states[rand(allowed_states.size)]

($game_party.alive_members + $game_troop.alive_members).each  { |member| 

member.add_state(state_id) }
 
Last edited by a moderator:

Grinn

The Game Dev Wonder
Veteran
Joined
May 5, 2012
Messages
66
Reaction score
17
First Language
English
Primarily Uses
state_id = rand($data_states.size - 1) + 2

($game_party.alive_members + $game_troop.alive_members).each  { |member| 

member.add_state(state_id) }

This will apply a random state from the database (excluding Death) to every living combatant.

Or if you want to have a predetermined list like you said, you could do this:

allowed_states = [2, 5, 16, 17, 20]

state_id = allowed_states[rand(allowed_states.size)]

($game_party.alive_members + $game_troop.alive_members).each  { |member| 

member.add_state(state_id) }
Awesome!

Now would I drop that in as a script trigger on each turn of the battle on like the troop page?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,960
First Language
English
Primarily Uses
RMMV
You would indeed.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,367
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
However, you should note that the commands given above will add the same state to all battlers.


If you want the battlers to get different states, you'll have to move the randomizer into the add_state-command


And the time it will stay depends on the state setting - there is no autoremoval by itself.
 
Last edited by a moderator:

Grinn

The Game Dev Wonder
Veteran
Joined
May 5, 2012
Messages
66
Reaction score
17
First Language
English
Primarily Uses
Thanks a lot guys! You rock!

I had to mess with state removal (as Andar suggested) but it works.

Just have to drop this page onto each troop and have it trigger each turn at the end of the turn.

Make sure to have Trihan's script that grants the states go AFTER the removal of the states.


 

I created new states so that they wouldn't get removed if someone gets a buff.

I had each of those state buff 150% a few stats (like one gives +150% Magic Def and Def while another buffs Atk and Magic Atk) or provide 15% Regen.

Because each state is applied at the END of the round, you can see the icon BEFORE your decide on your actions.

That worked out pretty well. Thanks all (and particularly Trihan :D   )
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,960
First Language
English
Primarily Uses
RMMV
Grinn, you could condense that first part into a script too. The full thing would go a little something like this:

allowed_states = [28, 29, 30, 31, 32]

allowed_states.each { |state|

  ($game_party.alive_members + $game_troop.alive_members).each { |member|

    member.remove_state(state)

  }

}

state_id = allowed_states[rand(allowed_states.size)]

($game_party.alive_members + $game_troop.alive_members).each  { |member| 

member.add_state(state_id) }
 

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

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,083
Members
137,583
Latest member
write2dgray
Top