Chaos Project

RPG Maker => General Discussion => Topic started by: Matth_Grove on August 02, 2020, 01:52:14 am

Title: Set a state to someone on your party members in certain cases
Post by: Matth_Grove on August 02, 2020, 01:52:14 am
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
Title: Re: Set a state to someone on your party members in certain cases
Post by: KK20 on August 02, 2020, 04:11:40 am
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.
Title: Re: Set a state to someone on your party members in certain cases
Post by: Matth_Grove on August 02, 2020, 03:45:00 pm
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.
Title: Re: Set a state to someone on your party members in certain cases
Post by: KK20 on August 02, 2020, 03:59:34 pm
You can do an additional check for the scene.

$scene.is_a?(Scene_Battle)
Title: Re: Set a state to someone on your party members in certain cases
Post by: Matth_Grove on August 02, 2020, 05:54:57 pm
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.
Title: Re: Set a state to someone on your party members in certain cases
Post by: KK20 on August 02, 2020, 06:15:24 pm
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.
Title: Re: Set a state to someone on your party members in certain cases
Post by: Matth_Grove on August 02, 2020, 07:22:07 pm
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
Title: Re: Set a state to someone on your party members in certain cases
Post by: KK20 on August 02, 2020, 08:32:57 pm
I'm telling you it is possible.
What part do you not understand?

(https://i.imgur.com/sfeuMv4.png)