Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: nathmatt on April 08, 2009, 12:45:02 pm

Title: script help(Resolved)
Post by: nathmatt on April 08, 2009, 12:45:02 pm
ok im making a short script but its not working not sure y it moves the player to an event
it gives an error on the abs

Spoiler: ShowHide
class Game_Character
 
  def toward_event
    sx = @x - $game_events[$e_id].x
    sy = @y - $game_events[$e_id.y
    abs_sx = sx > 0 ? sx : -sx
    abs_sy = sy > 0 ? sy : -sy
    if sx + sy >= 20
      move_random
      return
    end
    case rand(6)
    when 0..3 
      move_toward_event
    when 4 
      move_random
    when 5 
      move_forward
    end
    @move = [0, false]
  end
end

Title: Re: script help
Post by: Blizzard on April 09, 2009, 05:05:16 am
First thing... "$game_events[$e_id.y" should be "$game_events[$e_id].y" and secondly it's "$game_map.events[$e_id].y". xD
Thirdly, Blizz-ABS has already script calls for that. "turn_toward(CHARACTER)" and "move_toward(CHARACTER)". CHARACTER can be any character on the map. i.e. an event would be "$game_map.events[E_ID]".
Title: Re: script help
Post by: nathmatt on April 09, 2009, 09:05:16 am
did not know that i guess i would want to RTFM lol
Title: Re: script help
Post by: Blizzard on April 09, 2009, 09:08:12 am
No, it's not in the manual. It's one of the methods I implemented mainly used by the AI.
Title: Re: script help
Post by: nathmatt on April 09, 2009, 09:56:06 am
oh how would i call it i tryed $bizzabs.moveto($game_map.events[9].x, $game_map.events[9].y)
Title: Re: script help
Post by: Blizzard on April 09, 2009, 10:35:15 am
"$game_map.events[9].move_toward($game_map.events[1])" makes event 9 move toward event 1.
Title: Re: script help
Post by: nathmatt on April 09, 2009, 12:07:48 pm
ok i got it thinks