Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Hunter's guild

vrdi

Member

I think it would be cool to have a script where when you beat an enemy, you don't immediately get the gold, but you have to go to some sort of event that calls the script and lets you get money in place of the kills you've accumulated, depending on the enemy, depends on the reward.
 
Try this:
Code:
class Scene_Battle
  ID_NUMBER_GET_FUTURE_GOLD=1 #change this number for the id of a free variable
  alias start_phase5_aliased_to_not_gain_gold_directly start_phase5
  def start_phase5
    px1 = $game_party.gold
    start_phase5_aliased_to_not_gain_gold_directly
    px1 -= $game_party.gold
    $game_party.gain_gold(px1)
    $game_variables[ID_NUMBER_GET_FUTURE_GOLD] += -px1
  end
end

Change the 1 of "ID_NUMBER_GET_FUTURE_GOLD=1" for the id of a free variable.
In the event that gives you the gold put these two command events:
1st: Add gold: the number is the value of the variable used in the script (NOT the ID)
2nd: Change the variable used in the script to zero.

What do the code do is to sustract the same gold that you win (you gain zero) and put that gold in the variable.


If you want to not show the gold won in the victory, you must rewrite the class Window_BattleResult (compability problems):
Code:
class Window_BattleResult
  def refresh
    self.contents.clear
    x = 4
    self.contents.font.color = normal_color
    cx = contents.text_size(@exp.to_s).width
    self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
    x += cx + 4
    self.contents.font.color = system_color
    cx = contents.text_size("Exp").width
    self.contents.draw_text(x, 0, 64, 32, "Exp")
    #x += cx + 16
    #self.contents.font.color = normal_color
    #cx = contents.text_size(@gold.to_s).width
    #self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
    #x += cx + 4
    #self.contents.font.color = system_color
    #self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
    y = 32
    for item in @treasures
      draw_item_name(item, 4, y)
      y += 32
    end
  end
end
Change "Exp" for the word you want for experience.

Add both scripts above main and (at least) under Scene_Battle.
The first one is SDK compatible (I think). Put it under the SDK, if used.
The second it's not that versatile. Maybe, works, maybe not.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top