How to set variables to specific parameters?

Discussion in 'Javascript/Plugin Support' started by R.Alexander, Jan 18, 2017.

  1. R.Alexander

    R.Alexander Warper Member

    Messages:
    2
    Likes Received:
    1
    First Language:
    English
    I see that there is a built in way to set variables to an actors current atk, level, hp, ect. But, I want to set a variable to a characters base attack, defense, ect. I feel there should be a way to do it using javascript, but nothing I have tried seems to work. There must be something simple I am missing.
     
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    27,542
    Likes Received:
    6,157
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    I've moved this thread to Javascript Support. Please be sure to post your threads in the correct forum next time. Thank you.



    There is probably a way to do that by referncing the data files instead of the game structure (after all, you can reset an actor to base values by checking init on the change membershot command), but I don't know the code for that myself, and it can't be done by eventing alone.
     
    #2
  3. Bex

    Bex Veteran Veteran

    Messages:
    976
    Likes Received:
    196
    First Language:
    German
    Primarily Uses:
    RMMV
    Its in the same list as HP and MP the player ATK and DEF values.


    So if you can use the Eventcommand "control variable" to set a variable to player hp than just choose DEF or ATK


    Atk = Attack Value = Base attack in my understanding.


    Atleast this is possible in vx-ace, i dont think that they removed it in MV.
     
    Last edited by a moderator: Jan 19, 2017
    #3
  4. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,547
    Likes Received:
    1,292
    Location:
    Canada / Qu├ębec
    First Language:
    French
    Primarily Uses:
    RMMV
    @R.Alexander


    hi friend


    here how to get the current stats


    $gameActors.actor(actorId).hp
    $gameActors.actor(actorId).mhp
    $gameActors.actor(actorId).mp
    $gameActors.actor(actorId).mmp
    $gameActors.actor(actorId).param[2]
    $gameActors.actor(actorId).param[3]
    $gameActors.actor(actorId).param[4]
    $gameActors.actor(actorId).param[5]
    $gameActors.actor(actorId).param[6]
    $gameActors.actor(actorId).param[7]




    and if you need set , add or remove .
    You need to use like this.


    $gameActors.actor(actorId).addParam(paramId, n);
    //paramId=: 0-MaxHP, 1-MaxMP, 2-ATK, 3-DEF, 4-MAT, 5-MDEF, 6-AGI, 7-LUK


    to understand more.
    In game run tape F8 to open console log.


    And put in console


    $gameActors.actor(1)
    And you will see the array list stats


    as the visual inside rmmv software stats


    0, 1, 2, 3


    4, 5, 6, 7


    Capture.JPG
     
    #4
  5. R.Alexander

    R.Alexander Warper Member

    Messages:
    2
    Likes Received:
    1
    First Language:
    English
    Okay, I figured it out. I used the control variables event and set the variable to equal


    $gameActors.actor(1).paramBase(2)


    to set it to actor 1's base attack. Using brackets "[ ]" instead of parentheses "( )" after param was giving me the issue. Using the console log helped a lot


    Thanks
     
    #5
    Bex likes this.

Share This Page