PP script?

Sephiron

Nyarlathotep's second cousin, twice removed.
Member
Joined
Feb 1, 2013
Messages
27
Reaction score
11
First Language
Engrish


For the vast majority here who have played the pokemon games, you probably know what I'm talking about, but I'll explain it anyways. I'm not sure if something like this is easy to implement or not, but I guess it's worth asking about!
So technically what I want is a battle script that makes your skills have restricted uses. Each skill has a number of times it can be used during battle until you make it to a town to rest (Perhaps through a script call?). Instead of relying on the character's maximum MP, each skill will have a specified amount of uses determined by either the MP cost or through skill notes. Here's a few mockups; Oh, and thanks a ton in advanced! I could really use help on this, guys.  Even if you can't write any scripts, I would still very much appreciate any additional ideas or alternative scripts so we can keep this bumped up. I will be using this with a skill equip script and I'll be removing the regular attack button in the battle scene.

mockup1.png

mockup2.png
 

Sephiron

Nyarlathotep's second cousin, twice removed.
Member
Joined
Feb 1, 2013
Messages
27
Reaction score
11
First Language
Engrish
Well, I did find this but I don't think it's really what I need. It seems to be a bit more complicated than I need it to be. Because I'm not making a pokemon game, I don't want to change the original battle system too much; I want the battle phases to be the same as the default battle system (Such as having 4 or so characters battling at the same time, not having to switch characters individually). I also have no need of the trainers mechanic, and unfortunately it doesn't seem like you can disable any of these features.

