• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Problem with form changing animation

  • 36
    Posts
    10
    Years
    • Seen Sep 28, 2017
    Hello everyone!
    I'd like to introduce myself: my nickname is AGSoldier and I am a developer of this fan-made project called Pokémon Xenoverse. Since I'm not so comfortable using the Ruby scripting language, I'm having some problems with a script, and I'd like to ask you if there's some problem with my code.
    I'm trying to play an animation over a Pokémon icon sprite in PBScreen_Party when his form change. When an iten si given to a Pokémon should start the animation, and while the animation is running, the icon sprite under it should refresh. I've create a two methods: the first one calls the second one and print something on the screen, the second one should start the animation while a yield process called in the first method should refrsh the icon sprite.
    My question is: how can I render this animation? I've found the x and y coordinates of the Pokémon icon sprite, but I can't render and play the animation. I tried to put it in the sprite hash and let the Graphics.update method take care of him, but it wouldn't work.
    If someone can help me would be really appreciated.
     
    Thanks for the reply! Here's the code I was talking about.

    Code:
    def pbStartFormChange(i)
        x = @sprites["pokemon#{i}"].x
        y = @sprites["pokemon#{i}"].y
        pbStartAnimation(x, y) {
          pbRefreshSingle(i)
        }
        pbDisplay(_INTL("{1} ha cambiato forma!", @party[i].name))
      end
      
      def pbStartAnimation(x, y)
        @sprites["anim"] = AnimatedBimap.new(_INTL("Graphics/Icons/fromAnim"))
        @sprites["anim"].x = x
        @sprites["anim"].y = y
        update
        yield
        update
      end

    The method's calling in the main script works fine, but I cant render the animation. Any advice?
     
    Fixed:
    Code:
    def pbStartFormChange(i)
    	viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
    	viewport.z = 100010
    	anim = AnimatedSprite.new("Graphics/Battlers/001.png",99,38,38,1,viewport)
    	anim.x = @sprites["pokemon#{i}"].x
    	anim.y = @sprites["pokemon#{i}"].y
    	anim.play
    	for n in 0..30 do
    		anim.update
    		update
    		pbRefreshSingle(i) if n == 15
    		Graphics.update
    	end
    	anim.dispose
    	Input.update
    	pbDisplay(_INTL("{1} ha cambiato forma!", @party[i].name))
    end
     
    Back
    Top