Yanfly Action Sequence - Frame Selection/Control?

I'm not going to debug for anterior MV versions, sorry.
Frame limits shouldn't even be set unless you manually put them there, so there must be some crazy things going on here.
If all else fails, use a battle event to remove the max frame from everyone on turn 0?
The following code should do the trick:

Code:
$gameParty.battleMembers().forEach(function(member){member.battler().removeMaxFrame()})
I'm not going to debug for anterior MV versions, sorry.
Frame limits shouldn't even be set unless you manually put them there, so there must be some crazy things going on here.
If all else fails, use a battle event to remove the max frame from everyone on turn 0?
The following code should do the trick:

Code:
$gameParty.battleMembers().forEach(function(member){member.battler().removeMaxFrame()})
does thisplugin still work or am i using it worng. i cant seem to make the battler stay in the frame through eval.
is it through notetags or command script?
I haven't tested it in a while. It should still work unless yanfly has changed the way animations worked since I've written it. You might also be using a plugin for non default animations, and that might be the issue.

It was made to be used in action sequences as an eval command, but it should also work as an event command script.
I'm sorry, but how do i insert that in my notes?
I have little-to-none knowledge of coding, i don't know how to make Eval work, all i understand is basic action sequence stuff. Hell, i dont even know for sure if the plugin is working, if i pasted it the right way... i get no response and i dont know what i'm doing wtong

Anyway, i was recommended this thread because i want to hold the exposure for each frame, im doing animation from scratch, and this is what i want it to look like: pose 1 (hold 12 frames), pose 2 (hold 15), pose 3 (hold 3). This way i get way more impact for the animation, while RPG Maker's deafult animation plays in evenly timed poses.

