Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 5 posts ] 
    Amy
  Mon May 06, 2019 6:24 pm
User avatar
Staff

Big Dumb Guy
Hi,

I've managed to edit the counter attack function so that it applies a different skill for a certain enemy, instead of attacking. My function looks like this:



BattleManager.invokeCounterAttack = function(subject, target) {
var action = new Game_Action(target);

if (target.enemyId() == 2)
{
action.setSkill(17);
}
else
{
action.setAttack();
};


action.apply(subject);
this._logWindow.displayCounter(target);
this._logWindow.displayActionResults(target, subject);
};




This works absolutely fine. Excecutes the skill number 17. BUT...

- Doesn't play any associated common event
- Doesn't show any animation on the player


Does anyone know what command I need to use alongside setSkill(x) to make that happen? Long shot, I know.


Top Top
Profile      
 

    Xilef
  Mon May 06, 2019 7:05 pm
User avatar
Staff

Big Dumb Guy

Location: UK
Does the normal counter attack play any animation on the player? That would indicate that there's a limitation to how the counter attack is implemented in MV.

From looking at the code, the action object is created and then discarded in the invokeCounterAttack function, which means that it's simply being used as damage calculation, rather than animation/event or whatever (notice how that action object is never sent off to anything, it's just setAttack and then apply to subject).

I'd inspect the way actions are handled, it looks like there's a startAction, updateAction, endAction thing in the BattleManager:
https://github.com/rpgtkoolmv/corescrip ... Manager.js

The counter attack is modified in the updateAction phase, I have a feeling that to change this to a skill with animations + common events, etc you'd need to first end the currentAction, then start your skill as a new action.

What I'd probably do is figure out how the Force Action event command works and hijack that:
https://github.com/rpgtkoolmv/corescrip ... r.js#L1717

Maybe you'd need something like:
battler.forceAction( skillId, targetIndex );
BattleManager.forceAction( battler );


Top Top
Profile      
 

    Amy
  Mon May 06, 2019 9:22 pm
User avatar
Staff

Big Dumb Guy
Excellent thank you.

Yeah you were right, even the counter attack didn't show any animation.

Replacing setSkill(x) with this worked:


$gameTroop.members()[0].forceAction( 17, subject );
BattleManager.forceAction( target );



I had to use $gameTroop.members()[0] because target just gave me errors for some reason. Not a problem as this is only going to be used in one boss fight where there's only one enemy in the troop.


Top Top
Profile      
 

    Xilef
  Mon May 06, 2019 9:30 pm
User avatar
Staff

Big Dumb Guy

Location: UK
Strange that target gives you errors on the first line but not the second line - which does expect a battler. Could be that the BattleManager.forceAction doesn't actually do anything and you're just good with the first line. Also you're in the BattleManager so you can just use this.forceAction( target )


Top Top
Profile      
 

    Amy
  Mon May 06, 2019 10:02 pm
User avatar
Staff

Big Dumb Guy
It seems to think target is null, when target has been grabbed from the function arguments. So perhaps BattleManager.forceAction will work with null as an argument.

(Target and subject are the opposite way around, by the way, because this is a counter attack, so the target is attacking the subject)


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: No users and 31 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group