[Ace] Animation moving with player, how do i prevent that?

Discussion in 'RGSSx Script Support' started by Gleen, Jun 29, 2012.

  1. Gleen

    Gleen Veteran Veteran

    Messages:
    98
    Likes Received:
    21
    First Language:
    portuguese
    Hi, me again. I'm playing an animation above one event and it works wonders, but if i move the character one tile left while the animation is playing the animation too will move one tile left and then it'll not play in the right position.. how can i prevent that? Or wasn't this supposed to happen at all?
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,797
    Likes Received:
    11,507
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    A simple fix would be to have a second event with no graphic, and when you play the animation, move that event to the same position as the visible one, and play the animation on the no-graphic event. Make sure you set it up so both the player and other events can move over it.
     
    #2
  3. Gleen

    Gleen Veteran Veteran

    Messages:
    98
    Likes Received:
    21
    First Language:
    portuguese
    I get it, but is that a bug from rpg maker?
     
    #3
  4. Shaz

    Shaz Veteran Veteran

    Messages:
    37,797
    Likes Received:
    11,507
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Probably not. When you show an animation, you associate it with an event. It makes sense that it should stick with that event.
     
    #4
  5. Gleen

    Gleen Veteran Veteran

    Messages:
    98
    Likes Received:
    21
    First Language:
    portuguese
    I tested with events and you're right, they stick with the event... I don't know what i'm doing wrond so i'll post my codes here.

    When you press a button that will start the process, this will be executed. It gets the event and moves to player position



    Code:
    def use
        dt_get_event(tool)
        dt_event_setup(@dt_event)
    end
    
    def dt_get_event(ferramenta)
        events.each do |i, event|
    	  if event.list != nil
    	    for i in 0...event.list.size
    		    if event.list[i].code == 108 && event.list[i].parameters == [Gleen::DT::EVENTHANDLER]
    			  @dt_event = event
    		    end
    	    end
    	  end
        end
    
    def dt_event_setup(event)
        event.moveto($game_player.x, $game_player.y)
    end
    
    Here is my update method to check if the animation can be played:



    Code:
    def dt_update_timer
        if @timer == 60
    	  @trigger = true
    	  @dt_event.animation_id = 100
    	  clear_ok?(@dt_event)
        else
    	  @timer += 1
        end
      end
    
    def clear_ok?(event)
        mr = RPG::MoveRoute.new
        mr.repeat = false
        mr.wait = true
        mr.skippable = true
        mc = RPG::MoveCommand.new
        mc.code = 15
        mc.parameters = [36]
        mc2 = RPG::MoveCommand.new
        mc2.code = 45
        mc2.parameters = ["$game_map.dt_clear_event"]
        mr.list[0] = mc
        mr.list[1] = mc2
        event.force_move_route(mr)
      end
    
    And here is the last method executed, wich clears everything:



    Code:
    def dt_clear_event
        dt_get_event(tool)
        if @dt_event != nil
    	  @dt_event.moveto(0,0)
    	  @dt_event.dt_change_graphic(@dt_event, "clear") # clears the event graphic
        end
      end
    
    As far as i know, i'm not doing anything wrong here and that animation still moves...
     
    #5
  6. Shaz

    Shaz Veteran Veteran

    Messages:
    37,797
    Likes Received:
    11,507
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Are you playing the animation on the event that doesn't move? You only want that to move to the other event's position once, not over and over.
     
    #6
  7. Gleen

    Gleen Veteran Veteran

    Messages:
    98
    Likes Received:
    21
    First Language:
    portuguese
    Yeah, the event don't move. Only the animation...

    I noticed that in maps with minimal size (17x13) this bug doesn't occur, only in bigger maps when the screen moves, the animation follow the movement.
     
    Last edited by a moderator: Jun 29, 2012
    #7
  8. Shaz

    Shaz Veteran Veteran

    Messages:
    37,797
    Likes Received:
    11,507
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Oh, it sounds like it IS a bit of a bug, then - if your character moves around while it's going on, and it does one thing on a small map and another on a big map.

    You should report it in the unofficial bugs thread - if they do a patch, it might be easy enough to add a fix for this.
     
    #8
  9. Gleen

    Gleen Veteran Veteran

    Messages:
    98
    Likes Received:
    21
    First Language:
    portuguese
    No. it's something with my code. I created another project and tested. The animation don't move when i move. Even in big maps.
     
    #9
  10. Victor Sant

    Victor Sant Veteran Veteran

    Messages:
    1,694
    Likes Received:
    1,437
    Location:
    Brazil
    First Language:
    Portuguese
    This might solve it.
     
    #10

Share This Page