The only thing I really need out of that script is the PP system (it doesn't actually look like this script has one either, which is odd for a pokemon battle system...)

I appreciate the recommendation though! It's not looking like this has been done yet. If someone isn't up to making it for me I might have to find a weird alternative, like using actor-specific skills and assigning a PP variable to each one. Not looking forward to that lol.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Maybe I just don't play enough Pokeman to understand, but how is PP different than MP anyways? Either way you have a finite resource that depletes over time. Couldn't you just do the same thing by calling MP PP and then restricting or eliminating all items that restore that resource?
 

Sephiron

Nyarlathotep's second cousin, twice removed.
Member
Joined
Feb 1, 2013
Messages
27
Reaction score
11
First Language
Engrish
Maybe I just don't play enough Pokeman to understand, but how is PP different than MP anyways? Either way you have a finite resource that depletes over time. Couldn't you just do the same thing by calling MP PP and then restricting or eliminating all items that restore that resource?
Well, MP is a global resource for that character- Every skill subtracts from the character's MP pool until it's completely empty and they can't cast any more spell, right? PP is a lot different in the sense that there is no global pool that the skills can use. Instead, each skill has a limited number of uses until it can't be used anymore. Say you have two skills: One skill is fireball, and the other is lightning. Fireball has 30 uses and lightning has 15. Once you use lightning 15 times, you can't use it anymore; But that doesn't mean you're defenseless. Fireball still has 30 uses. If it were mana, you could use both freely as long as you have enough MP.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Got it. So does this apply to everyone that has that skill then? Or just that character? If that character it sounds kind of similar to the old D and D spell memorization system, and there should be a script for that. If it is for all uses of that sills across all actors, then you probably need something else.

@Andar: That won't work, the limited uses resets after every battle. I think the OP wants it to not reset until you rest.
 

Sephiron

Nyarlathotep's second cousin, twice removed.
Member
Joined
Feb 1, 2013
Messages
27
Reaction score
11
First Language
Engrish
 

God, that is very useful and so close to what I need. I'll probably end up using this for other purposes, but like bgillisp said after you, the limited uses are replenished after battle. It's starting to sound more complicated than I originally thought, lol. Thanks a ton.

 

Got it. So does this apply to everyone that has that skill then? Or just that character? If that character it sounds kind of similar to the old D and D spell memorization system, and there should be a script for that. If it is for all uses of that sills across all actors, then you probably need something else.

@Andar: That won't work, the limited uses resets after every battle. I think the OP wants it to not reset until you rest.
Yea, the skill applies just to the character and not across all actors. I guess it's a lot like the spell system in Dungeons and dragons, or even like baldur's gate for those who have played it (I think they have the same ruleset, actually). The only difference is that the skills have a set maximum number of uses. I'm using another script to choose your skills, and I just need a script to limit their usage.

I'm thinking that because Yanfly's script has the ability to interact with variables, it would be easier to implement what I want to do across all actors... but yeah, I just don't want that  ;_;
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,309
Reaction score
531
First Language
indonesian
find this in yanfly script:

class Game_Battler < Game_BattlerBase   #--------------------------------------------------------------------------  # alias method: on_battle_start  #--------------------------------------------------------------------------  alias game_battler_on_battle_start_srs on_battle_start  def on_battle_start    game_battler_on_battle_start_srs    reset_cooldowns    reset_times_used  enddelete the reset_times_used line (or just add #before the line to make it comment)

if you want the cooldowns not resetting at battle start. add # before the reset_cooldowns

edit: you might want to add some script call to reset the times used in your 'recover' event.

$game_actor[1].reset_times_usedto reset actor 1 skill usage

to reset whole party

$game_party.members.each do |act|  act.reset_times_usedendbut it reset whole skill. not specific skill. so if you want some item that can recover only 1 skill pp... you might need another edit to the scripts.

also.. the cystal pokemon battle have some stripped down version of only pp mech

https://crystalnoel42.wordpress.com/2013/01/07/crystal-engine-move-limit/

edit2: sorry i think the script is not what you need... i misread the script :D .
 
Last edited by a moderator:

Sephiron

Nyarlathotep's second cousin, twice removed.
Member
Joined
Feb 1, 2013
Messages
27
Reaction score
11
First Language
Engrish
find this in yanfly script:

class Game_Battler < Game_BattlerBase   #--------------------------------------------------------------------------  # alias method: on_battle_start  #--------------------------------------------------------------------------  alias game_battler_on_battle_start_srs on_battle_start  def on_battle_start    game_battler_on_battle_start_srs    reset_cooldowns    reset_times_used  enddelete the reset_times_used line (or just add #before the line to make it comment)

if you want the cooldowns not resetting at battle start. add # before the reset_cooldowns

edit: you might want to add some script call to reset the times used in your 'recover' event.

$game_actor[1].reset_times_usedto reset actor 1 skill usage

to reset whole party

$game_party.members.each do |act|  act.reset_times_usedendbut it reset whole skill. not specific skill. so if you want some item that can recover only 1 skill pp... you might need another edit to the scripts.

also.. the cystal pokemon battle have some stripped down version of only pp mech

https://crystalnoel42.wordpress.com/2013/01/07/crystal-engine-move-limit/

edit2: sorry i think the script is not what you need... i misread the script :D .
Actually, this is precisely what I need lol. The script only calls it more than once, so you need to delete the reset line twice. Thanks a lot man, this is perfect! Makes me feel like an idiot :s I assumed that because it's reset every time it must not be recorded, and would need some complicated extra features.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
You might run into another issue though. As far as I know, the limited uses are not saved, so if someone saves their game then loads it, the PP will reset. Of course, if you restrict saving to fixed locations that restore your PP then it is a non-issue.
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,309
Reaction score
531
First Language
indonesian
You might run into another issue though. As far as I know, the limited uses are not saved, so if someone saves their game then loads it, the PP will reset. Of course, if you restrict saving to fixed locations that restore your PP then it is a non-issue.
i think it's saved. since it stored in Game_Actor instance object which stored in $game_actors

and $game_actors is saved to savefile. but i think maybe op should try it first. maybe i'm wrong
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
I think it has to be an attr_accessor to be saved actually. Instance variables stay for that instance of the class, and are not saved. At least that's how it has been for me for all other Yanfly scripts I use (like the passive states script. If you add a passive state mid game, it's lost once you load a game as they were saved as instance variables).

But, agreed, let's let the OP test it and see. I might be totally wrong here.
 
