Calling Common Events with Items

Discussion in 'Learning Javascript' started by Nekohime1989, Feb 10, 2019.

Thread Status:
Not open for further replies.
  1. Nekohime1989

    Nekohime1989 'Monks Are Awesome' Veteran

    Messages:
    342
    Likes Received:
    152
    First Language:
    English
    Primarily Uses:
    RMMV
    My objective is to decrease a variable and the actors mp. But the variable that is decreased depends on the actor the item is used on. But I can't seem to figure out how to do it. Is their a specific scriptCall that selects the actor an item is used on?
     
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,413
    Likes Received:
    6,477
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    no need for a script (although there are some plugins that give such scripts)

    With eventing, you add a state as the effect, a state that is invisible and does nothing,named "targeted"or something like that.
    Then, in the common event you check all actors until you find the one with that state (conditional branch), apply the effect you want and remove the state.
     
    #2
  3. Soulrender

    Soulrender Veteran Veteran

    Messages:
    189
    Likes Received:
    87
    First Language:
    Poland
    Primarily Uses:
    RMMV
    Code:
    $gameParty._targetActorId
    This will return ID of actor wich item you used on.

    Eg. Actor with ID 7 uses your book on leader, then this code will return 1, wich is party leader and you can assign this to your variable.
     
    #3
    Nekohime1989 and Pix3M like this.
  4. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,766
    Likes Received:
    10,573
    First Language:
    English
    Primarily Uses:
    RMVXA

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #4
Thread Status:
Not open for further replies.

Share This Page