Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 General Methods XP VX & ACE
#7
This post includes two new features for Game_Variables and Game_Switches respectively.

Manually Calculate with Multiple Game_Variables!

Happy with a sweat I know that the event commands allow you to add two game variables at a time.

Even so, don't you think Thinking that it would be convenient to add or subtract or multiply or even divide by many game variables in a row?

Shocked Now you can do it!

Code:
# * Game Variables Addons

class Game_Variables
  def data(var_id) @data[var_id] || 0 end

  def add(*ids)
    ids.inject(0){|n, vid| n + data(vid) }
  end

  def subtract(*ids)
    ids.inject(0){|n, vid| n - data(vid) }
  end

  def multiply(*ids)
    ids.inject(0){|n, vid| n * data(vid) }
  end

  def divide(*ids)
    ids.inject(0){|n, vid| n / data(vid) }
  end
  private :data
end

The new methods for $game_variables are:
  • add
  • subtract
  • multiply
  • divide
You can pass them as many ID's or positions as you wish! Grinning


Toggle Your Game_Switches!

Code:
# * Game_Switches Addon

class Game_Switches
  def toggle!(*ids)
    ids.each{|sid| @data[sid] = !@data[sid] }
  end
end

Just call the method:

$game_switches.toggle!(ID1, ID2, etc.)

...and those Game_Switches will get their inverted boolean value in no time! Shocked
"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 }


Messages In This Thread
General Methods XP VX & ACE - by kyonides - 10-23-2019, 11:23 PM
RE: General Methods XP - by kyonides - 07-06-2020, 04:24 AM
RE: General Methods XP - by kyonides - 08-02-2020, 02:39 AM
RE: General Methods XP - by kyonides - 08-22-2020, 03:01 AM
RE: General Methods XP - by kyonides - 12-31-2021, 08:50 PM
RE: General Methods XP VX & ACE - by kyonides - 03-30-2022, 07:35 PM
RE: General Methods XP VX & ACE - by kyonides - 11-11-2022, 01:04 AM
RE: General Methods XP VX & ACE - by kyonides - 11-17-2022, 11:31 PM
RE: General Methods XP VX & ACE - by kyonides - 12-02-2022, 04:33 AM
RE: General Methods XP VX & ACE - by kyonides - 03-08-2023, 08:22 AM
RE: General Methods XP VX & ACE - by kyonides - 05-16-2023, 08:24 PM
RE: General Methods XP VX & ACE - by kyonides - 06-01-2023, 08:59 PM
RE: General Methods XP VX & ACE - by kyonides - 06-17-2023, 02:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   GMG: The General Monster Generator DerVVulfman 3 10,022 02-26-2011, 04:49 AM
Last Post: DerVVulfman
   Additional Bitmap Methods untra 4 9,291 06-04-2010, 03:55 AM
Last Post: untra



Users browsing this thread: