Quick question - How would I toggle a switch if you have all FTB turns left?

Status
Not open for further replies.

Rycoria

Creator of Riley
Veteran
Joined
Sep 25, 2013
Messages
58
Reaction score
11
First Language
English
Primarily Uses
Basically I want to have a switch turned ON when, in battle, you have all of your FTB actions remaining

(using Yanfly's Free Turn Battle: http://yanflychannel.wordpress.com/rmvxa/battle-scripts/ace-battle-engine/battle-system-free-turn-battle/)

and it to be turned OFF when any less than all of your FTB actions are remaining.

Example: 3 party members = 3 actions.

The switch is ON by default.

I have one member use "attack" and have 2 actions left.

The switch is OFF.

I make the other two "attack", the enemies attack, and it is the player's turn once again and all actions are restored.

The switch is ON.

Thank you.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
To toggle a switch, you just say $game_switches[id] = !$game_switches[id].


WHERE and WHEN you make that happen depends on the battle system. If it's part of the standard attack skill, you'd just enter that into the formula before what's already there, and separate them with a colon - ;


So it'll be

$game_switches[id] = !$game_switches[id]; <old attack formula here>However, if you want this to toggle with each attack by a party member, your first attack will turn it OFF, the second will turn it ON, and the third will turn it OFF (your example just toggles it once, even though two party members have had their turn).
If you ONLY want it to toggle when one of your party members attacks (and not an enemy), you would have to add that into the formula as a condition:

Code:
$game_switches[id] = !$game_switches[id] if a.actor?; <old attack formula here>
I haven't looked at the script. If the above is not enough, and you have to configure it especially for the script, or as part of the script, then a different approach may be needed.
 
Last edited by a moderator:

Rycoria

Creator of Riley
Veteran
Joined
Sep 25, 2013
Messages
58
Reaction score
11
First Language
English
Primarily Uses
Thanks for your help!

But how would I set a switch to a Boolean instead of toggling it?

$game_switches[id]=false didn't seem to work.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
It should have. Where did you do it? You did replace id with the number of the switch, right?


Toggling IS setting it to a boolean. If $game_switches[id] is true, then !$game_switches[id] is false.
 

Rycoria

Creator of Riley
Veteran
Joined
Sep 25, 2013
Messages
58
Reaction score
11
First Language
English
Primarily Uses
Haha, yes I changed id to 15, as that is the switch in question. ($game_switches[15]=false) I'm not that stupid...

I know toggling is setting it to a boolean, but I meant I needed to literally set it to true or false because I didn't want the switch to change back and forth each time, only set it false under certain conditions and set it true under other conditions. 

As it turns out, my syntax wasn't incorrect but I had put one of the lines of code in the wrong place so it just appeared it wasn't working properly. Now I've got it in the right place and it works great. Thanks a ton for your help Shaz! You can close this now. 
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I'm not that stupid...
lol - well, I like to make that assumption. But once when someone was having a problem, that's exactly what caused it :D So now I have to add it, just to make sure ;)


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top