Event Commands "Show Animation" script call equivalent?

Discussion in 'RGSS3 Script Requests' started by TheOddFellow, Jul 2, 2015.

  1. TheOddFellow

    TheOddFellow Overactive Artisan Story Crafter Veteran

    Messages:
    152
    Likes Received:
    67
    First Language:
    English
    Primarily Uses:
    RMMV
    I've been looking all over the net for an answer to the topic title above.

    Simply put, I'm probably going to be using a lot of animations in the map-part of my game. However, they are random. I know there are plenty of script call equivalents for many event commands, but this one is just shrouded in mystery for me.

    Can anyone help, please?

    Goal: The player selects from a menu, and that menu stores the skill's id. I believe I can use that id to show the proper skill animation, I'm just not sure how.
     
    #1
  2. ♥SOURCE♥

    ♥SOURCE♥ Too sexy for your party. Member

    Messages:
    693
    Likes Received:
    410
    Hello!

    You could simply set the animation_id variable for any character. Example:

    $game_player.animation_id = 4If you're going to use the Script event command, you could take advantage of the interpreter's get_character method:

    get_character(-1).animation_id = 4-1 represents the player, 0 the current event where the script command is being used, and 1 and above represents any map event with that ID number. 

    Once you get the skill's ID, you can use something like:

    get_character(-1).animation_id = $data_skills[SKILL_ID].animation_idSKILL_ID would be the ID number of the skill, or the reference to the variable holding that value. Let's say you saved the skill ID to variable 10:

    get_character(-1).animation_id = $data_skills[$game_variables[10]].animation_idLet me know if you need further help. :)
     
    #2
  3. TheOddFellow

    TheOddFellow Overactive Artisan Story Crafter Veteran

    Messages:
    152
    Likes Received:
    67
    First Language:
    English
    Primarily Uses:
    RMMV
    I rarely receive such expansive and thorough answers to my questions. Thank you so much.

    There is a slight problem. When the base skill "Thunder" is used, it shows the animation. But, not for the base skill "Attack." It skips it. They are unedited skills. So, if you were to start up a new project, it would be Skill 1 I am referring to.
     
    #3
  4. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,590
    Likes Received:
    10,510
    First Language:
    English
    Primarily Uses:
    RMVXA
    The animation for skill #1 is 'Normal Attack' which is not animation id #1 (that's 'Hit: PHysical')

    You might try changing the choice of animation for skill #1 on the Skill tab and see what that does when you use this with the new id.

    It may be (but this is a guess on my part) that the id for 'Normal Attack' is 0.
     
    #4
  5. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    798
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    If you enter this in a script call:

    p $data_skills[1].animation_idAnd check your console afterwards, you will see that it prints out -1 actually.
    So the animation ID is -1 for every skill which got 'Normal Attack' Animation setting in the database, I guess.


    Simply making a condition check if it's skill 1 or not and setting the animation ID based on that check can solve your issue.


    Selecting another animation in the database can solve it too.


    As a side note... Why on earth would anyone actually use that 'get_character' method when the character is '$game_player'? Typing in 'get_character(-1)' takes longer, takes more space than simply writing '$game_player', AND it goes through another completely unnecessary method to get the actual character in question. I would not use that ever, that's for sure, not for $game_player, nor for $game_map.events[id]. :p


    It sounds to me like writing a new method in Game_Interpreter which is named 'get_skill(id)' and simply returns $data_skills[id]. Pointless, really.
     
    #5
  6. ♥SOURCE♥

    ♥SOURCE♥ Too sexy for your party. Member

    Messages:
    693
    Likes Received:
    410
    Simple: it's easier to remember for non-scripters than $game_map.events[id]. Less chances of syntax errors. When you're doing scripts for non-programmers, ease of use and simplicity are important.
     
    #6
    JosephSeraph and Kes like this.
  7. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    798
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    If someone wants to use custom scripts but can't memorize a few letters, than I guess using custom scripts is not for him/her.


    I would understand if the thing in question would be a longer and somewhat more complex method, but exchanging a one-liner to a one-liner is not something I would do.


    But, I guess, it is true that it seems simpler for some people.
     
    #7
  8. TheOddFellow

    TheOddFellow Overactive Artisan Story Crafter Veteran

    Messages:
    152
    Likes Received:
    67
    First Language:
    English
    Primarily Uses:
    RMMV
    @Sixth Thank you for your patience is showing me a more efficient way of doing what I asked. I'm not used to ruby and have used C# for a number of years.

    @♥SOURCE♥ Thank you so much for your help and your explanation on the differences between the two ways of doing what I asked and were presented with here.

    I'm glad to have found such a great community, and I hope this topic helps out other developers as well who had this question.
     
    #8
  9. ♥SOURCE♥

    ♥SOURCE♥ Too sexy for your party. Member

    Messages:
    693
    Likes Received:
    410
    You're welcome! :3
     
    #9

Share This Page