Save-Point
Scripting I think - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Scripting I think (/thread-349.html)



Scripting I think - spazfire - 04-10-2010

Hi! I'm completely new to this so I apologize if this is in the wrong area. I was wondering if anyone knew what
Script 'Game_Event' line 30: NoMethodErroroccured
undefined method 'moveto' for #<Game_Event:ox19e9eeo
meant?


Scripting I think - afters - 04-10-2010

Your script is trying to call a method "moveto" in the script at line 30, but that method does not exist in the Game_Event class. Paste the code here if you can't fix it yourself and I'll see what I can do.


Scripting I think - spazfire - 04-10-2010

#--------------------------------------------------------------------------
# * Object Initialization
# map_id : map ID
# event : event (RPG::Event)
#--------------------------------------------------------------------------
def initialize(map_id, event)
super()
@map_id = map_id
@event = event
@id = @event.id
@erased = false
@starting = false
@through = true
# Move to starting position
moveto(@event.x, @event.y)
refresh
end


Scripting I think - spazfire - 04-11-2010

can anyone at least tell me what a method is? I really don't want to lose all of the work I've done.


Scripting I think - DerVVulfman - 04-11-2010

Whenever you see a block of code in a 'class', it is referred to as a method.
Code:
class My_Example
  def my_method(variable)
    statement in the method
    statement in the method
    statement in the method
  end
end

You showed the initialize method in Game_Event. It calls forth the moveto method as it should.

So, I have a couple questions. Are you using a new script? Are you directly editing the scripts in your project? and Did you delete/change the moveto method in Game_Event?


Scripting I think - spazfire - 04-11-2010

The only new script i was trying was one for staring items but i could get it to work so i deleted it. I tried opening a new project and looking at the script in case it was affected but it is the same as the default. I didn't directly touch anything either


Scripting I think - Jaberwocky - 04-12-2010

First, check to make sure that Game_Event starts with 'class Game_Event < Game_Character'
If it doesn't, there's your problem.
If it does, open the script editor, ctrl+shift+f, type 'def moveto', then hit 'start search'.
If no results show up for Game_Character, there's your problem.
If a result shows up for Game_Character, I have no idea.


Scripting I think - DerVVulfman - 04-12-2010

Hey, spazfire. I got your demo. Wow... big.

Check the name of your Game_Character classes. I am afraid that you had inadvertently renamed the first one:
Code:
#==============================================================================
# ** Game_Character (part 1)
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================

class Shota
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :id                       # ID
  attr_reader   :x                        # map x-coordinate (logical)
See?

It just so happens that THIS class holds the moveto method you lost. Rename the class back to Game_Character and it should be fine