VXAce [SOLVED] Can i put Self Switches inside a common event?

Hello! As i asked in the tittle, can i put self switches in a common event?
like the screenshot.

pic.png


EDIT Update: an alternative solution maybe this could work if anyone needs it..

Spoiler
Ruby:
#==============================================================================
#   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
#=*==========================================================================*=#
Sure, but it won't do anything. There is no self switch for Common events only events.
If you're trying to change an events self switch, you will have to put the command in the event or use the self switch script call for that specific event
$game_self_switches[[map_id, event_id, "SWITCH"]] = true
$game_self_switches[[1, 1, "A"]] = true
If you need to use Self Switches, you do it through scripting like @Roninator2 already suggested. But RGSS is not my strong point.

Edit: Saw his reply only after posting.
One exception would be if you use "Call Common Event" though. In this case the common event call will inherit "this event" and the designation of self switches from the event that called it, and related event commands would work just as fine as if you used them in the original event directly.

But apart from that, like Roninator2 said, common events do not have their own self switches.
"Call Common Event"
I looked for that and didn't see it and totally forgot about it.
Because I tested this to make sure before I commented.
But you are right, the call common event works.
One exception would be if you use "Call Common Event" though. In this case the common event call will inherit "this event" and the designation of self switches from the event that called it, and related event commands would work just as fine as if you used them in the original event directly.

But apart from that, like Roninator2 said, common events do not have their own self switches.
so like i have to make an event with 3 pages (if i want to use 3 self switches) and on the first page i use the call commond event and that would do the work on it self?..
how do i set it?
That instruction does not Work.

Why would you need 3 Eventpages to be able to use 3 Self Switches?
And why would a Call common Event be involved in this?
Calling "Common Event" has often the same effect as if you copied the contents of your common event: Your event will pause, execute the common event and once it is finished resume with its own commands.

It is mainly useful if you have event code that you use multiple times that has a significant size and/or you might want to update later (like a custom state effect that you want to update at the end of a turn in every troop, the option to steal from several NPCs when talking to them, or restore the players chosen battle music after every boss fight).

That said, it may or may not help with what you originally wanted to use a common event for.
In the end, self switches don't work in common event so i ended up working with normal switches.
all ok 🙂 thanks everyone
If you use a map event to call a Common Event, the self-switch(es) as set in the Common Event will affect the source map event. You can use this for make mass-eventing:
for example if you make a game where you can farm resources like iron ore, you would set a Common Event for the ore map events because every ore event would behave the same way.
But without scripts, neither Common Events nor Troops will have self-switches dedicated to themselves; you'll need to use global switches or variables instead.
EDIT Update: an alternative solution maybe this could work if anyone needs it..

Spoiler
Ruby:
#==============================================================================
#   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
#=*==========================================================================*=#

Original thread: https://forums.rpgmakerweb.com/threads/solved-can-i-put-self-switches-inside-a-common-event.150131/