Reset autoswitches?

Jogabba

Villager
Member
Joined
Aug 4, 2016
Messages
27
Reaction score
14
First Language
Spanish
Primarily Uses
Hi! I'm trying to make some sort of a "Choose your own adventure" game, which requires the player to go for more than only one playthrough.


To do so, it would be necessary to reset all the autoswitches the player has activated during the previous playthrough. Is there any way to do so? Maybe there's another way to approach this problem? 
 

Xenvex

Warper
Member
Joined
Oct 29, 2016
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Have you tried making an event at the end of the playthrough which turns off all switches in general? 
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
What is an auto Switch?


I just know regular "Switches" and "Self Switches".


Regular Switches:


You use the Eventcommand Control switches and choose "Batch" that allows to turn of a range of switches at once.


Self Switches:


You use Eventcommand Script on Page3


Here a simple script snippet made by a starter. Just execute it 1Time and all the self switches off all map events  on every map should be off.

Code:
for a in (1..999) 
if $game_map.map_id != nil
for b in (1..999)
if $game_map.events[a] != nil
$game_self_switches[[a, b, 'A']] = false
$game_self_switches[[a, b, 'B']] = false
$game_self_switches[[a, b, 'C']] = false
$game_self_switches[[a, b, 'D']] = false
end ; end
end
end
 
Last edited by a moderator:

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
do you mean like a new game plus? because else switches are remade at every time you start a new game...
 

Jogabba

Villager
Member
Joined
Aug 4, 2016
Messages
27
Reaction score
14
First Language
Spanish
Primarily Uses
Sorry! With autoswitches I meant Self Switches.

Have you tried making an event at the end of the playthrough which turns off all switches in general? 


That would work fine, but you can't turn off self switches from other maps or events, right?

What is an auto Switch?


I just know regular "Switches" and "Self Switches".


Regular Switches:


You use the Eventcommand Control switches and choose "Batch" that allows to turn of a range of switches at once.


Self Switches:


You use Eventcommand Script on Page3


Here a simple script snippet made by a starter. Just execute it 1Time and all the self switches off all map events  on every map should be off.




for a in (1..999)
if $game_map.map_id != nil
for b in (1..999)
if $game_map.events[a] != nil
$game_self_switches[[a, b, 'A']] = false
$game_self_switches[[a, b, 'B']] = false
$game_self_switches[[a, b, 'C']] = false
$game_self_switches[[a, b, 'D']] = false
end ; end
end
end


So this script will turn off all self switches? Sweet! I'll give it a try and post the results, thank you!
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
I made an error with the map id stuff, and i dont find the correct command i need.


But i see that it doesnt crash if the map id isnt existing, so it works without that line, also decreases the lag spike for that 1 seccond.

Code:
for a in (1..999) 
for b in (1..999)
if $game_map.events[a] != nil
$game_self_switches[[a, b, 'A']] = false
$game_self_switches[[a, b, 'B']] = false
$game_self_switches[[a, b, 'C']] = false
$game_self_switches[[a, b, 'D']] = false
end
end
end
 
Last edited by a moderator:

Jogabba

Villager
Member
Joined
Aug 4, 2016
Messages
27
Reaction score
14
First Language
Spanish
Primarily Uses
I made an error with the map id stuff, and i dont find the correct command i need.


But i see that it doesnt crash if the map id isnt existing, so it works without that line, also decreases the lag spike for that 1 seccond.



for a in (1..999)
for b in (1..999)
if $game_map.events[a] != nil
$game_self_switches[[a, b, 'A']] = false
$game_self_switches[[a, b, 'B']] = false
$game_self_switches[[a, b, 'C']] = false
$game_self_switches[[a, b, 'D']] = false
end
end
end




Thanks for your help, I'm truly amazed with your kindness! 


Both script snippets you've provided me do crash the game, though. SyntaxError: Unexpected Identifier. I'm not very experienced with script managing so maybe it's my fault. I just copied the script and pasted it in the line where I wanted to turn off all self switches.
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
Where exactly did you add it??? This is ment for use in Eventcommand on page 3 "Script".


LOL its my fault, mine is for Ruby VX-Ace, i oversaw that this is for MV. Sorry me casa no Java Script  thingy :).


Someone else will need to help.
 
Last edited by a moderator:

Dad3353

Veteran
Veteran
Joined
Mar 9, 2016
Messages
421
Reaction score
110
First Language
English
Primarily Uses
@Jogabba...


I got this to work, based on the above (which is not for MV, I think...)...


◆Script:for (var a = 1; a < 999; ++a)
:      :{  
:      :for (var b = 1; b < $gameMap.events().length+1; ++b)
:      :{
:      :$gameSelfSwitches.setValue([a, b, 'A'], false)
:      :$gameSelfSwitches.setValue([a, b, 'B'], false)
:      :$gameSelfSwitches.setValue([a, b, 'C'], false)
:      :$gameSelfSwitches.setValue([a, b, 'D'], false)
:      :}}


It may not be perfect (suggestions for improvement welcome...), but I tried it out on a couple of Test Maps and it worked just fine. No guarantees, however.


Hope this helps.
 

Jogabba

Villager
Member
Joined
Aug 4, 2016
Messages
27
Reaction score
14
First Language
Spanish
Primarily Uses
I found an incredible simple solution. 


$gameSelfSwitches.clear();


This line seems to do the trick all by itself!


Thank you guys for your help anyways, you're the best!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

"You can thank my later", "But you haven't done anything", "Well, that's why ..."
Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

Forum statistics

Threads
105,884
Messages
1,017,243
Members
137,609
Latest member
shododdydoddy
Top