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.

Script Error

I am using Fomar's FFV system script, but I keep encountering this error:

"comparison of Fixnum with nil failed"

on Line 407.

The script around that area reads,

Code:
def job_level(job_hunt = @job_current)
    unless job_hunt == unemployed_name
      for job in @job_history
        if job['name'] == job_hunt
          ap = job['ap']
          lvl = 0
          job_advert = get_job(job_hunt)
          for i in 1...job_advert['max_lvl'] + 1
            key = 'lvl' + i.to_s
            if ap >= job_advert[key]
              ap -= job_advert[key]
              lvl += 1
            end
          end
          return lvl
        end
    end
  end
    return 0
  end

Can anyone tell me what's going on? Or rather, why can't scripting language be more user-friendly?
 
Well if that's the line then you probably haven't set up the constants correctly.
Post them. (they looks like this):
Code:
 Jobs = [
  {'name'=>"Knight", 'command'=>'!Defend',
  'max_lvl'=>6, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'style1'=>'Sword', 'style2'=>'Shield', 'style3'=>'Armour'
  },
  {'name'=>"Mage", 'command'=>'!Skill',
  'max_lvl'=>6, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>100,
  'ability1'=>'!Skill', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Staff', 
  'HP'=>0,'SP'=>20,'STR'=>0,'DEX'=>0,'INT'=>20,'AGI'=>10,
  'style1'=>'Staff', 'style2'=>'Robe', 'style3'=>'Cloak'
  },
  
  ]
 
Okay, but then where would this line go:
Code:
'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil

It was in that array in the demo version of the script, and it seems to be giving me trouble now. It's also a line I particularily would like to use.
 
This was how it was set up:

Code:
Jobs = [
  {'name'=>"Knight", 'command'=>'!Defend',
  'max_lvl'=>6, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"Mage", 'command'=>'!Ice-Skill',
  'max_lvl'=>6, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>100,
  'ability1'=>'!Skill', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Staff', 
  'HP'=>0,'SP'=>20,'STR'=>0,'DEX'=>0,'INT'=>20,'AGI'=>10,
  'style1'=>'Staff', 'style2'=>'Robe', 'style3'=>'Cloak',
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  }
  
  ]
 
Actually, it seems to be working now...
The thing is, I had added around 12 classes, and I didn't realize that I needed to add those to the "update actor graphics" section.

But I would still like to know how to keep the
Code:
'style1'=>'Sword', 'style2'=>'Shield', 'style3'=>'Armour'
section into it, as it seems to be giving problems.

Here's the constants I edited:

Code:
Jobs = [
  {'name'=>"Warr", 'command'=>'!Defend',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"RMage", 'command'=>'!Fire Magic',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Skill', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Staff', 
  'HP'=>0,'SP'=>20,'STR'=>0,'DEX'=>0,'INT'=>20,'AGI'=>10,
  'style1'=>'Staff', 'style2'=>'Robe', 'style3'=>'Cloak',
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"BMage", 'command'=>'!Water Magic',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"CMage", 'command'=>'!Ice Magic',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"SMage", 'command'=>'!Stone Magic',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"GMage", 'command'=>'!Growth Magic',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"WMage", 'command'=>'!Wind Magic',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"YMage", 'command'=>'!Thunder Magic',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"WhMage", 'command'=>'!Light Magic',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"BlMage", 'command'=>'!Dark Magic',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"Rogue", 'command'=>'!Defend',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>nil, 'lvl_needed'=>nil, 'gender'=>nil
  },
  {'name'=>"Glad", 'command'=>'!Defend',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>"Warr", 'lvl_needed'=>8, 'gender'=>nil
  },
  {'name'=>"DSlay", 'command'=>'!Defend',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>"Warr", 'lvl_needed'=>8, 'gender'=>nil
  },
  {'name'=>"Knight", 'command'=>'!Defend',
  'max_lvl'=>8, 'lvl1'=>10, 'lvl2'=>20, 'lvl3'=>30, 'lvl4'=>40, 'lvl5'=>50, 'lvl6'=>60, 'lvl7'=>70, 'lvl8'=>100,
  'ability1'=>'!Defend', 'ability2'=>nil, 'ability3'=>nil, 'ability4'=>nil, 'ability5'=>nil, 'ability6'=>'Equip Sword', 
  'HP'=>20,'SP'=>0,'STR'=>20,'DEX'=>10,'INT'=>0,'AGI'=>0,
  'job_needed'=>"Glad", 'lvl_needed'=>8, 'gender'=>nil
  },
  
  ]
(Many of the classe are abbreviations)

Sorry to bother you further, but I also would like to know how to make the "Knight" class require both "DSlay" and "Glad", if this is possible.

Thanks for all your help!:D
 

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