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.

Planning how to do the configuration of a script

Im thinking in releasing a very old script that i created when started with this. Is a dbs script that adds like 15 effects to the battle.
The code wont be perfect because i dont want to waste my time totally revamping it, but the thing is that i want to add the option that each effect is settled by actor, class, weapon, armors and games variables.

What im willing is i put a sample of all the case in all the methods or i put in the instructions and the examples all the codes and that the user copy what he need?

Code:
  #--------------------------------------------------------------------------

  # * Weapons SP drain 

  # Type of armor (0: shield, 1: helmet, 2: body armor, 3: accessory).

  #--------------------------------------------------------------------------   

  def w_spdrain

      

      n = 0

      

      # By actor id

      case @actor_id

       when 99 ; n += 0 + $game_variables[100]

      end

      

      # By actor class id

      case @class_id

       when 99 ; n += 0

      end

       

      # By Weapon

      case @weapon_id

       when 1 ; n += 0.25

      end

    

      # By shield

      case @armor1_id

       when 99 ; n += 0

      end

       

      # By helmet

      case @armor2_id

       when 99 ; n += 0

      end

       

      # By body armor

      case @armor3_id

       when 99 ; n += 0

      end

       

      # By accesory

      case @armor4_id

       when 99 ; n += 0

      end

 

      # By Event Variables

      n += $game_variables[99]

 

      return n

      

  end

 

Here is a example of that. I dont know if its better to put this in all using that 99 value as default or let the user configure it for what he uses(also it will be better for code improvments, traductions, speed and visibility).

In this case we only modifiy the weapon so it will look like:

Code:
  #--------------------------------------------------------------------------

  # * Weapons SP drain 

  # Type of armor (0: shield, 1: helmet, 2: body armor, 3: accessory).

  #--------------------------------------------------------------------------   

  def w_spdrain

      

      n = 0

     

 

      # By Weapon

      case @weapon_id

       when 1 ; n += 0.25

      end

  

 

      return n

      

  end

 

Also im planning to add some constants for some options like:

ALWAYS = 99999
NEVER = -99999

Then if you use these in some things like checking for scape rate and battle order they set these options automatically. But these constants have to be in a kernel level...
 

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