Last edited by a moderator:

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,309
Reaction score
531
First Language
indonesian
I think it has to be an attr_accessor to be saved actually. Instance variables stay for that instance of the class, and are not saved. At least that's how it has been for me for all other Yanfly scripts I use (like the passive states script. If you add a passive state mid game, it's lost once you load a game as they were saved as instance variables).

But, agreed, let's let the OP test it and see. I might be totally wrong here.
every @ variable should be saved to the instance object.

attr_accessor is mainly creating method to change it from outside without using variable_set.

also yanfly passive state script work even we load the game... and i don't think his script can add new passive state dynamically mid game.

(unless equiping something with passive states notetags. which btw work fine too by loading the game :D ...),

maybe you have modified version of his script?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Nope, I just tried to push a new state into the array (by a script call). When I loaded the game, it was not saved. So I can confirm that the array of all passive states on an actor is not saved. Instead, it is read every time you load a game via his loadnotetags call (since Yanfly set it up to read them every time you load a game). So it appears as if it is saved, but it is not. You can also confirm this by adding a new passive state then loading a save game, the new state will suddenly be there. If it were saved with the actor data, that would not work.

And its an unmodified script. I have a feeling the same issue will arise with the limited uses, as you can suddenly add it to a skill, and it will be there on an old save game, despite it not being there before.
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,309
Reaction score
531
First Language
indonesian
Nope, I just tried to push a new state into the array (by a script call). When I loaded the game, it was not saved. So I can confirm that the array of all passive states on an actor is not saved. Instead, it is read every time you load a game via his loadnotetags call (since Yanfly set it up to read them every time you load a game). So it appears as if it is saved, but it is not. You can also confirm this by adding a new passive state then loading a save game, the new state will suddenly be there. If it were saved with the actor data, that would not work.

And its an unmodified script. I have a feeling the same issue will arise with the limited uses, as you can suddenly add it to a skill, and it will be there on an old save game, despite it not being there before.
ah... that script not designed to be able to add something in game....

apparently yanfly initialize the @passive_states every times we called Game_Actor_instance_object.states

in this code (and he didn't use @ variable here)...

  def passive_states    array = []   #<<<<<<<<<<<<<this line    if actor?      for state_id in self.actor.passive_states        array.push($data_states[state_id]) if passive_state_addable?(state_id)      end      for state_id in self.class.passive_states        array.push($data_states[state_id]) if passive_state_addable?(state_id)      end      for equip in equips        next if equip.nil?        for state_id in equip.passive_states          array.push($data_states[state_id]) if passive_state_addable?(state_id)        end      end    else # enemy      for state_id in self.enemy.passive_states        array.push($data_states[state_id]) if passive_state_addable?(state_id)      end      if $imported["YEA-Doppelganger"] && !self.class.nil?        for state_id in self.class.passive_states          array.push($data_states[state_id]) if passive_state_addable?(state_id)        end      end    end    create_passive_state_array(array)    sort_passive_states(array)    set_passive_state_turns(array)    return array  endthus adding it ingame dynamically without the object that have passive states notetags will get wiped at that process.

(just theory)

btw just do some quick test :D

class Game_Actor  def xomg    return @xomg if @xomg    @xomg = 0    return @xomg  end  def do_xomg    @xomg = 0 if !@xomg    @xomg += 1  endendthe @xomg is saved to the savefile :D ...
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Now that would make sense then! Thanks. Though this side discussion might have helped me fix a bug in my game now.

Back on topic: OP, is it solved now?
 

Sephiron

Nyarlathotep's second cousin, twice removed.
Member
Joined
Feb 1, 2013
Messages
27
Reaction score
11
First Language
Engrish
Now that would make sense then! Thanks. Though this side discussion might have helped me fix a bug in my game now.

Back on topic: OP, is it solved now?
Guys, I'm so sorry! I've been celebrating holy week with my family, and I forgot about this topic xD

But yes, I just tried Estriole's fix and it works! everything is saved onto the save file. It looks like this is solved! 

Thanks so much. If there's anything I can do in return (Tilesets or eventing perhaps?) Just message me, I'd be glad to help in return.
 

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

Latest Threads

Latest Profile Posts

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.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,072
Members
137,578
Latest member
JamesLightning
Top