Chaos Krux 29 Posted April 11, 2020 Greetings~ It is I, here to annoy you all once again with another question~ Sorry~ I while ago I made an item in my game that allows the player to disable random encounters for a limited number of steps, much like a repel item in a Pokémon game. The item, along with the common event it calls, work perfectly fine as they are. The problem I'm having is that the item also works in areas that would ordinarily have encounters disabled by default. As an example, there are some locations in my project in which encounters are disabled at first, but troops are still set to appear. This is because these areas will be revisited later with encounters turned on. However, if a player was to use the repel item in one of these locations before reaching a trigger that activates the encounters, then the encounters would be turned on automatically once the repel's effect wore off, meaning that enemies would be able to appear when they shouldn't. To remedy this, I would like to add a conditional branch to my repel common event that uses the script tab to check whether or not encounters are currently turned on. This way, I will be able to prevent the item from working at all if encounters are already turned off. The problem is that I have absolutely no idea what I need to type into the script tab in order to accomplish this. I have briefly checked through all of the sections in VX Ace's script editor that I thought might be connected to encounters, but I have been unable to find any sort of command I could use for a conditional branch. And so I have decided to ask if any of you lovely people might have a solution~ It's not necessarily a huge issue, but I'd imagine it would be rather confusing for the player if enemies suddenly started popping up in previously safe areas with no clear explanation given as to why. Any and all help any of you can give would be most appreciated~ Thank you~ Share this post Link to post Share on other sites
Lord Vectra 414 Posted April 11, 2020 I don't know your project, but one idea is to have an indicator. For me, I would just use the "show picture" command to have an indicator pop up in the corner or something and then have a parallel process running that will check time its been on and then when time is up, itll delete picture. So assuming this is an item: Common event 1: 60s Repellant (<= this is what the repellent would call) variable 1 = 60 Show Picture: Repellent_Icon Call common event: Common Even 2: Repel Common Event 2: Repel Parallel Process wait: 1 frame conditional branch: if variable 1 == 0 remove picture: 1 else variable 1: time -= 1 end Does that make sense? 1 Share this post Link to post Share on other sites
Chaos Krux 29 Posted April 11, 2020 41 minutes ago, Lord Vectra said: I don't know your project, but one idea is to have an indicator. For me, I would just use the "show picture" command to have an indicator pop up in the corner or something and then have a parallel process running that will check time its been on and then when time is up, itll delete picture. So assuming this is an item: Common event 1: 60s Repellant (<= this is what the repellent would call) variable 1 = 60 Show Picture: Repellent_Icon Call common event: Common Even 2: Repel Common Event 2: Repel Parallel Process wait: 1 frame conditional branch: if variable 1 == 0 remove picture: 1 else variable 1: time -= 1 end Does that make sense? My apologies, perhaps I wasn't clear. The Repel Item itself works perfectly fine, and the common events do not need any changes to make them function properly. The question I am asking is if there is any sort of script command I could use in a Conditional Branch in order to check whether or not encounters are currently on or off? Share this post Link to post Share on other sites
Kayzee 4,033 Posted April 12, 2020 You know, it would probobly be a better idea to have the item/event give a state with the party ability feature 'Encounter None' instead of turning encounters on and off via event. That's why it's there ya know. Just saying. Other then that... I am not sure just knowing if encounters are on or off would be enough. I mean, could you use the item before transferring to a map with no encounters? What would happen if you used the item while under effects of the item? In general I think it's just a bad idea two have two different things that don't keep track of each other try and modify the same thing. If you really want to do it by tuning on and off encounters for the whole game for some reason, you should pobobly have the event that the item runs set a switch, have the maps you want encounters to be off in set a different switch, and have a third common event that disables encounters if either of the switches is set. Still think you should set a state with 'Encounter None' on the party leader or something. You can even set and unset it via event instead of having the item directly set the event and it expiring in x steps or something if you want more control. 1 Share this post Link to post Share on other sites
Chaos Krux 29 Posted April 12, 2020 2 hours ago, Kayzee said: You know, it would probobly be a better idea to have the item/event give a state with the party ability feature 'Encounter None' instead of turning encounters on and off via event. That's why it's there ya know. Just saying. Other then that... I am not sure just knowing if encounters are on or off would be enough. I mean, could you use the item before transferring to a map with no encounters? What would happen if you used the item while under effects of the item? In general I think it's just a bad idea two have two different things that don't keep track of each other try and modify the same thing. If you really want to do it by tuning on and off encounters for the whole game for some reason, you should pobobly have the event that the item runs set a switch, have the maps you want encounters to be off in set a different switch, and have a third common event that disables encounters if either of the switches is set. Still think you should set a state with 'Encounter None' on the party leader or something. You can even set and unset it via event instead of having the item directly set the event and it expiring in x steps or something if you want more control. Well, I have already made it so that the item simply doesn't work if it's effect is already active, but I will admit I hadn't thought of the other things you mentioned. I suppose knowing whether or not encounters are on ultimately wouldn't make a difference in certain scenarios. Thanks for your input, I'll have to rethink this whole thing. Share this post Link to post Share on other sites
PhoenixSoul 1,404 Posted April 13, 2020 (edited) @Chaos Krux I think I have something. In Game_System, there's a line which does... @encounter_disabled = false I'd place the following in the script check: if @encounter_disabled = true $game_system.encounter_disabled OR !$game_system.encounter_disabled I can one hundred percent guarantee this works. Or, well, it doesn't throw any errors. The struck text is my first attempt; it throws an eval error likely because it's an if conditional in a conditional check. Oops, I blame it on the stress and this #SCAMDEMIC, among other things. But yeah; look at me, the coding novice, actually giving you the answer you sought, or so she's hoping... Edited April 13, 2020 by PhoenixSoul Did my own checks and figured out what doesn't throw an error 1 Share this post Link to post Share on other sites
Chaos Krux 29 Posted April 13, 2020 8 hours ago, PhoenixSoul said: @Chaos Krux I think I have something. In Game_System, there's a line which does... @encounter_disabled = false I'd place the following in the script check: if @encounter_disabled = true $game_system.encounter_disabled OR !$game_system.encounter_disabled I can one hundred percent guarantee this works. Or, well, it doesn't throw any errors. The struck text is my first attempt; it throws an eval error likely because it's an if conditional in a conditional check. Oops, I blame it on the stress and this #SCAMDEMIC, among other things. But yeah; look at me, the coding novice, actually giving you the answer you sought, or so she's hoping... That's perfect, actually~ Exactly what I was looking for~ Thank you, Phoenix~ I also figured out a way to solve the issues Kayzee brought up, so it actually works flawlessly now~ Thank you all~ 1 Share this post Link to post Share on other sites
Kayzee 4,033 Posted April 14, 2020 (edited) Yay! I am glad you got it to work! :3 Be careful if you are still using events and need to add a lot of special exceptions to get it to work the way you want. There might very well be edge cases neither of us thought of, and the more special exceptions something has the harder it becomes to figure out what's happening when something goes wrong. Edited April 14, 2020 by Kayzee 2 Share this post Link to post Share on other sites
PhoenixSoul 1,404 Posted April 14, 2020 11 hours ago, Chaos Krux said: That's perfect, actually~ Exactly what I was looking for~ Thank you, Phoenix~ Dé rìen, mon ami. 1 hour ago, Kayzee said: There might very well be edge cases neither of us thought of, and the more special exceptions something has the harder it becomes to figure out what's happening when something goes wrong. Mmm. The Wheel of Coding Torture is very real, lolz 1 Share this post Link to post Share on other sites