Set a state to someone on your party members in certain cases

Started by Matth_Grove, August 02, 2020, 01:52:14 am

Previous topic - Next topic

Matth_Grove

Hello guys
I'm pretty new in this about "RPG Maker games"
and i've having a bit of "difficult" in some mechanics that i want to implement to my games
some of those mechanics i made it work with "Common Events" and Variables, etc.
So, i wanted a object that, if you used 3 times (for example), you'll get a state,
but, the problem was that the states in RPG Maker (XP specifically) are aplicated for someone in particular (Actor 1 or 2, etc.) and i want that state was put it for that one actor that used it.

So, i hope i've explained of the best way possible.

Do you know about a Script or a Command inside RPG Maker XP that can help with this?
Good Night, Sleep Sweet

KK20

First, add this script:
class Scene_Battle
  attr_reader :active_battler
end

class Interpreter
  def used_by?(battler)
    battler == $scene.active_battler
  end
end
Now you can use the following Conditional Branch script call, for example:
used_by?($game_actors[1])
Make your item call a Common Event using the above conditional. Increment a variable that counts how many times the item was used. If the count reaches 3, add the state.

Just remember to reset that variable's count to 0 at the start/end of every battle.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Matth_Grove

KK20, It works perfectly!, this will be so helpful as with object as with skills that i'll implement, but, i only have one more question. What about if that object/skill can be use it in the map (no in battle only)?

I hope you can see this and help me with this.

Good Night, sleep sweet.

KK20

You can do an additional check for the scene.

$scene.is_a?(Scene_Battle)

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Matth_Grove

KK20, I've trying of testing about that code that you given me "$scene.is_a?(Scene_Battle)"
But, i cannot get a good result of i'm looking for, i think that i didn't explain it well (My mistake)
The object/skill that i use in battle works Perfectly, but, i want that object/skill we can use it in menu too
I apologies if i didn't explain myself well before.
Is there an option I can apply in this situation?

Good Night, sleep sweet.

KK20

So what is the end-goal? Are you saying if you use the item outside of battle that it doesn't apply the state after 3 uses? Then modify the common event logic to check the scene first, and then check the actor who used it.

When in battle, $scene.is_a?(Scene_Battle) returns true. If the item is used from the map, then it returns false, so the common event shouldn't continue processing the rest of the logic.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Matth_Grove

Well, technically, i wanted that, as in Battle as Map you can use that object/skill, and then, use it 3 times
and get the state. Anyway, if the mechanic that i wanted to implement can't be possible, it doesn't matter
only i put in "Use only in Battle" and problem fixed.

Anyway, Thanks for this information, See ya

Good Night, sleep sweet

KK20

I'm telling you it is possible.
What part do you not understand?


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!