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.

New status parameter

the thing is in the status screen. the thing is that i would have to get there new parameter which shows your coin throwing skills (Level per level 1-99). Here is the demo: http://www.savefile.com/files/1637315

And how it should look(Do not care about nothing else than Coin throw: 99 in the upper right corner)

http://i232.photobucket.com/albums/ee111/hegemaa/lolololoool.png[/img]

That´s the line that chrashes

Code:
  #--------------------------------------------------------------------------
  # * Get Maximum Kolikon Heitto Taito
  #--------------------------------------------------------------------------
  def maxkht
    n = [[base_maxkht + @maxkht_plus, 1].max, 99].min
    for i in @states
      n *= $data_states[i].maxkht_rate / 100.0
    end
    n = [[Integer(n), 1].max, 99].min
    return n
  end
 

khmp

Sponsor

The big thing with this is the wording of your post. Are you requesting that someone create this script for you in which case this belongs in Script Requests? I only ask because you handed us a picture detailing want you want. Or do you want to understand what you are doing wrong and what direction you should be heading in and hopefully be able to do this yourself?
 
i already have the text "Coin throwing:" in the status but i can´t get the number show after the text. it gives me error. "Script(Game_Actor)line 190.nil can't be coerced into fixnum"
and i have changed the Game_Actor so you have to load that my project to check it out.
 

khmp

Sponsor

Ok. First. Don't edit the default code. I know I said it before but it's really important to get that concept. Otherwise I have to spend time digging your code out from the original code. It's a lot less fun than it sounds. So create a new project. Or copy the Scripts.rxdata from unaltered game directory and paste it into this one. If you want to stick with your current project. You need to replace the classes you messed with for me to help. Those classes are as far as I know, Window_Status, and Game_Actor. Second. You need to realize there isn't a database entry for coin throwing built into the game. That just means that when you open your project and the database there's no Coin Throwing statistic. In your code you seem to suggest the opposite. For example you have a method in Game_Actor:
Code:
  #--------------------------------------------------------------------------
  # * Get Basic Maximum KHT
  #--------------------------------------------------------------------------
  def base_maxkht
    return $data_actors[@actor_id].parameters[0, @level]
  end
This code will get you the actor's hp.

That's not what you want. So the real question is how to include an extra stat. There's a couple ways to do this but I'm going to take you down lazy lane and use the $game_variables. You are responsible for their upkeep and modifications. But it's simple and easy to understand. We will need a couple of these in a row. One for each actor in your database. You just need to know which index you want to start at. For example let's say kht values begin at index 30. With a default project that means 8 actors so from index 30 to 38 will be your kht values. $game_variables[31] will give you the kht of actor 2. Insert an empty section above Main in the script listing and paste in this code:
Code:
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Constant Variables
  #--------------------------------------------------------------------------
  START_KHT_INDEX = 30
  #--------------------------------------------------------------------------
  # * Get KHT
  #--------------------------------------------------------------------------
  def base_kht
    return [[$game_variables[START_KHT_INDEX + (@actor_id - 1)], 0].max, 99].min
  end
end
That code above will append onto the class Game_Actor an additional method called base_kht. See we don't need to edit the original code to do it either.

Next is Window_Status. Again we don't need to override the original code we can actually alias the refresh method. Aliasing preserves the old code so that we don't destroy it when we redefine the method. You can paste this code right below the Game_Actor code I gave you above or create another empty section above Main and paste in the code.
Code:
#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
#  This window displays full status specs on the status screen.
#==============================================================================

class Window_Status < Window_Base
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias helo_cointhrowing_window_status_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    helo_cointhrowing_window_status_refresh
    self.contents.font.color = system_color
    self.contents.draw_text(320, 16, 80, 32, "Kolikon Heitto Taito:")
    self.contents.font.color = normal_color
    self.contents.draw_text(320 + 80, 16, 84, 32, @actor.base_kht.to_s, 2)
  end
end

If you are still confused about script installation refer to the FAQ. If you have any others questions let me know. Don't forget that the responsibility of manipulating the KHT values is on your shoulders. So use the "Control Variables" event command wisely.

Good luck with it Helomaa! :thumb:
 

khmp

Sponsor

Do you really want it linear like that? It'll be very obvious in how you are figuring it out. But replace the method for base_kht with this:
Code:
  #--------------------------------------------------------------------------
  # * Get KHT
  #--------------------------------------------------------------------------
  def base_kht
    return @level
  end

Good luck with it Helomaa! :thumb:
 

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