Skills w/ Common Events - Caller's ID

Discussion in 'RPG Maker VX Ace' started by Markus I., Jan 21, 2016.

  1. Markus I.

    Markus I. Master of None Member

    Messages:
    14
    Likes Received:
    7
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    So, I'm going to be brief about my problem here.


    Imagine the following situation: A skill with the ID x that Bob knows will trigger, when used, a certain common event to display a message, then, Anna, that knows the same skill will also trigger this common event during the usage, but it will display a different message this time.


    My question here is: if there is any possibility of getting the ID of the actor who's using (or calling) the skill so I can handle with the variations inside the common event that is attached to the skill? Since all I've got was the same common event for anyone who's using the skill. I also tried tinkering more deeper with some variable manipulation without using scripts but I didn't have success so far, if someone knows how to solve this problem using any script code or even making a workaround that uses no scripting at all (that would be optimal for my case), you have my thanks.
     
    #1
  2. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    You can set a variable to a certain value in the damage formula and check it during the common event


    something like


    v[variable_id]=$game_actors.index(a);damage_formula


    This will set the Game Variable with the ID you set to be equal to the index of the user in the $game_actors array. Then you check the value of that variable in your common event to determine which message to show
     
    Last edited by a moderator: Jan 21, 2016
    #2
  3. Markus I.

    Markus I. Master of None Member

    Messages:
    14
    Likes Received:
    7
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Not sure if bad syntax or something else, but the variable that is designated to contains the Actor ID does not change at all! I tested with using the skill on field and inside a battle, and the variables remains at 0. Here some images for you to see if I'm not doing anything stupid. Oh yeah, and I tried to change v[27] to $game_variables[27], but no success too.


    trouble 1.png


    trouble 2.png
     
    Last edited by a moderator: Jan 21, 2016
    #3
  4. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    ah no, it was a problem on my part...


    it should be


    v[ID] = $data_actors.index(a.actor)


    if it doesn't work for you, just put this snippet into the script editor


    class Game_Actor


      attr_accessor :actor_id


    end


    then on your damage formula just do


    v[ID] = a.actor_id


    Take note though that the skill should only be usable by actors, else it will cause an error for enemies and as such the game will turn the damage to 0
     
    Last edited by a moderator: Jan 22, 2016
    #4
  5. Markus I.

    Markus I. Master of None Member

    Messages:
    14
    Likes Received:
    7
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Much obliged! The only problem was that the common event call was made by the skill before the variable could get the actor ID, but I found a workaround by "silentely" calling another skill by the common event of the first one, and then using all the procedure of another common event in the second skill.
     
    #5
  6. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    Actually, the problem was simply that I gave you the wrong method... it should simply be


    $data_actors.index(a.actor)


    Also, Common Events Run AFTER damage (at the end of that "turn" actually,  The mods even posted a thread to show how the whole damage flow works) so everything in the damage formula is actually done already by that time so the variable should already be set by that time... So unless you have a plug-in that modifies the flow of damage, there shouldn't be a need to make two skills.


    PS: I'm pretty sure I replied already with my edits yesterday (oh it's on top)
     
    Last edited by a moderator: Jan 22, 2016
    #6

Share This Page