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

Discussion in 'RGSSx Script Support' started by Quigon, Jun 23, 2012.

  1. Quigon

    Quigon electric boogaloo Veteran

    Messages:
    1,982
    Likes Received:
    951
    Location:
    Oklahoma
    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.
     
    #1
  2. PK8

    PK8 I sense there's something in the wind... Veteran

    Messages:
    1,220
    Likes Received:
    152
    Location:
    Spiral Hill
    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: Jun 23, 2012
    #2
  3. Quigon

    Quigon electric boogaloo Veteran

    Messages:
    1,982
    Likes Received:
    951
    Location:
    Oklahoma
    First Language:
    English
    Primarily Uses:
    N/A
    Thanks dude, doing it by maps makes it a lot easier :)
     
    #3
  4. PK8

    PK8 I sense there's something in the wind... Veteran

    Messages:
    1,220
    Likes Received:
    152
    Location:
    Spiral Hill
    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 }
     
    #4

Share This Page