Newbie needs help with tutorial 3.5

Status
Not open for further replies.

Tealdragon

Villager
Member
Joined
Jul 3, 2012
Messages
5
Reaction score
1
First Language
English
Primarily Uses
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.
 
Last edited by a moderator:

Lunarea

Artist
Global Mod
Joined
Mar 1, 2012
Messages
8,840
Reaction score
7,797
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. :)
 
Last edited by a moderator:

Warpmind

Twisted Genius
Veteran
Joined
Mar 13, 2012
Messages
936
Reaction score
578
First Language
Norwegian
Primarily Uses
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...
 

Tealdragon

Villager
Member
Joined
Jul 3, 2012
Messages
5
Reaction score
1
First Language
English
Primarily Uses
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
 
Last edited by a moderator:

Warpmind

Twisted Genius
Veteran
Joined
Mar 13, 2012
Messages
936
Reaction score
578
First Language
Norwegian
Primarily Uses
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.
 

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
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?
 

Tealdragon

Villager
Member
Joined
Jul 3, 2012
Messages
5
Reaction score
1
First Language
English
Primarily Uses
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 :)
 

Ministry

Villager
Member
Joined
Jun 27, 2012
Messages
17
Reaction score
9
First Language
English
Primarily Uses
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.
 

Sliktor

Warper
Member
Joined
Apr 17, 2012
Messages
1
Reaction score
3
First Language
English
Primarily Uses
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.

#===============================================================================
# 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:
 

Ministry

Villager
Member
Joined
Jun 27, 2012
Messages
17
Reaction score
9
First Language
English
Primarily Uses
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.
 

Tealdragon

Villager
Member
Joined
Jul 3, 2012
Messages
5
Reaction score
1
First Language
English
Primarily Uses
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 ^_^
 

Ministry

Villager
Member
Joined
Jun 27, 2012
Messages
17
Reaction score
9
First Language
English
Primarily Uses
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:

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).
 

Tealdragon

Villager
Member
Joined
Jul 3, 2012
Messages
5
Reaction score
1
First Language
English
Primarily Uses
That's a great solution, and a bit easier than adding a script. Thank you for all your help.
 

Snacktaveous

Warper
Member
Joined
Aug 24, 2013
Messages
4
Reaction score
1
First Language
English
Primarily Uses
Thank you, Sliktor. 

I was having the same problem as everyone else here and your revised script made my battles playable again! :D
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top