script help(Resolved)

Started by nathmatt, April 08, 2009, 12:45:02 pm

Previous topic - Next topic

nathmatt

April 08, 2009, 12:45:02 pm Last Edit: April 09, 2009, 12:28:03 pm by nathmatt
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

Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Blizzard

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]".
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

nathmatt

April 09, 2009, 09:05:16 am #2 Last Edit: April 09, 2009, 09:06:44 am by nathmatt
did not know that i guess i would want to RTFM lol
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Blizzard

No, it's not in the manual. It's one of the methods I implemented mainly used by the AI.
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

nathmatt

oh how would i call it i tryed $bizzabs.moveto($game_map.events[9].x, $game_map.events[9].y)
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Blizzard

"$game_map.events[9].move_toward($game_map.events[1])" makes event 9 move toward event 1.
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

nathmatt

Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script