I did mine slightly differently, Shaz. As instantiating a new RPG::MoveRoute automatically gives it an "end move route" command in its list, I used .unshift for my commands instead of push so that it would retain the finishing command on the end without me having to add one, but really nice tutorial. :)
Creating a Move Route with a Script command
● ARCHIVED · READ-ONLY
-
-
Yes, that would work. But you'd have to add your movement commands in reverse order. That'd just confuse me :D
-
From Game_Character:
Code:when ROUTE_CHANGE_GRAPHIC; set_graphic(params[0], params[1])
so it's expecting 2 elements in the array, not 1.
From Game_CharacterBase:
Code:def set_graphic(character_name, character_index)
so array element 0 will be the character name, and array element 1 will be the index.
So if you want to use the very first image in 'transform1' the command will be:
Code:transform.list.push(RPG::MoveCommand.new(41, ['transform1', 0])
Although, if you're doing that on the player, you would be better off just using an event command. The reason you'd want to build a script to do it is if you wanted to issue the same command on a number of different events, or if your event id is coming from a variable.
Thanks Shaz, that worked perfectly for me! However, what if I wanted to choose a specific frame within the "transform1" picture that I changed the player to? Because, this is going to be an animation that plays when the player hits a certain button, but at the same time I'd rather not break up each frame into x amount of files to be called. -
A specific frame? If you wanted a different index, you would just number them 0-8. The set_graphic command does not allow you to go down to a lower level. You would need to look for a different plugin or series of commands to allow that - it involves setting the direction, pattern, and original pattern, IIRC. If you work that out, you could add it to your script within a move route Script call, rather than a set_graphic call.
-
A specific frame? If you wanted a different index, you would just number them 0-8. The set_graphic command does not allow you to go down to a lower level. You would need to look for a different plugin or series of commands to allow that - it involves setting the direction, pattern, and original pattern, IIRC. If you work that out, you could add it to your script within a move route Script call, rather than a set_graphic call.
In PBMoveRoute, there are 4 different arguments, but I'm not sure how you'd set them:
Graphic = 41 # Name, hue, direction, pattern
Also, random question - I've never done anything with a frame counter before, and I was thinking about using something like this to create idle animations if the player stands still for long enough. I could just break up the player's sprite into separate files, if need be. The only problem I have, really, is the frame counter, since I'm not sure exactly how you can keep track of it or readily control it. I can do a normal counter, but not one that handles frames.
Edit, nevermind I just realized that a normal numerical counter is no different than a frame counter, because it's based on how many frames per second the game is running which determines that.