Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script switch management
#1
Script switch management
by GubiD
Aug 19, 2007

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given.


This is so you can flip exiting switches or self switches with script to make it easier for some mapping situations.

Code:
class Game_Map
  def switches(id = 0, value = false, type = 0, switch = "A")
    if id > 0
      if type == 0 #for use of main switches
        #id is switch_id and value should set to true or false
        $game_switches[id] = value
      elsif type == 1 #For use of self switches
        #id is event.id and switch is the desired selfswitch.  It must be text!
        #value is true or false
        key = [$game_map.map_id, id, switch]
        # Updates self switch
        $game_self_switches[key] = value
      end
      # Refresh map
      $game_map.need_refresh = true
      return true
    end
  end
end


You can call the script by doing the following...

To true a switch, $game_map.switches(switch_id, true) to false $game_map.switches(switch_id)

To true a self switch $game_map.switches(1, true, 1, "B"), to false it $game_map.switches(event_id, false, 1, "B")
The "B" is the desired self switch. The self switch must be text so be sure to use "A" or whatever switch you want.


If there are any problems with the script let me know.
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Modified Audio Encryption Script avatarmonkeykirby 0 2,310 07-28-2008, 01:00 PM
Last Post: avatarmonkeykirby
  Rotimikid's Enemy level Script ShockWave 0 2,407 08-24-2007, 01:00 PM
Last Post: ShockWave
  Nice game over script Moghunter 0 2,259 07-18-2007, 01:00 PM
Last Post: Moghunter
  Animated Options Script Samo the thief 0 2,240 06-18-2007, 01:00 PM
Last Post: Samo the thief
  Teleportation Script Digi 0 2,200 05-01-2007, 01:00 PM
Last Post: Digi
  Luck Script Darklord3652 0 2,206 04-10-2007, 01:00 PM
Last Post: Darklord3652
  GameOver Menu Script sasuke89 0 2,139 06-08-2006, 01:00 PM
Last Post: sasuke89
  Weapon Levelling Script GoldenShadow 0 2,149 07-05-2005, 01:00 PM
Last Post: GoldenShadow
  Ammo Script Dubealex 0 2,162 05-27-2005, 01:00 PM
Last Post: Dubealex
  Item Detail Script jackatrades 0 2,292 05-19-2005, 01:00 PM
Last Post: jackatrades



Users browsing this thread: