- Joined
- Mar 31, 2017
- Messages
- 56
- Reaction score
- 14
- First Language
- French
- Primarily Uses
- RMMV
<Custom Apply Effect>
$gameVariables.setValue(x, stateId); //id of the current state
$gameVariables.setValue(y, user._actorId); //user._actorId give you the id of the current actor, leave it like that
$gameTemp.reserveCommonEvent(9); //call the common even
</Custom Apply Effect>
<Custom Target Eval>
targets[0]=$gameActors.actor($gameVariables.value(y));
</Custom Target Eval>
EVAL: target.removeState($gameVariables.value(x));
@Miseryfactory77 yup, I'm just a villager, i started RPG maker 4 months ago. But I love code and I know a bit of javascript. I spent some time reading plugins code, and RMMV code to to know exactly what's going on behind the curtain. Now I use this knowledge to answer questions.
If you do an attack like that, you can simply the code a lot :
animation 128: user, mirror
move user: targets, back base, 12
motion swing: user
face user: forward
animation 7: target
action effect
wait for movement
if a.agi>b.agi
wait: 20
motion swing: user
face user: target
animation 128: user
move user: target, front base, 12
animation 7: target
action effect
wait for movement
end
IF a.agi>b.agi*2
wait:20
animation 128: user, mirror
move user: targets, back base, 12
motion swing: user
face user: forward
animation 7: target
action effect
wait for movement
wait:20
motion swing: user
face user: target
animation 128: user
move user: target, front base, 12
animation 7: target
action effect
wait for movement
end
IF a.agi>b.agi*3
wait:20
animation 128: user, mirror
move user: targets, back base, 12
motion swing: user
face user: forward
animation 7: target
action effect
wait for movement
wait:20
motion swing: user
face user: target
animation 128: user
move user: target, front base, 12
animation 7: target
action effect
wait for movement
end
If you do consecutive "if" statement because you attacks are the same. You just add an attack if the agi is higer. So you perform 1 attack, then if a.agi>b.agi you perform an other one, and if a;agi>b.afi*2 you perform 2 more and so one. This way it will be easier for you to code, and to read your code.
Wow you are the best I cannot believe that this works this is amazing thank you. Now because I dont think that its possible to create a series of if statements that are conditional upon an if statement inside of the if statment perhaps you could help advise how I go about doing this.@Miseryfactory77 My bad, a. abd b. are used in the damage box, but in javascript conditions, you have to use
IF user.agi>target.agi
I tried it, and it work now :
animation 128: user, mirror
move user: targets, back base, 12
motion swing: user
face user: forward
animation 7: target
action effect
wait for movement
if user.agi>target.agi
wait: 20
motion swing: user
face user: target
animation 128: user
move user: target, front base, 12
animation 7: target
action effect
wait for movement
end
IF user.agi>target.agi*2
wait:20
animation 128: user, mirror
move user: targets, back base, 12
motion swing: user
face user: forward
animation 7: target
action effect
wait for movement
wait:20
motion swing: user
face user: target
animation 128: user
move user: target, front base, 12
animation 7: target
action effect
wait for movement
end
IF user.agi>target.agi*3
wait:20
animation 128: user, mirror
move user: targets, back base, 12
motion swing: user
face user: forward
animation 7: target
action effect
wait for movement
wait:20
motion swing: user
face user: target
animation 128: user
move user: target, front base, 12
animation 7: target
action effect
wait for movement
end
<Custom Target Eval>
targets.push(target); //Initialize the targets with the selected target
if (user.isStateAffected(x)){
targets.push(target); //if you have the right state, add the same target again
}
</Custom Target Eval>
Wow you never fail to impress and it most certainly did work so perhaps I could find another use for that. The reason I need to have that applied but instead have my animations change is because in order for it to be true to the skill the number of hits changes on the slice not by him slicing again. Hard to explain but essentially in the note for the double slash skill we have been modifying action effect would be noted twice on the skill where the damage is calculated to generate 2 hits on a single slash. I know I have to note more but it makes the skill work the way I want better.@Miseryfactory77 If you want to attacktwice as much if your battler have state x, don't bother doing it in <target action>. You can use yanfly target core, and use it to target your ennemy twice if your battler have state x. <target action> will repeat for every target, so if you have 2 target (which is twice the same in fact) <target action> will play twice and you will have the expected result. And if you want to play it 3 times, then juste add the target one more time.
Here is the code:
Just add this to your skill, and it should work.Code:<Custom Target Eval> targets.push(target); //Initialize the targets with the selected target if (user.isStateAffected(x)){ targets.push(target); //if you have the right state, add the same target again } </Custom Target Eval>
Exactly I will code double slash 2 and I know how to use a state to add a skill but here is the catch. Since this state will alter all of this battlers known skills somehow a check will have to be done to see if he knows skill x and if he does then skill x is replaced with the skill the state gives for the duration of the state however when the state ends he gets his other skills back.@Miseryfactory77 If you want to change the skill depending of if the battlerhave state x or not, my trick won't work indeed. But you can modify the state x, to gain so time. When state x is apply, your battler lose double slash 1, but gain double slash 2 which have different animations and more hits.
You still have to code double slash 2, but don't have to bother if user.isStateAffected(x) , only if user.agi>target.agi.
You can use my trick to win some time if the number of attack is pair.
If this still don't answer your question, maybe you can give me a step by step explanation. If you do, I can give you a more precise and specific help.
user.isLearnedSkill(3)
<Custom Apply Effect>
if (user.isLearnedSkill(x)){
user.forgetSkill(x);
user.learnSkill(y);
}
</Custom Apply Effect>
<custom remove effect>
if (user.isLearnedSkill(y)){
user.forgetSkill(y);
user.learnSkill(x);
}
</custom remove effect>
Okay so my skill double slash is well actually its called rush fang so anyways rush fang is skill 48 and the recoded rush fang named *rush fang is the same however the action effect I have noted twice so in the twin-mirage state I put this in the states notebox@Miseryfactory77 the code to know if a battler have a skill is :
So If you want a state do add or remove a skill, the code below workCode:user.isLearnedSkill(3)
Code:<Custom Apply Effect> if (user.isLearnedSkill(x)){ user.forgetSkill(x); user.learnSkill(y); } </Custom Apply Effect> <custom remove effect> if (user.isLearnedSkill(y)){ user.forgetSkill(y); user.learnSkill(x); } </custom remove effect>
@Miseryfactory77 Do you have the yanfly plugin buffs & state core? You need it to unlock <custom apply effect>on your state.
I don't know what to say, it work for me. I tried the code I copy/past, and the effect apply with the state apply inside battle, and outside battle.
If you have hard time making it work, you can try with common even, these are able to check if a battler have a skill or not. It should work too.
<damage formula>
if (user.isStateAffected(21){
value = user.atk + user.agi*3.5-target.def;
} else {
value = user.atk + user.agi*2-target.def;
}
</damage formula>