Newbie needs help with tutorial 3.5

● ARCHIVED · READ-ONLY
Started by Tealdragon 15 posts View original ↗
  1. I just purchased RPG Maker VX Ace a couple days ago and I've been working my way through the tutorials posted on the site. For the most part the tutorials are easy to follow and I haven't had any issues with the instructions.

    However, I'm having a technical issue with "Make Your Own Game Part 3.5 - Script Use and Note Tags." Whenever I install the script that's included with the tutorial (Skill Self Effects By Jet10985) and then try a battle (either in the Troops tab of the database or in a real game) I get the following error: Script 'Skill Self Effects' line 37: NoMethodError occurred. undefined method '[]' for nil:NilClass.

    I did some research on the forums, and I discovered that maybe my changes to the database could be the issue, so I tried the script in a new project using the default database with no changes and the same thing occurs. Has anyone else had this issue? If so is there a solution or could someone with more experience point me in the right direction as to what I may be doing wrong?

    Thank you in advance for any help you can give.
  2. I am not sure whether this is a script issue or a general support issue, but since it's centered around a script, I moved it to RGSS support. Also, added Ace tag to title.

    Hopefully, one of our resident scripters will be able to help. :)
  3. Isn't that script provided without the necessary figures? I mean, it looks to me as though it lacks the references and numbers to calculate...
  4. Here's the full script as downloaded from the site. I'm afraid I don't know anything about Ruby or Scripting. I did follow the instructions and understand how to use the notetags, but I don't understand why I'm getting an error.



    Code:
    #===============================================================================
    # Skill Self Effects
    # By Jet10985 (Jet)
    # Requested by Touchfuzzy
    #===============================================================================
    # This script will allow you to specify a skill's effects tot arget the user
    # instead of the target, on skills that don't already effect the user.
    # This script has: 0 customization options.
    #===============================================================================
    # Overwritten Methods:
    # None
    #-------------------------------------------------------------------------------
    # Aliased methods:
    # Game_Battler: item_effect_apply
    #===============================================================================
    =begin
    To specify the effects, use this notetag in the skill's notebox:
    
    <self effect: 1>
    or
    <self effect: 1, 2, 3> to specify more than 1 effect
    --------------------------------------------------------------------------------
    Use of this script could be as the following.
    
    You make a "Berserk Strike" skill, which does 200% damage to an enemy.
    You make the 2nd effect "Defense Down 50%" and want it applied to the user.
    You'd use this notetag: <self effect: 2>
    =end
    
    class RPG::Skill
    
      def self_effects
    	if @self_effects.nil?
    	  @self_effects = []
    	  self.note.each_line {|a|
    		scan = a.scan(/<self[ ]*effect[ ]*\:[ ]*(\d+(?:[ ]*,[ ]*\d+)*)>/i)
    		scan[0][0].scan(/\d+/).each {|b|
    		  @self_effects.push(@effects[b.to_i - 1]) if b.to_i >= 1
    		}
    	  }
    	end
    	@self_effects
      end
    end
    
    class Game_Battler
    
      alias jet3745_item_effect_apply item_effect_apply
      def item_effect_apply(user, item, effect, reffed = false)
    	if item.is_a?(RPG::Skill) && item.self_effects.include?(effect) && !reffed
    	  user.item_effect_apply(user, item, effect, true)
    	  return
    	end
    	jet3745_item_effect_apply(user, item, effect)
      end
    end
  5. Yeah, that script contains everything but the numbers.

    I do believe you're supposed to take the lines between class RPG::Skill and class Game_Battler, copy that bit of script for as many effects you want/need, and input the numerical effects into the brackets in the formula. Oh, and probably the effect number on the line with @self_effects = [] as well.

    While I haven't tested it yet (working on the calculations with pencil and paper so far; prefer it that way), it certainly seems logical, in context of my understanding of the scripting language.
  6. The problem that occurs is, that it searches for the notetag even if the skill doesn't have it, try putting this above the line producing the error:



    Code:
    next if scan.nil?
  7. Okay, I tried putting 'next if scan.nil?' before the error producing line, but I'm still getting the same error.

    Without an example of where to insert the skill #'s I don't think I'll have much luck with your suggestion Warpmind. I'll need to try and learn a bit about Ruby first. There are six empty brackets in that code, and it would take a lot of trial and error for a newb like me to figure out what # goes where.

    Thanks for the fast replies though. I've been poking around the forums and this seems like a really positive and helpful community :)
  8. I am also having this same issue. "Lunge" is one of 2 skills in the tutorial that use this script. This skill deals damage through a formula and has 1 effect that adds the "Lunge Effect" state 100% of the time. This state lasts 1 turn and reduces DEF. So the skill gets a notetag of <self effect: 1>.

    With this in mind, I tested many ways of plugging the number "1" into the brackets and the '@self_effects = []' line. I've tested with and without the 'next if scan.nil?' line. I've even tried with and without copying and pasting the 'class RPG::Skill' lines a few times (even though they shouldn't be needed) and plugging "2" and "3" into their respective copies. Still no joy.

    I'm really eager to get this script working as it really opens up a lot of possibilities for interesting skills (and the official tutorial should really be void of any game-crashing problems such as this ;) ). Has anybody had any luck solving this one? I'd rather not have to learn scripting until I'm more comfortable in VX Ace altogether.

    As a side note to Tealdragon, you should try working through the VX tutorials. Almost everything covered there still applies to VX Ace. You'll have to make some substitutions from time to time (like using "Magic Attack" and "Magic Defense" instead of "Spirit") but it's a completed tutorial and good to get you oriented with the basics.
  9. This script works fine when the note field is empty or only has the valid notetags for this script, but anything else and it threw a fit. I made a small addition that will cause it to ignore any exceptions when checking the notetags for this script, instead of throwing an error, it will just keep on going. I tested this on a blank project and it worked fine, but if anything creeps up, let me know.

    Here, replace the code with this one.

    Spoiler
    #===============================================================================
    # Skill Self Effects
    # By Jet10985 (Jet)
    # Requested by Touchfuzzy
    #===============================================================================
    # This script will allow you to specify a skill's effects tot arget the user
    # instead of the target, on skills that don't already effect the user.
    # This script has: 0 customization options.
    #===============================================================================
    # Overwritten Methods:
    # None
    #-------------------------------------------------------------------------------
    # Aliased methods:
    # Game_Battler: item_effect_apply
    #===============================================================================
    =begin
    To specify the effects, use this notetag in the skill's notebox:
    <self effect: 1>
    or
    <self effect: 1, 2, 3> to specify more than 1 effect
    --------------------------------------------------------------------------------
    Use of this script could be as the following.
    You make a "Berserk Strike" skill, which does 200% damage to an enemy.
    You make the 2nd effect "Defense Down 50%" and want it applied to the user.
    You'd use this notetag: <self effect: 2>
    =end
    class RPG::Skill
    def self_effects
    if @self_effects.nil?
    @self_effects = []
    self.note.each_line {|a|
    scan = a.scan(/<self[ ]*effect[ ]*\:[ ]*(\d+(?:[ ]*,[ ]*\d+)*)>/i)
    begin
    scan[0][0].scan(/\d+/).each {|b|
    @self_effects.push(@effects[b.to_i - 1]) if b.to_i >= 1
    }
    rescue Exception => e
    end
    }
    end
    @self_effects
    end
    end
    class Game_Battler
    alias jet3745_item_effect_apply item_effect_apply
    def item_effect_apply(user, item, effect, reffed = false)
    if item.is_a?(RPG::Skill) && item.self_effects.include?(effect) && !reffed
    user.item_effect_apply(user, item, effect, true)
    return
    end
    jet3745_item_effect_apply(user, item, effect)
    end
    end

    Code:
  10. Thank you Sliktor. I replaced your updated script and it no longer crashes. I'm sure Tealdragon will be happy about this too.

    I'm sure that, some day, I will understand what you did and why it helped.

    I've left a reply on the tutorial to let him know we've found a problem, Sliktor fixed it, and that the tutorial should be updated with the corrected script.
  11. Thank you for the assitance Sliktor, I just grabbed the new script and am about to try it out.

    Also thank you Ministry for mentioning the VX tutorial. The assistance and advice is much appreciated ^_^
  12. I was digging around for a solution to my conditional skill effects problem and I stumbled upon this helpful little Formula tutorial:

    http://cobbtocs.co.uk/wp/?p=271

    In particular, this part was most interesting:

    Spoiler
    Scenario: I want a skill to add an effect on the user e.g. exhaustion.Not too hard.

    a.add_state(2); a.atk * 4 – b.def * 2

    Could also have it damage the user etc
    So instead of needing a whole script to add a state to the user, you just put "a.add_state(x)" into the formula (where x is the number of the state).
  13. That's a great solution, and a bit easier than adding a script. Thank you for all your help.
  14. Thank you, Sliktor. 

    I was having the same problem as everyone else here and your revised script made my battles playable again! :D
  15. No need to necro a thread just to say thank you.