Alright so we all know how Erase Event works. The event is erased, then when you re-enter the map the Event comes back until you erase it again.
I want to do something similar but with self switches.
On entering the map, all the events run an autorun that sets up the technical details and it's graphic. It then turns on a self switch, which makes it interactive by touching it.
Now, if the player leaves the map, or saves in the map, when he returns all the events don't have graphics because they didn't run the autorun.
My solution was to run a self-switch reseter on autorun in the top left like this:
for i in 1..30 $game_self_switches[[$game_map.map_id, i, "B"]]=false end $game_map.need_refresh = true
But I would rather just leave it up to the event instead of do it in a batch which may reset other event's self-switches accidentally.
Is there an easy, simple way to make a self switch reset on map enter/leave, preferably without making a new event?
when you start the leave map transition set a new switch to on, then make an event page in each event that you want the self switch to turn off on - this one will have the switch you set in the transition as a pre-requisite. then turn the self switch off in the new event page. then before the map transfer turn the new switch off.
This is just a quick guess though so it may not work. but from what I've seen in the project I'm working on, It may be possible.
I have class in 15minutes so I can check after class if you want
This post has been edited by Pharonix: Sep 16 2011, 08:24 AM
__________________________
CURRENT WORKS DEMON BLADE - RPGVXA SHINIGAMI - ~12 Pages - 3 chapters complete, 1 in progress. --------------------------------- OTHER WORKS INCANTA-corrupted. INCANTA REDUX - RPGVX - On Hold --------------------------------- LITERARY WORKS
Longer Works ANGEL OF DEATH - Short Story ~ 4 Pages. SHINIGAMI - ~12 Pages - 3 chapters complete, 1 in progress. DEMON BLADE - Book/Novel?- 34 pages - On Hold. FERAL - Short Story, Length: 6 pages], 2nd person Narrative. -R3 Writing Competition #2 - First-Place DARKSPAWN - Book - 3 Pages On Hold RELGEA CHRONICLE - Book - 118 pages DRAKENGHOUL - book - 36 handwritten pages
Poems I KNOW - Poem - 30 Lines
Song Lyrics End of Days - Song- 44 Lines Kids Killing Kids - Song - 94 Lines
-If you want this sig in another language, move to a country that speaks it.-
-Lv 13 Thread Killer
My R3 Writing Corner
My Wordpress
Relgea Chronicle
X-M-O Story Quoting.
QUOTE (X-M-O @ Jun 19 2012, 02:45 AM)
QUOTE (Pharonix)
so what's going on in this thread?
QUOTE (kayden997)
Redd's back and the first thing he does is...
QUOTE (Pharonix)
pick my mom up in 15 ...*sigh*
QUOTE (kayden997)
You know it's legit!
QUOTE (Pharonix)
Then again, I wrecked the last one...........
QUOTE (Tsutanai)
Oh ok you can have a pink frosted sprinkled doughnut
Group: +Gold Member
Posts: 1,199
Type: Scripter
RM Skill: Undisclosed
Not sure what you're looking for exactly, but try this:
spoiler
CODE
#============================================================================== # * Night5h4d3's Self Switch Resetter #------------------------------------------------------------------------------ # 9/16/2011 for: Titanhex #------------------------------------------------------------------------------ # Descr: # Ressets self switches on the current map based on the events name # How to use: # Add [N] to your event name, where N is the self switches (sepparated by # comma) to turn off (eg. [A, B, D]) # Config: # AUTO_RS_SS - This is the switch number to toggle automatic resseting of # self switches. turn the specified switch on to disable auto resetting. # NOTE: # You can still reset self switches by using $scene.reset_sswitches(true), # this will force a reset of the specified self switches on the current map. #------------------------------------------------------------------------------ # ** N5 module #============================================================================== module N5 AUTO_RS_SS = 1 end #============================================================================== # ** Scene_Base #------------------------------------------------------------------------------ # This is a superclass of all scenes in the game. #============================================================================== class Scene_Base def reset_sswitches(force? = false) return if $game_switches[N5::AUTO_RS_SS] or force? @from_save = from_save @name_slice = [] @temp_game_ss = $game_self_switches.clone for i in 1..$game_map.map.events.size if $game_map.map.events[i].name.include?("[") @name_slice[i] = $game_map.map.events[i].name.slice(/(\[)(.*)(\])/) @name_slice[i].gsub!(/[\[\,\]\s]/) {||} end end for i in 0...@name_slice.size for n in 0...@name_slice[i].size if @name_slice[i] != nil $game_self_switches[[$game_map.map_id, @name_slice[i], @name_slice[i][n]]] = false end end end return @temp_game_ss end end #============================================================================== # ** Scene_Map #------------------------------------------------------------------------------ # This class performs the map screen processing. #============================================================================== class Scene_Map #-------------------------------------------------------------------------- # * Player Transfer Processing #-------------------------------------------------------------------------- def update_transfer_player return unless $game_player.transfer? fade = (Graphics.brightness > 0) fadeout(30) if fade @spriteset.dispose # Dispose of sprite set reset_sswitches # N5 reset self switches $game_player.perform_transfer # Execute player transfer $game_map.autoplay # Automatically switch BGM and BGS $game_map.update Graphics.wait(15) @spriteset = Spriteset_Map.new # Recreate sprite set fadein(30) if fade Input.update end end #============================================================================== # ** Scene_File #------------------------------------------------------------------------------ # This class performs the save and load screen processing. #==============================================================================
class Scene_File < Scene_Base #-------------------------------------------------------------------------- # * Write Save Data # file : write file object (opened) #-------------------------------------------------------------------------- def write_save_data(file) @temp = reset_sswitches # N5 reset self switches characters = [] for actor in $game_party.members characters.push([actor.character_name, actor.character_index]) end $game_system.save_count += 1 $game_system.version_id = $data_system.version_id @last_bgm = RPG::BGM::last @last_bgs = RPG::BGS::last Marshal.dump(characters, file) Marshal.dump(Graphics.frame_count, file) Marshal.dump(@last_bgm, file) Marshal.dump(@last_bgs, file) Marshal.dump($game_system, file) Marshal.dump($game_message, file) Marshal.dump($game_switches, file) Marshal.dump($game_variables, file) Marshal.dump($game_self_switches, file) Marshal.dump($game_actors, file) Marshal.dump($game_party, file) Marshal.dump($game_troop, file) Marshal.dump($game_map, file) Marshal.dump($game_player, file) $game_self_switches = @temp end end
NOTE: This is in theory, I haven't tested it actually resetting the self switches. (can't yet)
__________________________
Got 30 minutes? Then you've enough time to play this awesome game: - potentially promising project page - thanks holder
Group: +Gold Member
Posts: 1,199
Type: Scripter
RM Skill: Undisclosed
The map resetter can't be aliased, simply because the reset command needs to be run in the middle of the def, but as for scene_file the same is not true, I actually missed that and forgot that I could alias it, youd do it like so:
CODE
class Scene_File < Scene_Base #-------------------------------------------------------------------------- # * Write Save Data # file : write file object (opened) #-------------------------------------------------------------------------- alias n5_wsd_old(file) write_save_data(file def write_save_data(file) @temp = reset_sswitches # N5 reset self switches n5_wsd_old(file) $game_self_switches = @temp # restore self switches end end
__________________________
Got 30 minutes? Then you've enough time to play this awesome game: - potentially promising project page - thanks holder