Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Zeriab's Autoswitcher

PK8

Member

Script by Zeriab. Idea by Punk. Topic written by Punk.
Zeriab's Autoswitcher
by Zeriab


Introduction
Punk":2c0jpefc said:
After years of creating event systems, one thing I had grown tired of was having to make a map event activate some switch just to start a couple of my common events. No more having to activate the switch via some random map! *celebrates*

This script allows the game creator to activate the switches they want to activate AND alter the values of the variables they want altered.
This is Zeriab's much better version of the Autoswitcher. It totally pwns my version and it's very easy to use. I was posting my Autoswitcher in Seph's forums and then Seph and Zeriab thought of much better solutions to do it. I liked Zeriab's solution because it was a short piece of code yet it did what it was supposed to do which was activate certain switches and adjust certain variables before the game began.

Features
  • Very easy to use.
  • Activates switches you want activated.
  • Alters variables you want altered.
  • Activates and adjusts before your game starts
  • You no longer have to rely on an event in a particular map to activate a few switches and change the variables.
Screenshots
No screenshots or demos needed. Instructions are easy to follow, the script is easy to use.

Script
XP users
You could create a new script above main and then copy/paste the code from the spoiler below!

VX users
Create a new script inside "Materials" and then copy/paste the code from the spoiler below!
Code:
class Game_Switches
   #--------------------------------------------------------------------------
   # * Object Initialization
   #--------------------------------------------------------------------------
   def initialize
	 @data = []
	 @data[1] = true # Switch 1 = true
	 @data[6] = true # Switch 6 = true
   end
 end
 
 class Game_Variables
   #--------------------------------------------------------------------------
   # * Object Initialization
   #--------------------------------------------------------------------------
   def initialize
	 @data = []
	 @data[1] = 20  # Variable 1 = 20
	 @data[4] = -3  # Variable 4 = -3
	 @data[2] = 42  # Variable 2 = 42
   end
 end

Instructions
Let's take a look at a couple of things you may not be so sure of.

class Game_Switches
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@data = []
@data[1] = true # Switch 1 = true
@data[6] = true # Switch 6 = true
end
end
Switch ID.
true (switch is ON) or false (switch is OFF)
I'm definitely no scripting genius but this part of the script does the game switch related stuff. Now I'm sure you'd like to know, what are those?

As you can see, the code highlighted in green is the switch ID. The code highlighted in red decides whether the switch is either on or off by default with a true or false.

You can turn on an additional switch in your game by adding this code somewhere after "@data =[]" and before the first "end"
Code:
	 @data[[COLOR=green]id[/COLOR]] = [COLOR=red]true[/COLOR]
class Game_Variables
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@data = []
@data[1] = 20 # Variable 1 = 20
@data[4] = -3 # Variable 4 = -3
@data[2] = 42 # Variable 2 = 42
end
end
Variable ID
Value of the Variable ID
I'm definitely no scripting genius but this part of the script does game variable related stuff. Now I'm sure you'd like to know, what are those?

As you can see, the code highlighted in orange is the variable ID. The code highlighted in yellow will be the default value of the variable ID. It could be a negative or positive integer.

FAQs
Awaiting question.

Compatibility
It is compatible with RPG Maker VX!
It's very likely that it is SDK compatible. I've not checked yet.

Author's Notes
Zeriab":2c0jpefc said:
If you get any issues at all when inserting and using this script then make an evented solution instead.
Should you get any issues or have any problems using this script? Event it instead.
There is no reason to ask, because that would be my answer.
Punk":2c0jpefc said:
I recommend this script as it's much better than my attempt at a script which could activate switches and adjust variables when the game starts.

Credits
Credit Zeriab for the script.
Credit Punk for the idea.
 

Yaxor

Member

There is no XP script in your post

Edit: I am retarded the script posted under VX is for both versions nvm

Edit2: I cant undertand a fuck help me Zeriab says the script is compatible with VX may the XP version is not relased yet? WTF :pika:
 
It doesn't matter which version of RM you have, the script works with both XP and VX. Just use the one supplied under the VX label.


Also...
Punk":1vdpie07 said:
Zeriab's Autoswitcher
by Zeriab
Because someone has to state the obvious! ;)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top