SRD's Timed Attack Core/Yanfly's Auto Passive States (syntax help)

Discussion in 'Javascript/Plugin Support' started by PassiveState, Jun 16, 2019.

  1. PassiveState

    PassiveState Villager Member

    Messages:
    7
    Likes Received:
    2
    First Language:
    English
    Primarily Uses:
    RMMV
    Hi all,

    I've created a passive state which I want to activate when the player performs poorly on SRD's Timed Attack Core mini, but I'm having some trouble with the syntax for checking the variable.

    The Timed Attack variable stated in the help is
    Code:
    $gameTemp.tas_power
    and the example given for linking damage to this variable is
    Code:
    (a.atk * 4 - b.def * 2) * ($gameTemp.tas_power)
    I have applied a variation of that to my damage formula and it works fine.


    Yanfly's stated syntax for basic state conditions is
    Code:
    <Passive Condition: Variable x Below y>

    I want the state to be active only when Timed Attack returns 0.25 or less so I've tried both

    Code:
    <Passive Condition: Variable ($gameTemp.tas_power) Below 0.25>
    and

    Code:
    <Passive Condition: Variable $gameTemp.tas_power Below 0.25>
    on the state's note page, but can't get either to work.

    Can anyone spot where I'm going wrong?


    When I change to
    Code:
    <Passive Condition: HP Above 300>
    Everything works as it should.


    Any help you guys could offer re: the correct variable syntax would be greatly appreciated.

    Thanks in advance!
     
    Last edited: Jun 16, 2019
    #1
  2. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,051
    Likes Received:
    657
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    The "Variable x Below" tag expects x to be a fixed, positive integer (e.g. 1, 5, or 42), representing the ID of a game variable.

    For a script condition, use the "Lunatic Mode" tag instead...maybe something like this:
    Code:
    <Custom Passive Condition>
    condition = $gameTemp.tas_power < 0.25;
    </Custom Passive Condition>
    (Reference: Yanfly's Auto Passive States.)

    Edit: that said, there may be a better approach, e.g. use an if statement in the action sequence and turn on/off a switch to enable/disable the passive state if appropriate. Not sure how SRD's Timed Attack plugins work... :kaoslp:
     
    #2
    PassiveState likes this.
  3. PassiveState

    PassiveState Villager Member

    Messages:
    7
    Likes Received:
    2
    First Language:
    English
    Primarily Uses:
    RMMV
    Thank you so much, your snippet appears to have worked right away :kaoluv:


    Edit: Actually jumped the gun there - your snippet just stops the state from activating so it appeared to be working.

    If I switch line
    Code:
    condition = $gameTemp.tas_power < 0.25;
    for

    Code:
    condition = user.HP > 300;
    The state activates/deactivates when either actor's HP crosses 300 as you'd expect ...


    So we keep coming back to this darn $gameTemp.tas_power variable :kaosigh:
     
    Last edited: Jun 16, 2019
    #3
  4. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,051
    Likes Received:
    657
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Yes, I suspected that would be the case. After a closer look it seems tas_power is reset to 1 when the action ends, but I'm guessing you want the state to be active for longer than that? Not to mention it being used for every timed attack skill. :kaoswt:

    You have an action sequence for this, right? Perhaps change the passive condition to a switch, then add something like this just after the Timed Attack bit:
    Code:
    if $gameTemp.tas_power < 0.25
      change switch 10: on
    else
      change switch 10: off
    end
    Actually, unless you have some reason for using a passive state, this might be a better solution:
    Code:
    if $gameTemp.tas_power < 0.25
      add state 50: user
    else
      remove state 50: user
    end
    Both of these suggestions require Action Sequence Pack 1 to work. Just change the switch/state ID to suit your game~ :kaopride:

    Also, just an aside:
    That's surprising; user.HP doesn't exist in the default code, it's user.hp (lower-case). :kaoswt2:
     
    #4
  5. PassiveState

    PassiveState Villager Member

    Messages:
    7
    Likes Received:
    2
    First Language:
    English
    Primarily Uses:
    RMMV
    Nah the state only lasting for the current attack is ideal - all I want is for the timed attack mini to affect both damage and the user's hit rate ie if the user doesn't input on the mini, their attack will miss; if they do well on the mini, their attack will hit (assuming enemy doesn't evade). I also plan on this affecting critical rate, as currently the user can get a critical even when they fail the mini which detracts from the whole affair.

    My original solution was including tas_power in the actual ex.par formulas using Yanfly's plugin, but this approach did not work with SRDs Active Defense Core (which I also want to use), and despite working fine for attacks, it didn't seem best practice to have the mini affect these formulas at a global scope vs the required user.

    Passive states seemed like the ideal way to go about it, though now ...

    This was on the cards as it would be a lot cooler for the mini to run just prior to striking the target, but plan was to get all the raw battle mechanics in order first. Now I'm thinking I could scrap the passive state and do everything I need via action sequence ... Is it possible to affect HIT and CRI with this method?

    You've got me there, my error transcribing :kaoswt:
     
    #5
  6. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,051
    Likes Received:
    657
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    By default ex-params like HIT & CRI are determined exclusively via traits. One possible approach could be to make a state with the desired traits and add/remove that state before/after the "perform action" bit in the sequence as appropriate. :)
     
    #6
  7. PassiveState

    PassiveState Villager Member

    Messages:
    7
    Likes Received:
    2
    First Language:
    English
    Primarily Uses:
    RMMV
    Alright and this was the easy part, I'm looking forward to doing Active Defense. Thanks for your help caethyril, you've been great :kaoluv:
     
    #7
    caethyril likes this.

Share This Page