[Ace] Turning off a large amount of self switches with a script call.

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A
Hi there!

I used to have a script call for something like this but I can't for the life of me remember what it was, and it was for VX too so I have no idea if it'd work.

Basically, I'm trying to recreate the Dark Souls respawn system, whereby activating a save point will respawn every enemy encountered so far. So if, hypothetically, I cleared the ENTIRE GAME of every enemy and then hit a save point, every single enemy in the game would respawn, and vice versa with different numbers and whatnot. I thought I could do it via turning off self switches again (the encounters are touch-based, meaning that when you defeat an enemy a self switch is turned on so they disappear after battle), but with the possible amount of enemies needing to be respawned, that seems like an awful lot of specific script calls.

If there's no other way to do it than just specifying every event and self switch individually then I can do it that way, but if there's an easier alternative then that'd be cool.

So basically what I need is a script call or something of the like that would change a range of specific event's self switches to OFF.
 

PK8

I sense there's something in the wind...
Veteran
Joined
Mar 17, 2012
Messages
1,220
Reaction score
152
Primarily Uses
Here's a quick call for you:

events = $game_map.events.keys

events.each { |i| $game_self_switches[

[@map_id, i, "A"]] = false }

* You can use an array ([1, 2, 3, 4, 5]), a range ((1..5)), or you can use this on all events with $game_map.events.keys

* Map ID. You can leave it as @map_id if you want to get the current map, or you can use any other Map ID.

* Self Switch Letter. "A", "B", "C", or "D"

* true: on, false: off
 
Last edited by a moderator:

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A
Thanks dude, doing it by maps makes it a lot easier :)
 

PK8

I sense there's something in the wind...
Veteran
Joined
Mar 17, 2012
Messages
1,220
Reaction score
152
Primarily Uses
No prob. Oh hey, here's a slightly better call I just whipped up. It's a bit complex and provides a little less space but you get to specify ranges within an array with this one.

events = [1..3, 5, 7..11]

if events.is_a?(Array); events.each{|i| ((i

).each{|j| events.push(j)};events.delete(i)

) if i.is_a?(Range) }; end

events.each { |i| $game_self_switches[

[@map_id, i, "A"]] = false }
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

being able to transition music seamlessly is amazing. my main character's theme has lyrics and it goes from vocal version to istrumental when he leaves his room. and vice versa. and thanks to a plugin, the transition is seamless. I love it.
All of the auditions for our game are so good, I'm so glad I'm not in charge of choosing completely. lol I just can't with some of them. I listen to them on repeat. XD
Working on a Patch to integrate AlphaABS into random generated Dungeons. Was a bit tricky, but the outcome is a real Life Changer!!

Will release it the next days!
Been pretty busy... but I got a better headset for recording and listening today. Dad says that he'll consider taking me to Great Wolf Lodge for the first time once I finish summer classes (my final semester!) I'll be taking my plushie friends with me: Bendy, Lolbit, and Helen Henny. (I WUV PLUSHIES!)
SF_Monster3,4 added!

Forum statistics

Threads
105,651
Messages
1,015,304
Members
137,327
Latest member
Mezzy
Top