This is what i want it to look like in game (nevermind the hat, that i think i'll handle with regular animation):

makako-ataque.gif

This is how RPG actually plays it, it has no impact and looks hella awkward (but are actually the same 3 drawing, just different timing)
makako-ataque-in-game-low.gif


From what i read i believe this plugin will do it, i just don't know how to code it properly, here's what i tried:
Code:
<setup action>
clear battle log
display action
immortal: targets, true
perform start
wait for movement
</setup action>
<target action>
if user.attackMotion() !== 'missile'
move user: targets, front, 20
else
perform start
end
wait for movement
motion attack: user
$gameActor.actor(id).battler().setFrame(thrust,1)
wait: 12
$gameActor.actor(id).battler().setFrame(thrust,2)
wait: 15
$gameActor.actor(id).battler().setFrame(thrust,3)
wait: 3
attack animation: target
wait for animation
action effect
death break
</target action>
<finish action>
immortal: targets, false
wait for new line
clear battle log
perform finish
wait for movement
</finish action>

these are my plugins:
1580868421571.png


and this is how i saved the code provided (in case i messed something up in that step)
1580868496107.png
This sparked my interest so I gave it a quick look and came up with something.
Paste this in a .js file name it whatever and import it in your projet.

Code:
(function() {
Sprite_Actor.prototype.updateMotionCount = function() {
    if (this._motion && ++this._motionCount >= this.motionSpeed()) {
        if (this.hasOwnProperty("_maxPattern") && this._pattern === this._maxPattern) {this.refreshMotion(); return}
        if (this._motion.loop) {
            this._pattern = (this._pattern + 1) % 4;
        } else if (this._pattern < 2) {
            this._pattern++;
        } else {
            this.refreshMotion();
        }
        this._motionCount = 0;
    }
};

var alias2 = Sprite_Weapon.prototype.updatePattern
Sprite_Weapon.prototype.updatePattern = function() {
    if (this.parent.hasOwnProperty("_maxPattern") && this._pattern === this.parent._maxPattern) {return}
   alias2.call(this);
};

var alias = Sprite_Actor.prototype.refreshMotion
Sprite_Actor.prototype.refreshMotion = function() {
    var actor = this._actor;
    if (actor) {
        if (this.hasOwnProperty("_maxPattern") && this._pattern === this._maxPattern) {return}
    }
    alias.call(this)
}

Sprite_Actor.prototype.setMaxFrame = function(num) {
    this._maxPattern = num;
}

Sprite_Actor.prototype.removeMaxFrame = function() {
    delete this._maxPattern
}

Sprite_Actor.prototype.setFrame = function(motion,num) {
    if (motion === "attack") {this._actor.performAttack()} else {this._actor.requestMotion(motion)}
   if (motion === "attack" && this.hasOwnProperty("_weaponSprite")) {
       var wpn = this._weaponSprite;
       wpn._pattern = num - 1;
       wpn._motionCount = 0;
       wpn.updatePattern();
   }
   this._pattern = num;
   this._motionCount = 0;
   this.setMaxFrame(num)
}

})()

You can then do what you want by using the eval function of action sequences:
Eval: user.battler().setMaxFrame(1)
This will block the animation in the middle. Animations are 3 frames long: 1,2,3. A limit of 0 is the same as no limit.

Eval: user.battler().removeMaxFrame()
This will resume the animation.

Full warning: this overrides the counting process and may create incompatibilities with other plugins that modify animation frames.

Edit: it also may require 1.6.1 because that's the version I've been working with and I didn't check for others.

I haven't used it but it says here
Code:
Eval: user.battler().setMaxFrame(1)
I haven't used it but it says here
Code:
Eval: user.battler().setMaxFrame(1)

Yea, i tried this one too, but he posted a update with that code so i tried the new one as well. Just to be sure, i tried again the original and got no results:

Code:
<setup action>
clear battle log
display action
immortal: targets, true
perform start
wait for movement
</setup action>
<target action>
if user.attackMotion() !== 'missile'
move user: targets, front, 20
else
perform start
end
wait for movement
motion attack: user
Eval: user.battler().setMaxFrame(1)
wait: 12
Eval: user.battler().setMaxFrame(2)
wait: 13
Eval: user.battler().setMaxFrame(3)
wait: 3
attack animation: target
wait for animation
action effect
death break
</target action>
<finish action>
immortal: targets, false
wait for new line
clear battle log
perform finish
wait for movement
</finish action>
Yea, i tried this one too, but he posted a update with that code so i tried the new one as well. Just to be sure, i tried again the original and got no results:

Code:
<setup action>
clear battle log
display action
immortal: targets, true
perform start
wait for movement
</setup action>
<target action>
if user.attackMotion() !== 'missile'
move user: targets, front, 20
else
perform start
end
wait for movement
motion attack: user
Eval: user.battler().setMaxFrame(1)
wait: 12
Eval: user.battler().setMaxFrame(2)
wait: 13
Eval: user.battler().setMaxFrame(3)
wait: 3
attack animation: target
wait for animation
action effect
death break
</target action>
<finish action>
immortal: targets, false
wait for new line
clear battle log
perform finish
wait for movement
</finish action>
Spent a long time testing and realized I didn't scroll down when copying the plugin making it incomplete yours is though, tested it again with
Code:
eval: user.battler().setFrame("attack", 1);
wait: 120
eval: user.battler().setFrame("attack", 2);
wait: 130
eval: user.battler().setFrame("attack", 3);
wait: 300
and it worked perfectly. Ehh though I say perfectly it looks like it doesn't hold the motions for full 5 second duration at the end for some reason. Oh NVM it's 0 1 2 for order.
Spent a long time testing and realized I didn't scroll down when copying the plugin making it incomplete yours is though, tested it again with
Code:
eval: user.battler().setFrame("attack", 1);
wait: 120
eval: user.battler().setFrame("attack", 2);
wait: 130
eval: user.battler().setFrame("attack", 3);
wait: 300
and it worked perfectly. Ehh though I say perfectly it looks like it doesn't hold the motions for full 5 second duration at the end for some reason. Oh NVM it's 0 1 2 for order.

Woooow i get it to work! Thanks a lot! There's just one little problem, idk if you also got it: im using SV_animated enemies, and when THEY attack, they disapper right before using its motion and they dont come back no more.

Got any ideias of what went wrong? They are both sharing the same coded skill, so maybe its that?
Woooow i get it to work! Thanks a lot! There's just one little problem, idk if you also got it: im using SV_animated enemies, and when THEY attack, they disapper right before using its motion and they dont come back no more.

Got any ideias of what went wrong? They are both sharing the same coded skill, so maybe its that?

It's just not made for it, I did edit it to work easily by changing it to enemies
Code:
(function() {
Sprite_Enemy.prototype.updateMotionCount = function() {
    if (this._motion && ++this._motionCount >= this.motionSpeed()) {
        if (this.hasOwnProperty("_maxPattern") && this._pattern === this._maxPattern) {this.refreshMotion(); return}
        if (this._motion.loop) {
            this._pattern = (this._pattern + 1) % 4;
        } else if (this._pattern < 2) {
            this._pattern++;
        } else {
            this.refreshMotion();
        }
        this._motionCount = 0;
    }
};


var alias = Sprite_Enemy.prototype.refreshMotion
Sprite_Enemy.prototype.refreshMotion = function() {
    var actor = this._enemy;
    if (actor) {
        if (this.hasOwnProperty("_maxPattern") && this._pattern === this._maxPattern) {return}
    }
    alias.call(this)
}

Sprite_Enemy.prototype.setMaxFrame = function(num) {
    this._maxPattern = num;
}

Sprite_Enemy.prototype.removeMaxFrame = function() {
    delete this._maxPattern
}

Sprite_Enemy.prototype.setFrame = function(motion,num) {
    if (motion === "attack") {this._actor.performAttack()} else {this._actor.requestMotion(motion)}
   if (motion === "attack" && this.hasOwnProperty("_weaponSprite")) {
       var wpn = this._weaponSprite;
       wpn._pattern = num - 1;
       wpn._motionCount = 0;
       wpn.updatePattern();
   }
   this._pattern = num;
   this._motionCount = 0;
   this.setMaxFrame(num)
}

})()
Worked is my barely any tests.
It's just not made for it, I did edit it to work easily by changing it to enemies
Code:
(function() {
Sprite_Enemy.prototype.updateMotionCount = function() {
    if (this._motion && ++this._motionCount >= this.motionSpeed()) {
        if (this.hasOwnProperty("_maxPattern") && this._pattern === this._maxPattern) {this.refreshMotion(); return}
        if (this._motion.loop) {
            this._pattern = (this._pattern + 1) % 4;
        } else if (this._pattern < 2) {
            this._pattern++;
        } else {
            this.refreshMotion();
        }
        this._motionCount = 0;
    }
};


var alias = Sprite_Enemy.prototype.refreshMotion
Sprite_Enemy.prototype.refreshMotion = function() {
    var actor = this._enemy;
    if (actor) {
        if (this.hasOwnProperty("_maxPattern") && this._pattern === this._maxPattern) {return}
    }
    alias.call(this)
}

Sprite_Enemy.prototype.setMaxFrame = function(num) {
    this._maxPattern = num;
}

Sprite_Enemy.prototype.removeMaxFrame = function() {
    delete this._maxPattern
}

Sprite_Enemy.prototype.setFrame = function(motion,num) {
    if (motion === "attack") {this._actor.performAttack()} else {this._actor.requestMotion(motion)}
   if (motion === "attack" && this.hasOwnProperty("_weaponSprite")) {
       var wpn = this._weaponSprite;
       wpn._pattern = num - 1;
       wpn._motionCount = 0;
       wpn.updatePattern();
   }
   this._pattern = num;
   this._motionCount = 0;
   this.setMaxFrame(num)
}

})()
Worked is my barely any tests.

i didnt understand, but what' was it not made for it'? Actors and Enemies using the same skill?
And what does your edit do? it solves that little bug of they disappearing? should overwrite the original plugin with your edit?
i didnt understand, but what' was it not made for it'? Actors and Enemies using the same skill?
And what does your edit do? it solves that little bug of they disappearing? should overwrite the original plugin with your edit?

It wasn't made for animated SV enemies, just paste that into a 2nd plugin below the other one.

EDIT: Actually forgot to make it so if enemy doesn't have SV battler it won't check.
Code:
(function() {
Sprite_Enemy.prototype.updateMotionCount = function() {
    if (this._motion && ++this._motionCount >= this.motionSpeed()) {
        if (this.hasOwnProperty("_maxPattern") && this._pattern === this._maxPattern) {this.refreshMotion(); return}
        if (this._motion.loop) {
            this._pattern = (this._pattern + 1) % 4;
        } else if (this._pattern < 2) {
            this._pattern++;
        } else {
            this.refreshMotion();
        }
        this._motionCount = 0;
    }
};


var alias = Sprite_Enemy.prototype.refreshMotion
Sprite_Enemy.prototype.refreshMotion = function() {
    var actor = this._enemy;
    if (actor) {
        if (this.hasOwnProperty("_maxPattern") && this._pattern === this._maxPattern) {return}
    }
    alias.call(this)
}

Sprite_Enemy.prototype.setMaxFrame = function(num) {
    this._maxPattern = num;
}

Sprite_Enemy.prototype.removeMaxFrame = function() {
    delete this._maxPattern
}

Sprite_Enemy.prototype.setFrame = function(motion,num) {
    if (!this._svBattlerEnabled) return;
    if (motion === "attack") {this._enemy.performAttack()} else {this._enemy.requestMotion(motion)}
   if (motion === "attack" && this.hasOwnProperty("_weaponSprite")) {
       var wpn = this._weaponSprite;
       wpn._pattern = num - 1;
       wpn._motionCount = 0;
       wpn.updatePattern();
   }
   this._pattern = num;
   this._motionCount = 0;
   this.setMaxFrame(num)
}

})()
It wasn't made for animated SV enemies, just paste that into a 2nd plugin below the other one.

EDIT: Actually forgot to make it so if enemy doesn't have SV battler it won't check.
Code:
(function() {
Sprite_Enemy.prototype.updateMotionCount = function() {
    if (this._motion && ++this._motionCount >= this.motionSpeed()) {
        if (this.hasOwnProperty("_maxPattern") && this._pattern === this._maxPattern) {this.refreshMotion(); return}
        if (this._motion.loop) {
            this._pattern = (this._pattern + 1) % 4;
        } else if (this._pattern < 2) {
            this._pattern++;
        } else {
            this.refreshMotion();
        }
        this._motionCount = 0;
    }
};


var alias = Sprite_Enemy.prototype.refreshMotion
Sprite_Enemy.prototype.refreshMotion = function() {
    var actor = this._enemy;
    if (actor) {
        if (this.hasOwnProperty("_maxPattern") && this._pattern === this._maxPattern) {return}
    }
    alias.call(this)
}

Sprite_Enemy.prototype.setMaxFrame = function(num) {
    this._maxPattern = num;
}

Sprite_Enemy.prototype.removeMaxFrame = function() {
    delete this._maxPattern
}

Sprite_Enemy.prototype.setFrame = function(motion,num) {
    if (!this._svBattlerEnabled) return;
    if (motion === "attack") {this._enemy.performAttack()} else {this._enemy.requestMotion(motion)}
   if (motion === "attack" && this.hasOwnProperty("_weaponSprite")) {
       var wpn = this._weaponSprite;
       wpn._pattern = num - 1;
       wpn._motionCount = 0;
       wpn.updatePattern();
   }
   this._pattern = num;
   this._motionCount = 0;
   this.setMaxFrame(num)
}

})()


OMG DUDE IT WORKED !!!! <3 Thank you so much! I'll definitly credit you both in the project!
Yeah, sv enemies are just repurposed actor sprites, so changing sprite actor to sprite enemy should indeed work perfectly.

My original work did indeed not account for yanfly's animated sv battlers.

I'm glad both of you sorted things out.
I need help, I want to use it on the map not as a battle system
Screenshot_8.png
Screenshot_5.png
I need help, I want to use it on the map not as a battle system
You appear to be using two single quotations around ok - this is incorrect, it should be one set of single or double - 'ok' or "ok".

Also, is this in the correct thread? Your post doesn't appear to have anything to do with the plugin being discussed here for action sequences, and it doesn't appear to be trying to use the plugin code at all.

There are already plugins for ABS battle systems, if what you're looking for is fighting enemies on the map.

@littleBoyxd, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


Please make a new thread instead in the correct forum.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-action-sequence-frame-selection-control.95753/