Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Remaining turns of states
#1
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)
Reply }
#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 }
#3
Thank you very much!
This helped me alot.
Reply }
#4
I wonder if something like @states_turn[state_id] || 0 wouldn't do the job there... Confused
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }


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



Users browsing this thread: