Remaining turns of states
#2
(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"

[Image: n1bwLwh.png]

(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)
Reply }


Messages In This Thread
Remaining turns of states - by Mel - 07-31-2018, 11:16 PM
RE: Remaining turns of states - by BeJeremiah - 08-01-2018, 01:18 AM
RE: Remaining turns of states - by Mel - 08-01-2018, 12:46 PM
RE: Remaining turns of states - by kyonides - 08-01-2018, 02:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Scan skill should show states Tumen 5 9,214 05-02-2017, 03:33 AM
Last Post: DerVVulfman
  Expiration States with Atoa acbs: error Noctis 5 9,267 02-18-2017, 01:10 AM
Last Post: DerVVulfman
   Where are states located? Yin 9 13,317 05-17-2009, 07:05 PM
Last Post: DerVVulfman



Users browsing this thread: 1 Guest(s)