Jump to content
Shineebony

Help with a Syntax Error

Recommended Posts

Hello, I am trying to apply a Ninja Throw Script created by Locke, and when I try adding it and play running the game, I receive a syntax error. I'm sorry but could someone please inform me what 

is causing this error? 

 

 

Script: line 67: Syntax Error occurred.

 

unexpected tLBRACK, expecting ']' 

[skill.id]])

 

 

 

EDIT: Oops I didnt mean to post my question here. My apologies but could someone please abolish or lock this post?

Share this post


Link to post
Share on other sites

I am well aware of this particular script as it was made for me, well, not exclusively but was made with myself being the first copy recipient.

Since that script requires the modifications done in-script, I need to see the full script in order to diagnose the issue.

Also, you posted in the proper place.

Share this post


Link to post
Share on other sites


=begin
 Ninja Throw script by LockeZ
 Allows any skill to consume either an item or a weapon
 Utilize for whatever you want, no credit necessary
 
This script does not use notetags, because screw you. Instead, near the top of
the script is a place to put lines indicating which skills require
which items/weapons. There are some example lines which you may delete. 

This script could also be used for any other type of skill 
which consumes an item, such as gun or bow skills that require ammo,
or spells that require reagents. Weapons which are equipped cannot be thrown.
If you use this script to make a skill use up an item,
it can also still cost MP or TP like any other skill. 

It is recommended that you name the skills the same names
as the weapons/items being thrown, since the cost is not shown.
If you want to show the cost, just put it in the skill's name. 

Unlike Final Fantasy, skills appear in your skill list whether you own the item
or not, they're just grayed out if you don't have enough items to throw them.
This allows you to teach the player these skills any way you want,
so for example you might require a character to pay gold at a trainer to learn 
the ability to throw mythril swords. If you want to dynamically add and remove 
skills based on the player's inventory, like Final Fantasy, 
then do that your own damn self with a common event.

Copy and paste the following 
@ninja_throw_skill_items[x] = v
@ninja_throw_skill_weapons[x] = v

where x is the ID of the skill
and v is the ID of the item/weapon

=end

class Game_BattlerBase
  attr_accessor :ninja_throw_skill_items
  attr_accessor :ninja_throw_skill_weapons
  
  alias ninja_throw_initialize initialize
  def initialize
    @ninja_throw_skill_items = {}
    @ninja_throw_skill_weapons = {}
    
    # Add your game's skills that use up items below this line.
    # Examples follow.
    @ninja_throw_skill_items[30] = 3     # Skill #30 requires item #3
    @ninja_throw_skill_items[31] = 5     # Skill #31 requires item #5
    @ninja_throw_skill_weapons[32] = 5     # Skill #32 requires weapon #5
    
    ninja_throw_initialize
  end
  
  alias ninja_throw_skill_cost_payable? skill_cost_payable?
  def skill_cost_payable?(skill)
    if @ninja_throw_skill_items[skill.id] != nil
      unless $game_party.has_item?($data_items[@ninja_throw_skill_items[skill.id]])
        return false
      end
    end
    
    if @ninja_throw_skill_weapons[skill.id] != nil
      unless $game_party.has_item?($data_weapons[@ninja_throw_skill_weapons

[skill.id]])
        return false
      end
    end
    
    ninja_throw_skill_cost_payable?(skill)
  end
  
  alias ninja_throw_pay_skill_cost pay_skill_cost
  def pay_skill_cost(skill)
    if @ninja_throw_skill_items[skill.id] != nil
      $game_party.lose_item($data_items[@ninja_throw_skill_items[skill.id]], 1)
    end
    
    if @ninja_throw_skill_weapons[skill.id] != nil
      $game_party.lose_item($data_weapons[@ninja_throw_skill_weapons[skill.id]], 1)
    end
    
    ninja_throw_pay_skill_cost(skill)
  end
end

Share this post


Link to post
Share on other sites

Where you have this:

    if @ninja_throw_skill_weapons[skill.id] != nil
      unless $game_party.has_item?($data_weapons[@ninja_throw_skill_weapons
[skill.id]])
        return false
      end
    end

backspace the [skill.id]]) line into the previous one to get this:

    if @ninja_throw_skill_weapons[skill.id] != nil
      unless $game_party.has_item?($data_weapons[@ninja_throw_skill_weapons[skill.id]])
        return false
      end
    end

 

Not sure why, nor how that line got split that way in the first place, just merge it back.

 

 

Also I have moved your thread to appropriate place, no worries, it's all fine.

  • Like 2

Share this post


Link to post
Share on other sites

I know why that happened.

It's this evil side effect of a very useful-otherwise feature of notepad called Word Wrap.

  • Eyes 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted