Check if skill is used

Hisao Shou

Veteran
Veteran
Joined
Jan 8, 2015
Messages
159
Reaction score
23
Primarily Uses
How to check if a certain skill is used with conditional branch? 


For example , IF skill Fire is used the enemy says something.


and IF the player uses other skill than Fire enemy says something else.
 


How can I do this?


Edit: 


-first time when I enter in that battle there should be a text, telling the player what should do.


-after Fire Skill is used, I don't want it to repeat, I want to change the troop event page and put there another condition for another skill , for example: ice skill. And if i use Fire skill on 2nd page (ice skill condition one) the enemy should say something like "this is not the right skill to beat me"


-I know that there will be an skill used to change troop event pages (via switch) , and to change again to another page there should be an conditional branch, but if the condition is not applied there will be a loop (with moment span) , and if I put "Turn" to span, it will work after every attack, but will happen what i said earlier, even if i use the Fire skill the enemy still tells me that i used wrong skill because Turn seems to check too late the condition.


-I want when switching between troop pages, to NOT show the "if is not applied" statement until player uses wrong skill.



What i am trying to make is a way to beat an enemy only with a certain skill per turn (then enemy should say something), and if the player uses wrong skill the enemy should tell player that wrong skill has been used.
 
Last edited by a moderator:

BlackBoxx

Villager
Member
Joined
Jun 13, 2016
Messages
14
Reaction score
1
First Language
English
Primarily Uses
What I would do is have your fire skills all flip a switch to on.  All fire skills should do this.  Either use a common event as part of the skills effect or if you have a plugin  to handle it, that would work.


Then, in battles where you want this to take place, set an event page in the troops tab.  Have it set to Moment (to have this happen the instant the skill finishes).  As a condition, have it activate once the switch you chose is on.


Then  have the event do whatever it is you want it to do.


Lastly, at the end of the event, have it flip the switch back off (*snicker*... flip the switch off :p) so it doesn't keep calling the event.


As for saying something different when other skills are used, you can do the same thing, just assigning and checking different switches.
 

Hisao Shou

Veteran
Veteran
Joined
Jan 8, 2015
Messages
159
Reaction score
23
Primarily Uses
I have tried this... but i get something like this:
 


-hi 


-use fire skill please


-you didn't use fire skill


(after i use another skill)


- you didn't use fire skill


(after i use the right skill)


- you didn't use fire skill


(AGAIN after i use the right skill)


- you used fire skill.


If i let the page on moment it will always check if conditions apply and does not let me do anything.


Its something like:


-you didn't use the fire skill


-you didn't use the fire skill


-you didn't use the fire skill


and so on...


I think that this cannot be done with events easly... Because there would be too many variables and switches and I need every enemy to react at different skills and say something different.
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
You could have your skills add a dummy state (a blank state unique to each skill) to the enemy or user (whichever you prefer), then use a troop event to check for that state. After showing whatever dialogue you want, remove the state so that the troop event won't go into an infinite loop.


Edit: Didn't even see @BlackBoxx's response. Pretty much the same suggestion.
 
Last edited by a moderator:

BlackBoxx

Villager
Member
Joined
Jun 13, 2016
Messages
14
Reaction score
1
First Language
English
Primarily Uses
I have tried this... but i get something like this:
 


-hi 


-use fire skill please


-you didn't use fire skill


(after i use another skill)


- you didn't use fire skill


(after i use the right skill)


- you didn't use fire skill


(AGAIN after i use the right skill)


- you used fire skill.


If i let the page on moment it will always check if conditions apply and does not let me do anything.


Its something like:


-you didn't use the fire skill


-you didn't use the fire skill


-you didn't use the fire skill


and so on...


I think that this cannot be done with events easly... Because there would be too many variables and switches and I need every enemy to react at different skills and say something different.



I suspect there's something you're overlooking in your condition setup.  Likely, you don't have a switch set properly to trigger the correct condition, or your conditions themselves are incorrect. 


For the page you have set to activate on Moment setting, If it's repeating, it means you haven't put in a condition clear (like returning the switch to the off state at the very end), so the condition remains true.  Therefore, the page is good to go the very next moment.


I'll try to go into more detail for what I'm talking about:


-First, create a common event.  Name it 'Fire Skill' or something that helps you identify it at a glance.  This event needs to do just one thing: turn a switch on.  Any switch.  Name it 'Fire Switch' or something to help you identify its use. 


-Next, make your fire skill.  I assume you've got that done already.  That's one of the simplest things RPG Makers can do.  In the Effects section, add a new effect.  Choose the 'Other' tab.  At the very bottom is an option to call a common event.  Choose that and call Fire Skill.  This will make it so that every time the skill is used, it will flip that switch.  You should do this step for every fire skill you want to apply for this effect you're trying to create.


-Next, create your enemy and place it in a troop.  In the Battle event section, create a page or modify the initial one to have the following setting:


           1. Conditions: Fire Switch (this will make it happen only when the fire switch is turned on, which your skill should do every time it is used).


           2. Span: Moment (this will make the event execute the instant that switch in the conditions gets turned on; every time a fire skill with the common event attached to it is used).


           3. In the event scripting section, have the event do whatever it is you want it to do (make a text box appear and say something)


           4.At the very end of the event use "Control Switch: Fire Switch = OFF" (this will stop it from repeating itself indefinitely, though it will make the event play every time you use a fire skill, so if that's not what you want, let me know.  There is some other tweaking you can do to fix this).


I hope that clarifies some things.
 

Hisao Shou

Veteran
Veteran
Joined
Jan 8, 2015
Messages
159
Reaction score
23
Primarily Uses
Oh, I am sorry , i think i forgot to tell more details. 


I am really sorry.


But yes, BackBoxx , i did what you said. and it works but is not that simply what I want.


-first time when I enter in that battle there should be a text, telling the player what should do.


-after Fire Skill is used, I don't want it to repeat, I want to change the troop event page and put there another condition for another skill , for example: ice skill. And if i use Fire skill on 2nd page (ice skill condition one) the enemy should say something like "this is not the right skill to beat me"


-I know that there will be an skill used to change troop event pages (via switch) , and to change again to another page there should be an conditional branch, but if the condition is not applied there will be a loop (with moment span) , and if I put "Turn" to span, it will work after every attack, but will happen what i said earlier, even if i use the Fire skill the enemy still tells me that i used wrong skill because Turn seems to check too late the condition.


-I want when switching between troop pages, to NOT show the "if is not applied" statement until player uses wrong skill.



What i am trying to make is a way to beat an enemy only with a certain skill per turn (then enemy should say something), and if the player uses wrong skill the enemy should tell player that wrong skill has been used.


And if there is a way to do this with events, I want this to be as simple as possible, because I need to do this thing with almost all enemies.


I edited the main post with these details, sorry for confusion.
 
Last edited by a moderator:

BlackBoxx

Villager
Member
Joined
Jun 13, 2016
Messages
14
Reaction score
1
First Language
English
Primarily Uses
Oh, I am sorry , i think i forgot to tell more details. 


I am really sorry.


But yes, BackBoxx , i did what you said. and it works but is not that simply what I want.


-first time when I enter in that battle there should be a text, telling the player what should do.


-after Fire Skill is used, I don't want it to repeat, I want to change the troop event page and put there another condition for another skill , for example: ice skill. And if i use Fire skill on 2nd page (ice skill condition one) the enemy should say something like "this is not the right skill to beat me"


-I know that there will be an skill used to change troop event pages (via switch) , and to change again to another page there should be an conditional branch, but if the condition is not applied there will be a loop (with moment span) , and if I put "Turn" to span, it will work after every attack, but will happen what i said earlier, even if i use the Fire skill the enemy still tells me that i used wrong skill because Turn seems to check too late the condition.


-I want when switching between troop pages, to NOT show the "if is not applied" statement until player uses wrong skill.



What i am trying to make is a way to beat an enemy only with a certain skill per turn (then enemy should say something), and if the player uses wrong skill the enemy should tell player that wrong skill has been used.


And if there is a way to do this with events, I want this to be as simple as possible, because I need to do this thing with almost all enemies.


I edited the main post with these details, sorry for confusion.



***EDIT:  Wow, that was a wall of text!  Sorry!  Added some line breaks to make it more legible.***


Ah.  I think I get it now.  But just let me ask another question for clarification.


-Are the skill types to be used going to be different for every enemy you make (or the majority that will use this effect)?  If so, this is going to use up a lot of switches and unique battle events for every troop you create.  I don't see a way around that without using some extensive plugin support (which, unfortunately, I know very little about beyond looking up the latest Yanfly updates).  So it may end up simple, but it will be tedious.  Just be prepared for that.


What I'm thinking will expand the event page I told you about... like, a lot...  But it is gonna be a lot of copy/paste shenannigans, so it won't be difficult to make.  It will make it difficult to sift through if an error pops up (I don't have all that much experience in programming, so my methods just aren't that efficient most of the time.  Apologies).


So here's what I'm thinking:


-We make a new switch.  Call it 'Master Skill Switch' (all these names are just arbitrary, so go ahead and name it whatever will help you remember its purpose).


-In the Fire Skill common event you made, edit it to also turn Master Skill Switch on (it should now flip two switches on).


-We're going to repeat this step every time you make a new skill type: using up a new switch to apply across all skills of said type (ice switch, thunder switch, slashing switch, etc.).  


****To make things easier on you, if you already know every skill type you plan to add, put all the switches you would need in consecutive order.  Just make them all at the same time.  This will make the final step much easier as you can use the simple command of flipping all switches within a range to the same position all at once, rather than naming each individual one***


-Then, you have to edit every skill of each type (you only need to apply it to skills that target the enemy, unless you're going to make some unorthodox battles where buffing a party member is the next step) to call its own version of the Fire Skill common event (renaming them to as appropriate).  It will flip only its type switch on AND Master Skill Switch.


-Now, we're moving on to variables.  Use one and call it something like Skill Sequence.


-Then, moving on to our troop battle events, create a new page.  Set its condition to Turn 0 + 0. This will happen as soon as the battle begins, before the player can enter any commands.  Have the event inform the player of whatever it is they should know (the skill type to use first, I believe you said). Then, set the variable we just made to 1.


-Now, move on to the battle event page we already made. Change the condition to Master Skill Switch instead of Fire Switch.  Also add the condition "Variable Skill Sequence = 1".  Keep the span set to Moment.


-In the content for the event, we're going to make this simple.  We now have to make an If, Then, Else case.  Start with a Conditional Branch: Fire Switch = ON.  Click the 'Create Else Branch' box at the bottom.  This will create a sequence of events that we will use when the player does not use the correct skill.


-In the main body of the branch (the part that meets the conditions you want), have it tell the player they have used the correct skill.  Have it perform whatever else you want to happen, if anything.  Finally, have it add one to Skill Sequence (Control Variable-Single: Skill Sequence-Operation: Add-Constant: 1).


-In the Else branch that we created, have the event tell the player they failed to use the correct skill type.


-Now, outside of all branches (just place this at the very end of the whole event), have the event turn off all related skill switches.  This is where the ***note*** I gave you will make your life easier.  If all skill switches you will ever need are in consecutive order and no other switch type is between any skill switch, you can just do this one simple command:  Control Switches- Range (number of the earliest skill switch you use) ~ (number of the latest one)- Operation OFF.  If you did not put them all in order, you will have to turn each individual switch off.


-Now the tough part...  You have to do this for each sequence in your iteration.  Whatever the next skill type you want your player to use will need its own event page.  I advise you to copy/paste the page, then just edit in the differences (change the conditions for which skill type you're looking for, change the text info, etc.).  Make sure you edit the condition of the page itself as well to reflect the next value for Skill Sequence (the second skill you want the player to use should have the condition Skill Sequence = 2, the third = 3, and so on).


-If you want the skill sequences to loop (say you begin with fire, move on to ice, then earth and want it to start the chain over as many times as needed), you need to make the final page event reset Skill Sequence to 1, rather than add one to it.  Just change the Operation from Add to Set.  However, if you want the chain to end, simply keep the command to add 1 to Skill Sequence, and just make no page to activate with the condition for that number in the chain.


I know, it's a lot of work.  That's the nature of the beast, unfortunately.  It is simple once you get into the habit of it, and it only gets easier.  Make a few custom troop event sequences to test it out.  It will become second nature.  Just a few modifications here and there with a lot of copy/pasting.  


Best of luck to you.... Wait.  I hate luck.  I'll just wish you success instead :p.  I will keep an eye on this thread for a little bit, though I do have some plans later in the day, so don't panic if I or someone else do not get back to you in a timely manner.  I will return (*cue my own personal Batman-esque theme music as I dart away into the day*)
 
Last edited by a moderator:

Hisao Shou

Veteran
Veteran
Joined
Jan 8, 2015
Messages
159
Reaction score
23
Primarily Uses
Thank you, I managed in the end to finish this somehow.


Thank you for your answers.
 

Latest Threads

Latest Posts

Latest Profile Posts

2021? I still wonder if people still doing MV than MZ more
Seeing a lot more active Ace topics recently, is it making a comeback? :o
0-7, left-to-right, top-to-bottom
As soon as I'm able to get out of bed I'm probably gonna go so hyper from being too cooped up, and burn myself out into another awful flare. lol
It makes me feel proud whenever an RM game does well. Even though I had nothing to do with it.

Forum statistics

Threads
107,627
Messages
1,031,010
Members
139,746
Latest member
Krunga
Top