Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: (Hexamin) on March 06, 2010, 03:03:07 pm

Title: CMS HELP! Adding EXP/GOLD [resolved]
Post by: (Hexamin) on March 06, 2010, 03:03:07 pm
Okay, so what I'm trying to do is make a battle result window.  I've got all the aspects of it down, I just need to figure out a couple more things.  I have the whole window updating, but I run into a problem with a couple things.

1. adding gold
2. adding exp
3. not being able to exit the window until the exp and gold is added Breloom and Aqua Helped me already with this one.  Thanks guys(gals)  :D

Here's the code for the update method in my scene, that's where I think I need to put this stuff, I might be mistaken though, that's why I'm posting here.   :^_^':
 def update
  if $exp_gained != 0
    $exp_gained -= 1
    #some code to add 1 exp to player
  end
 
  if $gold_gained != 0
    $gold_gained -= 1
    #some code to add 1 gold to player
  end
 
  if $exp_gained = 0 # all i'm trying to do here is to make it so you can't
    if $gold_gained = 0 # hit escape to leave the window until the gold and
      if Input.trigger?(Input::B) # experience are both added.  it's purely
      $game_system.se_play($data_system.cancel_se) # aesthetic, but then again
      $scene = Scene_Map.new # so is most everything else about games
      end
    end
  end
end


Anyway, if you need further clarification or have any ideas, please help!  Thanks  ;)
Title: Re: CMS HELP! Adding EXP/GOLD
Post by: lilbrudder917 on March 06, 2010, 03:19:52 pm
I haven't tried this in a menu, but I just tried this above Main and it worked.

Spoiler: ShowHide

$gold = 25

loop do
if $gold != 0
  print $gold
  $gold -= 1
else
  break
end
end


So you might have better luck calculating the gold/exp with "loop do"
Title: Re: CMS HELP! Adding EXP/GOLD
Post by: (Hexamin) on March 06, 2010, 03:30:10 pm
I actually figured it out, AND I figured out how to dissect RGSS a little more by diving into the Interpretor class.  That's where I found how to do what I was trying to do.

End Result: ShowHide

 def update
   if $exp_gained != 0
     $exp_gained -= 1
     @actor.exp += 1
     #some code to add 1 exp to player
   end
   
   if $gold_gained != 0
     $gold_gained -= 1
     $game_party.gain_gold(1)
     #some code to add 1 gold to player
   end
   
   if $exp_gained == 0 && $gold_gained == 0
      if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       $scene = Scene_Map.new
     end
   end
end



Thanks for your time though!  Topic Resolved!  Til next time!