• Announcements

    • RagingHobo

      Forum Upgraded!   07/17/2017

      We have successfully upgraded our forum to the latest version! Some things have moved around but don't worry everything is still there, we still need to find updated versions of the plugins we were using previously to restore everything to the way it was. There will be a running topic in the Feedback and Support in case you notice something wrong. Before you do so please clear your browser cache and close your browser completely to rule out a caching issue. Thank you for your patience during the outage and while we get everything back to 150%  
Nicke

Simple Self Switches

10 posts in this topic

Simple Self Switches

Version: 1.0a.

Introduction

Change your Self Switches easy by using this script. Simply use the call script function to change self switch of the Event ID to true or false.

 

Features

  • Plug and play.
  • Easy to change Self Switches.
  • Use a variable to change Self Switches on another map.
  • Set all Self Switches of an Event ID to true/false with a single call script.
  • Check if a Self Switch is on using a Conditional Branch.

Screenshots

No.

 

How to Use

To install this script, open up your script editor and copy/paste this script to an open slot below Materials but above Main. Remember to save.

 

Script

 

 


#==============================================================================
#   Simple Self Switches
#   Author: Nicke
#   Created: 16/06/2011
#   Edited: 03/01/2012
#   Version: 1.0a
#==============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below â–¼ Materials but above â–¼ Main. Remember to save.
#
# Use the call script to use this script.
#
# setSelfSwitch (map, id, A-D, true/false)
# isSelfSwitch?(map, id, A-D, true)
# setAllSelf(map, id, true/false)
#
# Note: You can use @map_id if you change the self switches on the same map.
#
# Example 1: setSelfSwitch(@map_id, 1, "A", true)
# This will change the Self Switch "A" of event ID 1 to true on current map.
# Example 2: setSelfSwitch(2, 1, "A", false)
# This will change the Self Switch "A" of event ID 1 to false on map id 2.
#
# You can also check if Self Switch is true/false.
# Example: isSelfSwitch?(2, 1, "A") # Is event_id 1 true on map id 2?
# Example: !isSelfSwitch?(@map_id, 1, "A") # Is event_id 1 false on current map?
# Put this in a Conditional Branch.
#
# Last but not least you can turn all Self Switches to true/false.
# Example 1: setAllSelf(2, 1, true) Set all of event id 1 true on map id 2.
# Example 2: setAllSelf(@map_id, 1, true) Set all of event id 1 to true on current map.
#
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["NICKE-EVENT-SELFSWITCHES"] = true
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Game_Interpreter
#==============================================================================#
class Game_Interpreter

 # // Set SelfSwitch to true/false.
 def setSelfSwitch(map, eID, selfSwitch, trueFalse)
switch = [map, eID, selfSwitch]
$game_self_switches[switch] = trueFalse
 end

 # // Is SelfSwitch true/false?
 def isSelfSwitch?(map, eID, selfSwitch)
switch = [map, eID, selfSwitch]
$game_self_switches[switch]
 end

 # // Set all SelfSwitches to true/false.
 def setAllSelf(map, eID, trueFalse)
switches = ["A","B","C","D"]
for i in switches
  setSelfSwitch(map, eID, i, trueFalse)
end
 end

end # END OF FILE

#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#

 

 

 

Updates

Released 1.0a. Should be pretty easy now changing a self switch on another map.

 

Credit

Credit me, Nicke, if you are going to use it. Thanks.

Can be use in a commercial project.

Edited by Niclas
SixShotSamael likes this

Share this post


Link to post
Share on other sites

Nice script you got there. I love Self Switch scripts because I hate using control switches for simple things Self Switches can fix.

Definitely using this.

Share this post


Link to post
Share on other sites

One of the most usefull scripts out there. To be honest I'm having difficulty understanding why RPG Maker doesn't come with this function build in.

Thank you for making this :)

Share this post


Link to post
Share on other sites

I think he meant the options to do as the script I made. That it should have been in the default scripts already.

But it's not really that different from what's already built in, right?

 

$game_self_switches[map_id,event_id,switch] = true/false

Isn't that much harder to type out than

 

setSelfSwitch(map, eID, selfSwitch, trueFalse)

 

Still pretty useful for those who don't know the syntax, though.

Edited by Bird Eater
SixShotSamael likes this

Share this post


Link to post
Share on other sites

I love this script! So useful! :D Got a question though, would it be possible to make it so with a script call command you could make it so it changes all self switches based on mapID to false/true? Instead of having to specify every single event you want to change the self switch for?

 

Edit: 

For example: setAllSelf(8, false)

 

Instead of

setAllSelf(8, 1, false)

setAllSelf(8, 2, false)

setAllSelf(8, 3, false)

setAllSelf(8, 4, false)

Etc.

Because I have a lot of events (30+) on almost every map (planning a couple hundred.) in my project that I have reset when you leave that map. And having to type in that same script call for every event is very time consuming.

Edited by KevinFrost

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.