Infinite attacks loop?

● ARCHIVED · READ-ONLY
Started by jbtwist 20 posts View original ↗
  1. IMPORTANT EDIT: Update is on the first post on page 2:

    jbtwist said:
    I am resurrecting this post to add updates and new questions, im gonna explain:

    After some investigation, i've found what I wanted and ive been able to make the infinite attack loop, thanks to using this: BattleManager.queueForceAction(user, skill, target);

    That's great but now appears a new bug:

    When my actor attacks and repeats for the first time, it doesn't back to its position, but after executing the 2nd attack, 3rd and next attacks he is backing to origin position. This is more graphic:

    https://i.gyazo.com/43efec7b7f1ce39f78493224635836a4.mp4

    I would like to make all the attacks without backing to its position, and only when ends all attacks ends. I've tried a lot of things, but didn't worked at all.

    Im posting notes of the attack too, maybe it helps to solve this:


    <Whole Action>
    move user: targets, front, 20
    wait for movement
    motion attack: user
    wait: 10
    attack animation: target
    wait for animation
    action effect
    wait 100
    </Whole Action>

    <Finish Action>
    if $gameSwitches.value(100);
    wait: 10
    else
    move user: return
    wait for movement
    end
    </Finish Action>

    <Post-Damage Eval>
    if(target.isDead() && user.isStateAffected(64)){
    var id = user._actorId;
    var pos = $gameParty._actors.indexOf(id);
    var skill = 1;
    var target = -1;
    $gameSwitches.setValue(100, true);
    BattleManager.queueForceAction(user, skill, target);
    }
    </Post-Damage Eval>

    <After Eval>
    $gameSwitches.setValue(100, false);
    </After Eval>




    ORIGINAL POST:

    ---------------------------------------------------------------------------------
    Hi guys, im gonna explain what I am working on:

    I want that if an actor is affected by a passive state and kills a target with a normal attack, it repeats the attack on a random enemy.

    I've been abled to do this with this code:

    -------------------------------------------------------------------
    <Post-Damage Eval>
    if(target.isDead() && user.isStateAffected(59)){
    var id = user._actorId;
    var pos = $gameParty._actors.indexOf(id);
    BattleManager.forceAction($gameParty.members()[pos]);
    }
    </Post-Damage Eval>
    -------------------------------------------------------------------

    This only works once, just as I expected and wanted, but I would like to create a improvement of this, making it having no limits in the number of attacks, making possible to attack and attack and attack untill all enemies are dead (if they kill only with 1 basic attack)

    I have tried but it is impossible for an newbie like me on JS, could some1 help me?
  2. up
  3. Do you want it on a single battle or through the entire game?

    Edit: traduced :hswt:
  4. Masterslash2000 said:
    ¿Quieres que eso ocurra en una unica batalla o en todo el juego (mientras este el estado activo)? Es importante para hallar la solución.

    I want it to be a state that works through all the game, I answer u in english because is the main language of this forum :)
  5. @Masterslash2000 This is an English forum, please translate your post into English.
  6. BattleManager._subject.forceAction(skillId, -1);

    This should make your action target a random target after your initial attack/kill. Use that instead of the embedded function you have.

    Repeats on Kill
    <Post-Damage Eval>
    if(target.isDead() && user.isStateAffected(59)){
    var skillId = YOUR SKILL ID
    BattleManager._subject.forceAction(skillId, -1);
    }
    </Post-Damage Eval>

    Continuous Action
    <Post-Damage Eval>
    if(user.isStateAffected(59)){
    var skillId = YOUR SKILL ID
    BattleManager._subject.forceAction(skillId, -1);
    }
    </Post-Damage Eval>

    If it doesn't work you might need to implement a loop of some kind using this extension for Yanfly's action sequences: https://forums.rpgmakerweb.com/index.php?threads/action-sequence-loops-1-10.79043/

    Edit: Not sure of the correct function for currentAction.item.id() so I changed it.

    Edit 2: So after testing, this works. Only thing is if you miss any attack, the chain stops and your actor's turn ends.
  7. JGreene said:
    BattleManager._subject.forceAction(skillId, -1);

    This should make your action target a random target after your initial attack/kill. Use that instead of the embedded function you have.

    Repeats on Kill
    <Post-Damage Eval>
    if(target.isDead() && user.isStateAffected(59)){
    var skillId = YOUR SKILL ID
    BattleManager._subject.forceAction(skillId, -1);
    }
    </Post-Damage Eval>

    Continuous Action
    <Post-Damage Eval>
    if(user.isStateAffected(59)){
    var skillId = YOUR SKILL ID
    BattleManager._subject.forceAction(skillId, -1);
    }
    </Post-Damage Eval>

    If it doesn't work you might need to implement a loop of some kind using this extension for Yanfly's action sequences: https://forums.rpgmakerweb.com/index.php?threads/action-sequence-loops-1-10.79043/

    Edit: Not sure of the correct function for currentAction.item.id() so I changed it.

    Edit 2: So after testing, this works. Only thing is if you miss any attack, the chain stops and your actor's turn ends.

    Your code doesn't seems to work to me, battlemanager function you used doesnt work on my game, and i dont know how to use your currentAction.item.id() i am gonna try with action secuences, but i dont know how to make 2 conditions whiles, and i cant use nested whiles for that
  8. Here's an example of the code. Say you want to use skill 12 indefinitely...

    <Post-Damage Eval>
    if(user.isStateAffected(59)) {
    var skillId = 12
    BattleManager._subject.forceAction(skillId, -1);
    }
    </Post-Damage Eval>

    You need Yanfly's Battle Engine Core and all 3 action sequence packs just to be safe. I just tested it and it works.
  9. JGreene said:
    Here's an example of the code. Say you want to use skill 12 indefinitely...

    <Post-Damage Eval>
    if(user.isStateAffected(59)) {
    var skillId = 12
    BattleManager._subject.forceAction(skillId, -1);
    }
    </Post-Damage Eval>

    You need Yanfly's Battle Engine Core and all 3 action sequence packs just to be safe. I just tested it and it works.
    The problem is i dont want the skill used infinite, i want to be on a loop while is killing an enemy, if it doesnt, it should to stop.

    4 example, 3 enemies: attack 1, killed, attack 2, killed, attack 3, not killed then stop
  10. Okay, so use the first example I posted up there.

    Replace if(user.isStateAffected(59)) with if(target.isDead() && user.isStateAffected(59))
  11. JGreene said:
    Okay, so use the first example I posted up there.

    Replace if(user.isStateAffected(59)) with if(target.isDead() && user.isStateAffected(59))
    Really it works for you? it doesn't works for me even when i have only this:

    Spoiler
    <Post-Damage Eval>
    BattleManager._subject.forceAction(1, -1);
    </Post-Damage Eval>

    I also have all plugins you mentioned

    EDIT: This is so strange... now it doesnt works even with my previous code.....

    EDIT2: I've restarted mv and now it works again with my code, but not with yours :(

    EDIT3: I've been searching and I know that the action doesn't repeat because it ignores 2nd force action, there is a way to force an action under a forced action?
  12. What version is your project? And your MV program?
  13. my mv is at 1.6.1
    battle engine core at 1.44
    action secuences from 1 to 3 at: 1.08, 1.04, 1.01

    i dont know what you mean with my proyect version
  14. Your MV program has a version separate from your project. They are usually the same, but don't have to be. For example, I'm using MV 1.6.1, but my project is 1.5.2
  15. JGreene said:
    Your MV program has a version separate from your project. They are usually the same, but don't have to be. For example, I'm using MV 1.6.1, but my project is 1.5.2
    I've updated my proyect following srdude guide and now, not only doesn't works your code while previous mine still works, in adition, battle testing doesnt work anymore, it calls to a exception that i cant see because it appear before debug window appears, i have to battle test using a debug map :ysad:
  16. Yeah the battle test bug is a known issue with the newest version of MV.

    And I don't know what to tell you about the code. Mine works on my end, and yours works on your end. Maybe you have a typo somewhere?
  17. JGreene said:
    Yeah the battle test bug is a known issue with the newest version of MV.

    And I don't know what to tell you about the code. Mine works on my end, and yours works on your end. Maybe you have a typo somewhere?

    what do you mean with typo?
    you were able to repeat infinitelly the attack? could you upload your proyect so i could check what is wrong in mine?
  18. ok, i've found what happens, i've tried everything and didn't work, but when i have disabled ctb battle system, it worked, do you think it is possible to do on ctb?
  19. In my experience CTB and instant cast don't work together. Not like they should anyway. But I'm glad that my code helped you