Because I need a self-switch to turn off from an event's move route. Ie, it does it's thing, then turns off a self switch. I need it in it's move route because I want it to do something else if you touch it.
Yes. You can refer to them by using:
$game_self_switches[[MAP_ID, EVENT_ID, "CHARACTER"]]
EVENT_ID needs to be replace with the ID of the specified EVENT (you can see it above the event name in the editor), MAP_ID is the ID of the map (press space when the current map is selected in the window at the bottom left) and CHARACTER is A, B, C or D. But I suggest you use a normal switch. The chance of a bug is much lower.
Quote from: Blizzard on March 14, 2007, 12:11:57 PM
Yes. You can refer to them by using:
$game_self_switches[[MAP_ID, EVENT_ID, "CHARACTER"]]
EVENT_ID needs to be replace with the ID of the specified EVENT (you can see it above the event name in the editor), MAP_ID is the ID of the map (press space when the current map is selected in the window at the bottom left) and CHARACTER is A, B, C or D. But I suggest you use a normal switch. The chance of a bug is much lower.
Yes. that's what I've got, but that's the problem!
I'm working on an event driven Custom Battle System. I need the self switch to change after the enemy has done a certain action (In this case, jumped three times and run twoards the player).
There isn't any way you could have it so it fetches the MAP_ID and EVENT_ID from the event it's on is there? To have a similar effect as "this event"?
For MAP_ID you can use $game_map.map_id , for EVENT_ID you can use @event_id. This will refer to the event that is using the command.
Quote from: Blizzard on March 14, 2007, 05:24:38 PM
For MAP_ID you can use $game_map.map_id , for EVENT_ID you can use @event_id. This will refer to the event that is using the command.
Thanks!
Is it also possible to have RGSS variables named after an event? Just so I don't have to keep having lots of different variables, and have a 'local' variable, if you will.
Edit: I just tried that code. I get an error saying;
"NameError occurred while running script.
unititialized canstant Game_character::D"
and here is the code you gave me, with add-ons.
$game_self_switches[[$game_map.map_id, @event_id, D]]Wait a minute. I think I forgot to say, that I want the switch to turn
OFF when the code executes... Sorry.
Well, you can name the game-wide switches and variables, but not local switches.
Quote from: Blizzard on March 14, 2007, 06:08:28 PM
Well, you can name the game-wide switches and variables, but not local switches.
No,no. I meant, is it possible to have unique variable that is assigned to each event, so that I don't have to keep manually creating new events.
Also, I need the script to be reversed, I need to know how to turn the switch OFF.
Ok, let me explain everything again.
Switches and Variables can be named, Self-Switches (or Local Switches) cannot. Using following command accesses the Local Switches per script:
$game_self_switches[[$game_map.map_id, @event_id, "A"]]
$game_self_switches[[$game_map.map_id, @event_id, "B"]]
$game_self_switches[[$game_map.map_id, @event_id, "C"]]
$game_self_switches[[$game_map.map_id, @event_id, "D"]]
Now, you can do follwing things:
$game_self_switches[[$game_map.map_id, @event_id, "D"]] = true
$game_self_switches[[$game_map.map_id, @event_id, "D"]] = false
$game_self_switches[[$game_map.map_id, @event_id, "D"]] = (not $game_self_switches[[$game_map.map_id, @event_id, "D"]])
The first command will turn on switch "D", the second, will turn it off, the last one will trigger it. With trigger I mean, if it's off, it goes on, if it's on, it goes off.
Normal Switches and Variables work game-wide, while Local Switches work ONLY for the given event. Each event has its own set of Local Switches.
I hope, you understand now. ^__^
But you can't give the Local Switches names. They have their own names: "A", "B", "C" and "D". You basically can't change it. Of course there is a possibility, but it's quite some work needed and your events won't work correctly after that, so it's not worth the effort.
Thanks very much.
The other thing I need to know is how to assign a unique variable to an event, so I don't have to manually make so many different variables for their health, attackSelection etc.
EDIT: That code doesn't work. The switch doesn't change.
I have seen a "Self-Variable" script on www.hbgames.org/forums once. Maybe you are able to find it.
I have made use of changing the self-switches of certain events in the script for my minigame called Gamos. (In case you want to se an working example.
You can try to look at it if you don't find the script you need on hbgames.org
http://rmrk.net/index.php/topic,166.msg66064.html
Look in the Stone class.
Thanks Zeriab! That worked, thanks!
And, Blizz. I looked on that site, but because it doesn't have a search function, I couldn't find the Self Vairables thing you mentioned... Oh well...
Hm, try www.creationasylum.net instead.