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.

Variables in skill descriptions?

Wydrah

Member

I want status/changing skills to cost items instead of MP. For example, casting Sleep would require the use of 1 Datura Seed. Is there any way I could make the description of the Sleep spell show a variable?

http://img368.imageshack.us/img368/8066/sleepyx6.png

Instead of "Set Sleep state to one enemy" I want something like "Cost is 1 Datura Seed from stock of X" where X is the variable representing how many I have.

The player could, of course, just look in the item screen before casting the spell, but I think that would be tedious.
 

Wydrah

Member

Hm...I just realized something else. If I only depend on Common Events to decrease the number of Datura Seeds every time I cast the spell, how can I stop the player from casting it when he has no Datura Seeds?

Is there a script that meets my needs?
 
There is a script for "Skills that Require Items." Try searching for it.

And no, I don't think it's possible to use variables in skill descriptions. You can try requesting a script.
 
This will substitute Variables, Item # (in the party), & Actor name in the Help Window (Description)

Paste into a new script above 'main'

Code:
#----------------------------------------------------------------------------
#
# Add Variable, Item #, & Actor Name substitution to the Help Window
#
# Brew - 19APR08
#
#----------------------------------------------------------------------------

class Window_Help
  
  alias sub_var_set_text set_text

    def set_text(text, align = 0)
      # Control text processing
      # Substitute a variables value
      begin
        last_text = text.clone
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      # Substitute an items number
      text.gsub!(/\\[Ii]\[([0-9]+)\]/) { $game_party.item_number($1.to_i) }
      # Substitute Actor Name
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end

      sub_var_set_text(text, align)
    end
end

Be Well

Ref: MonkeyDLU_Message
 

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