Disabling Dashing, if MP in Party is 0

StarFox88

Villager
Member
Joined
Apr 8, 2013
Messages
9
Reaction score
1
First Language
German
Primarily Uses
Hello there,

I'm trying to create a key feature in my current project, but I can't figure out, how I have to do it and it's starting to get frustrating.

I want to use the MP of the Heroes as Stamina, so that physical attack techniques and dashing on the overworld cost a small amount of MP(Stamina) and has to be recharged by, for example, re sting at campsites.

Therefore I need to check if the hero in Slot 0, 1, 2 or 3 has run out of Stamina to disable the dash until the stamina is at least 1.

I found a script, that allowes an event to call it, but for a global event I need to set a condition to check for the MP attribute. But that is not an option.
Another way I could think of, would be to asign a new status "exhausted" and check for that, but I don't have any Idea how to check the party for the lowest MP and asign that status.

Some help would be really appreciated.
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
Parallel process runs 60 times per second.
Thus an event set to trigger as Parallel Proccess, will do the trick.

You should name a variable MP.

Event Page 1:
Conditional Branch: TP MP = 0
Disable Dash.
Set Self Switch A ON
End.

Event Page 2 (has condition Self Switch A = ON):
Conditional Branch: TP MP <> 0
Enable Dash.
Self Switch A = OFF.
End.

And that is how it works.

P.S.
I haven't thought (yet) how to check if using dashing and reduce TP if so.

Edit: Corrected TP to MP
 
Last edited:

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,600
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
@Dreadshadow but that will only works for one map, right? why not use common event to run on a whole game?
 

StarFox88

Villager
Member
Joined
Apr 8, 2013
Messages
9
Reaction score
1
First Language
German
Primarily Uses
@Dreadshadow that was my first idea, but there is no option in the conditional branch to check for any attribute.
And I already have a way, to reduce the MP while dashing via multiple conditional branches checking for button A and the Party Coordinates.
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
@Dreadshadow but that will only works for one map, right? why not use common event to run on a whole game?
You can always do a copy - paste of the event. Use Common Event for this? Involving self switches no, but yes, I guess you can make two common events, one for each page, it can be neat, but does not make much difference really, does it? We can use normal switches though and build it in Common Eventing. Not a bad idea really.

OH! MP! Not TP!!!
That would be easy mate!!!

Control Variables:
Operand: Game Data: Actor: MP

Then do Conditional Branch using the variable!!!
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
In this case, I'd be in favour of a small script snippet rather than a parallel process.

If you want to give it a go, just add this to the Materials section:

Code:
class Game_Player < Game_Character
  alias :shaz_dash? :dash?
  def dash?
      return false if $game_party.battle_members.any? {|actor| actor.mp < 1 }
      return shaz_dash?
  end
end
 
Last edited:

StarFox88

Villager
Member
Joined
Apr 8, 2013
Messages
9
Reaction score
1
First Language
German
Primarily Uses
@Dreadshadow As I understand it right now, I have to do it like this:
Conditional Branch - Check for pressed Button A
Conditional Branch - Check for new player coordinates
Conditional Branch - Check for Variable "Hero 001 MP"
Conditional Branch - Check for Variable "Hero 002 MP"
and so on?
Since I'm not sure of how many Characters join the party, that seems impracticle.
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
You can target target party member. Speaking of impractical though, you might need a script.
 

StarFox88

Villager
Member
Joined
Apr 8, 2013
Messages
9
Reaction score
1
First Language
German
Primarily Uses
I'm quite certain, that it's best handled in a script, but my knowledge of scripting is about solving math at preschoolers level.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,600
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
That's why shaz wrote the script above. Have you tried it?
 

StarFox88

Villager
Member
Joined
Apr 8, 2013
Messages
9
Reaction score
1
First Language
German
Primarily Uses
I have tried the script from shaz, but I get an error:
Script Stamina line 2: NameError occurred.
undifined method `dash´for class `Game_Player´
 

StarFox88

Villager
Member
Joined
Apr 8, 2013
Messages
9
Reaction score
1
First Language
German
Primarily Uses
Oh wow, Thank you so much guys. I don't know, how many yearly tries I had and people I asked, to get this little feature going.
The onlything left for me to do, is to set a conditional branch, so that the MP do not get reduced, if the party isn't dashing anymore.
I currently just check for the pressed dash button and not for "dash = true/false"
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
You can do $game_player.dash? which will return true if the party is dashing, and false if they're not.

Thanks @A-Moonless-Night for that fix! I'll add it to my post.
 

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

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,546
Members
137,835
Latest member
yetisteven
Top