08-01-2018, 01:18 AM
(This post was last modified: 08-01-2018, 01:24 AM by BeJeremiah.)
(07-31-2018, 11:16 PM)Melana Wrote: Today I coded a window which shows all states that are currently added to the actor.
It's also possible to show this window in battle so now I'm wondering how I can show the remaining turns of each state.
I can show the total amount of lasting turns for each state with $data_states[i].hold_turn but not the remaining amount.
Example: Actor A gets the venom state which lasts for 5 turns. After 2 turns there are 3 turns left and I want to show that number in my window.
I guess it's something with @states_turn{} from Game_Battler but I'm not sure how use that.
Does anyone has any ideas how achieve that?^^
Edit: It looks like this. The "R." stands for "Runden" which means "turns"
(Yes that guy is suffering. I wanted to test how many states the window is able to display)
At the beginning of Game_Battler class add the following
Code:
attr_accessor :states_turn
This gives you access to the variable @states_turn which is created whenever you add a state. See Line 39 of Game Battler 2.
For easy access create a method to control its access since it is a Hash based on the state ID.
Some like ...
Code:
# Return the Number of state turns remaining.
def state_turns(state_id)
if @states_turn[state_id] != nil
return @states_turn[state_id]
end
end
I hope this is what you are referring to. (The "if" statement was added to the method to prevent a error in the event your state has nil turns for whatever reason, it would usually be -1 turns if not 0 or more but.. meh)