[RESOLVED]Need some help......

Started by Wizered67, March 12, 2011, 12:03:45 am

Previous topic - Next topic

Wizered67

March 12, 2011, 12:03:45 am Last Edit: March 12, 2011, 10:55:07 am by Wizered67
I'm trying to make an add-on for RMX-OS that let's you follow other players(specifcally party members). Basically, I have been setting the @following variable to the player that you are following. The only problem is that after you follow someone, you can no longer move anymore. I'm not sure if I made a silly mistake with something or if I'm just missing something. I'm not an expert when it comes to scripting,but here's what I have:
Spoiler: ShowHide
class Game_Player
attr_accessor :following
alias init_add_follow initialize
def initialize
 @following = nil
 init_add_follow
end

alias update_following_check_add update
def update
  unless moving? or $game_system.map_interpreter.running? or
          @move_route_forcing or $game_temp.message_window_showing
  if @following != nil
    update_following
    end
 end
update_following_check_add
 end

 def update_following
if @old_following_x != @following_x || @old_following_y != @following.y
$game_player.path_target_x = @following.x
$game_player.path_target_y = @following.y
@old_following_x = @following.x
@old_following_y = @following.y
end
end
end


Just so you know, it uses the Blizz-ABS pathfinder for it. I would appreicate any help.

Thanks,
Wizered67

winkio

The pathfinder already has that built in, look in the manual.

Wizered67

I'm not sure if you undertsand my problem. Right now, the player completely freezes and can't move at all anymore no matter what. What I'm asking is if I did something wrong or if I need to do something differently.

winkio

So I opened up the Blizz-ABS manual, searched for 'pathfinder' and this is what I got:

Quote from: I'm serious this thing is useful4.3.7. Using the Pathfinder for the Player
The player character can now make use of the Blizz-ABS pathfinder in order to find a route towards a target. To make the player find a path toward a character or a specific location on the map, use a Script call with the following syntax:

$game_player.path_target_x = CHARACTER
$game_player.path_target_x = XCOORDINATE
$game_player.path_target_y = YCOORDINATE
CHARACTER can be any character, such as an event ($game_map.events[ID]). XCOORDINATE and YCOORDINATE are the coordinates of the map tile that you want to move to.

While the player is automatically moving towards the target, they will be able to toggle the HUDs, open the menu, and change movement speeds (run/sneak) without interrupting the pathfinding process. If the player tries to move, jump, change party members, turn, attack, defend, use and item, or use a skill, the process will be cancelled, and the player will resume full control of their character.


Wizered67

Okay, I understand that, but it isn't happening that way. That's what the problem is. I know that it should do that, but it isn't. The player is completely frozen and I'm not sure what the problem is. It seems that Game_Player is not updating and I'm not sure what I'm doing wrong.

Blizzard

winkio, he's already using the pathfinder in his script.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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.

winkio

Okay, the thing I think you are trying to do with this script is make a player follow another event, but allow the player to stop following that event by moving.  This can be done with one script call.

$game_player.path_target_x = CHARACTER


You do not want to do this every frame, it simply needs to be called once.

Wizered67

I fixed the problem. It was all caused by a small typo.