Reset map script

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
I'm looking for a way to reset an entire map via one script call.

I know this is possible with event pages, but I'm trying to do this for 16ish maps with 40~100 events on each map..

Having a script call to do this would be enormous! Is this tough to do?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
What are you trying to accomplish?


Resetting a map is as easy as simply reloading it, but that comes with a lot of consequences.
 
Last edited by a moderator:

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
Just to reset the map to it's original state, no self switches on, people alive, etc

Best case scenario, a script call that says ->reset map 1
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
Event positions and such things are automatically reset on entering a map - in fact you need a script to store a change in event positions to prevent this.


So the only things that would need reset are the switches, self-switches and variables used on that map.


There probably is a way to automate that for self-switches by script, but to reset general switches and variables automatically can cause a lot of logic problems. Better you make a common event "reset for map xy" and manually control them back.
 

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
Self switches are my main concern. If I have to manually set switches and variables I have no problem with that.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Ok then let's start with something simple

class Game_Map def reload_map setup(@map_id) SceneManager.scene.instance_variable_get:)@spriteset).refresh_characters endendScript call: $game_map.reload_mapNo different from exiting and re-entering a map.
 
Last edited by a moderator:

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
This works perfect for resetting the map to its condition from within the map. edit: This actually pans your camera off the center of your character

Now is there a way to globally reset all switches for that map via script?

A way to do:

Event 1 in this map = self switch a/b/c/d off

is all I need. I can repeat this 100 times if need be and set it in the aforementioned script.

I can then call the script and copy pasta on each map. It would reduce the workload by many many hours
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Code:
class Game_Map
  def reload_map
    setup(@map_id)
    @events.each do |id, ev|
      # assumes there are only 4. Bad assumption. Assumes "OFF" is the default state.
      $game_self_switches[[@map_id, id, "A"]] = false
      $game_self_switches[[@map_id, id, "B"]] = false
      $game_self_switches[[@map_id, id, "C"]] = false
      $game_self_switches[[@map_id, id, "D"]] = false
    end
    SceneManager.scene.instance_variable_get:)@spriteset).refresh_characters
  end
end
 
Last edited by a moderator:

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,309
Reaction score
531
First Language
indonesian
@flipwon: for the camera do you mean it pan the camera permanently? Or just for split second and then fixed. Or need to move before fixed. If only split second. Try using fadeout and fadein to hide that.

@hime: maybe adding checkpoint feature. Something like this maybe:

Code:
def checkpoint @events.each do |id, ev| Store the current state of the self switches in a hash variable inside game system. Which will be accessed instead just false if exist. I post using phone. So I cannot type the code . endend
Even we can also store certain event only. By passing array containing event id we want to create the check point. Then add some next if array include id in the each do statement.
 

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
class Game_Map def reload_map setup(@map_id) @events.each do |id, ev| # assumes there are only 4. Bad assumption. Assumes "OFF" is the default state. $game_self_switches[[@map_id, id, "A"]] = false $game_self_switches[[@map_id, id, "B"]] = false $game_self_switches[[@map_id, id, "C"]] = false $game_self_switches[[@map_id, id, "D"]] = false end SceneManager.scene.instance_variable_get:)@spriteset).refresh_characters endend
Perfect. Hime you rock
 

flipwon

Veteran
Veteran
Joined
May 11, 2013
Messages
59
Reaction score
0
First Language
English
Primarily Uses
@flipwon: for the camera do you mean it pan the camera permanently? Or just for split second and then fixed. Or need to move before fixed. If only split second. Try using fadeout and fadein to hide that.

@hime: maybe adding checkpoint feature. Something like this maybe:

def checkpoint @events.each do |id, ev| Store the current state of the self switches in a hash variable inside game system. Which will be accessed instead just false if exist. I post using phone. So I cannot type the code . endendEven we can also store certain event only. By passing array containing event id we want to create the check point. Then add some next if array include id in the each do statement.
It's a permanent pan within the map. I just do a quick fade reload though and it seems to work fine.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top