I have weapon animations I use with Yanfly for melee weapons but I want to add a ranged weapon and I don't want my characters sliding in and hitting the enemy with a slingshot. Any way I can change what happens when you choose the "Attack" option based on what weapon you're using
How to make a script that changes the attack animation depending on what weapon you have
Javascript/Plugin SupportSince this concerns Yanfly's plugins and how to mofidy/adapt them, I'm moving this to Javascript/Plugin Support.
I've moved this thread to Javascript/Plugin Support. Thank you.
Hello! What Yanfly plugins do you use for this? I assume you have Yanfly Battle Engine Core with it's Action Sequences pack, but do you have YEP_WeaponAnimation?
Pretty easy to do if you have those...
Pretty easy to do if you have those...
Yeah I have all of those and that's the issue I made an attack animation with it for the base attack that makes the characters move in to attack but I want it to cancel if they're holding a slingshot
You mean somethig like this?
*X is to be change for the weapon type Id of slingshots in your Database.
Code:
<target action>
if user.equips()[0].wtypeId === X
move user: 25
motion attack: user
motion wait: user
action animation
action effect: target
else
move user: target, front base, 15, auto offset x -20
motion attack: user
motion wait: user
action animation
action effect: target
end
</target action>
Oh thank you I had no idea you could do that. Is there any way I can change the button that says attack to shoot only if he weapon is equipped
Edit: It also crashes my game that code
that code just crashes my game Idk why maybe i don't have the plugins in the right ow
Hello again, maybe you should show us screenshots of your plugin manager and of the actual skill as this "code" works perfectly. It won't crash even if user doesn't have anything equiped in slot 0 or if you let there the X (tested it).
Ok so this is the code:
<setup action>
clear battle log
display action
immortal: targets, true
perform start
wait for movement
cast animation
wait for animation
</setup action>
<whole action>
</whole action>
<target action>
<target action>
if user.equips()[0].wtypeId === ShlingShot
move user: 25
motion attack: user
motion wait: user
action animation
action effect: target
else
move user: targets, front, 10
wait for movement
camera screen: target, front center, 15
camera focus: target, front center, 15
wait for camera
perform action
motion attack: user
action animation
wait for animation
action effect: target
death break
</target action>
<follow action>
</follow action>
<finish action>
immortal: targets, false
wait for new line
clear battle log
perform finish
wait for movement
wait for effect
</finish action>
And I'll send Images of the Plugin Manager
<setup action>
clear battle log
display action
immortal: targets, true
perform start
wait for movement
cast animation
wait for animation
</setup action>
<whole action>
</whole action>
<target action>
<target action>
if user.equips()[0].wtypeId === ShlingShot
move user: 25
motion attack: user
motion wait: user
action animation
action effect: target
else
move user: targets, front, 10
wait for movement
camera screen: target, front center, 15
camera focus: target, front center, 15
wait for camera
perform action
motion attack: user
action animation
wait for animation
action effect: target
death break
</target action>
<follow action>
</follow action>
<finish action>
immortal: targets, false
wait for new line
clear battle log
perform finish
wait for movement
wait for effect
</finish action>
And I'll send Images of the Plugin Manager
First, the Weapon Type Id should be a number. Check in your database 'Types' section.
Second you didn't close the if block; you miss a 'end' statement at the end, as in the exemple I provided above... 😛
EDIT: ...and you have 2 <target action> notetags...
Second you didn't close the if block; you miss a 'end' statement at the end, as in the exemple I provided above... 😛
EDIT: ...and you have 2 <target action> notetags...
oh wow now I have a whole seperate error oh mans it says "Cannot read property 'toUpperCase' of undefined
New Code:
<setup action>
clear battle log
display action
immortal: targets, true
perform start
wait for movement
cast animation
wait for animation
</setup action>
<whole action>
</whole action>
<target action>
if user.equips()[0].wtypeId === 13
move user: 25
motion attack: user
motion wait: user
action animation
action effect: target
else
move user: targets, front, 10
wait for movement
camera screen: target, front center, 15
camera focus: target, front center, 15
wait for camera
perform action
motion attack: user
action animation
wait for animation
action effect: target
death break
end
</target action>
<follow action>
</follow action>
<finish action>
immortal: targets, false
wait for new line
clear battle log
perform finish
wait for movement
wait for effect
</finish action>
EDIT: Removing the second Target Action did not stop the error
Hello!
It's because the line 'move user: 25' should be write 'move user: forward, 25'.
My bad, sorry :dizzy:
Writed the sequence quickly, just to show an exemple of the use of a conditionnal branch in action sequence... Thought you would input your own sequence 😛
Anyway, that should work now.
It's because the line 'move user: 25' should be write 'move user: forward, 25'.
My bad, sorry :dizzy:
Writed the sequence quickly, just to show an exemple of the use of a conditionnal branch in action sequence... Thought you would input your own sequence 😛
Anyway, that should work now.
Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-script-that-changes-the-attack-animation-depending-on-what-weapon-you-have.117773/