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.

Peer Review for a Script

Hello, I am currently working on a script (first script btw) and need to make sure that I am doing everything right before I go on. Any comments and suggestions would be appreciated.

Code:
#============================================================
# ** Skill Mastery System
#------------------------------------------------------------------------------
# Twilight
# Version 0.10
# 02 - 03 - 2007
#------------------------------------------------------------------------------
# * Description
# Using Ap Players can purchase and upgrade skills.
# The coder can also set up requirements for skills
#------------------------------------------------------------------------------
# Credits to SephirothSpawn, Leon, and Claimh for the script idea
#============================================================
module Skill_Mastery
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # [Skill Cost Set Up]
  # ~ Set up the default AP Cost to activate skills in this section.
  # ~ Ap Cost = { skill_id => AP }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Default_Ap_Cost = 100
  # Setup for Individual Skills
  Ap_Cost = {
    1 => 80,
    57 => 150
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # Ap Cost Rate
  # ~ Set up the default percentage rate that skill cost increase per level.
  # ~ Ap Rate = { skill_id => rate }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Default_Ap_Rate = 50
  # Setup for Individual Skills  
  Ap_Rate = {
    1 => 10,
    57 => 80
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # Skill Levels
  # ~ Set the minimum and maximum levels for skills
  # ~ Skill Level = {Skill ID => {Minimum Level, Maximum Level}}
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Default_Levels = {1, 10}
  # Setup for Individual Skills  
  Skill_Level = {
    1 => {1, 20},
    57 => {1, 10}
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # Skill Modifications per Level
  # ~ Setup what effects the skill gains after leveling up
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  Default_Sp_Cost = 10
  # ~ Skill_ID => Sp_Cost, ...
  Sp_Cost = {
    1 => -5
  }
  
  Default_Pow = 25
  # ~ Skill_ID => Skill_Power, ...
  Skill_Pow = {
    1 => 50
    57 => 80
  }
  
  Default_Acc = 2
  # ~ Skill_ID => Skill_Accuracy, ...
  Skill_Acc = {
    57 => 3
  }
  
  # Skill_ID => {Skill Level => Battle_Animation, ...}
  Bat_Anim = {
    1 => {3 => 16, 7 => 17}
  }
  
  # Skill_ID => {Skill Level => Element_ID, ...}
  Element_Add = {
  }
  
  # Skill_ID => {Skill Level => State_ID, ...}
  Add_State = {
    57 => {5 => 3}
  }
  
  # Skill_ID => {Skill Level => State_ID ...}
  Remove State = {
    1 => {5 => 3}
  }
  
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # Passive Effects: Not Implemented Yet
  # ~ Tag a skill id to have a passive effect that raises stats and guards or activates state id's
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  MaxHp = {
#  }
#  MaxSp = {
#  }
#  Str = {
#  }
#  Dex = {
#  }
#  Agi = {
#  }
#  Int = {
#  }
#  Atk = {
#  }
#  Pdef = {
#  }
#  Mdef = {
#  }
#  Eva = {
#  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # Skill Requirements: Set requirements for skills to show up in the menu. 
  # If no requirement is set, The skill will show up regularly on the list
  # ~ Skill_ID => {Required_Skill_ID => Level,...}
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Skill_Req = {
    2 => {1 => 8, 57 => 3}
  }
  end
 
A few things I can point out that need/should be changed. First off, you can get rid of all the Default_PROPERTY constants with PROPERTY.default = value. Secondly, {Skill ID => {Minimum Level, Maximum Level}} MUST be changed. You are using a Hash incorrectly here ({Minimumlevel, maximumlevel}). That should be an array ([min, max]). I'll let other scripters point out some other flaws, and good luck with your script.
 

OS

Sponsor

I agree with Yeyinde. You should replace nested Hashes with Arrays, especially when the values inside the nested Hash are not keys to other data. Other than that I can not see anything that looks wrong, but I only scanned through. Peace!
 

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