- Joined
- Apr 22, 2022
- Messages
- 34
- Reaction score
- 17
- First Language
- English
- Primarily Uses
- RMMV
At least I think that's the problem anyway.. I'm making a skill that has to read the enemies 'agi' before initializing and it works great when there's only one enemy, things start going wrong with 2 or more though.
After killing one enemy with the skill, I sometimes get a "TypeError: Cannot read property 'agi' of undefined" crash when attempting to use it again. I can't even fully pinpoint when this is happening cause sometimes it happens on the second enemy, sometimes on the third. My theory is that it is still trying to read whatever the previous enemy was, as it sometimes occurs when an ally kills the enemy being targeted, but I just cant seem to get it to run a check at the right time. I am using SRD Timed Attack Core, SRD Timed Attack Action Sequence, and the battle core and 3 action packs from yanfly. This is my whole skill notetag but the line causing the problem is line 2 where I attempt to set the speed of the timed attack.
I feel bad asking about this again cause I did post something similar a few days ago, but I've really been struggling to get this to work and I think this is different enough to warrant its own topic..
On a side note though this skill is really fun when it works the way its supposed to and anyone is free to try it out =)
After killing one enemy with the skill, I sometimes get a "TypeError: Cannot read property 'agi' of undefined" crash when attempting to use it again. I can't even fully pinpoint when this is happening cause sometimes it happens on the second enemy, sometimes on the third. My theory is that it is still trying to read whatever the previous enemy was, as it sometimes occurs when an ally kills the enemy being targeted, but I just cant seem to get it to run a check at the right time. I am using SRD Timed Attack Core, SRD Timed Attack Action Sequence, and the battle core and 3 action packs from yanfly. This is my whole skill notetag but the line causing the problem is line 2 where I attempt to set the speed of the timed attack.
Code:
<Timed Attack: default>
speed: $gameTroop.aliveMembers()[BattleManager._action._targetIndex].agi
<End Timed Attack>
<Use Timed Attack Action Sequences>
<setup action>
PERFORM START
eval: $gameActors.actor(2).setBattlerImage('AlphonzeLarge2')
display action
motion ABNORMAL: user
wait: 120
CLEAR BATTLE LOG
Timed Attack
immortal: targets, true
</setup action>
<target action>
motion chant: user
move user: targets, center, 15
wait for movement
action animation: target
action effect
jump user: 300, 40
move user: home, 40
motion escape: user
face user: FORWARD
wait for movement
motion ABNORMAL: user
wait: 40
motion guard: user
wait: 40
eval: $gameActors.actor(2).setBattlerImage('AlphonzeLarge')
</target action>
I feel bad asking about this again cause I did post something similar a few days ago, but I've really been struggling to get this to work and I think this is different enough to warrant its own topic..
On a side note though this skill is really fun when it works the way its supposed to and anyone is free to try it out =)