Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
HeathLocke

Force "autorun" events to start by id number

Question

I'm doing some debugging where I have autorun events on the map with the following code:

print("The event #{@event_id} was started!");

(followed by local switch shenanigans that go with autorun events)

 

And if I copy and paste the same event, say, 4 times around the map, everything works neatly and I get

The event 1 was started!
The event 2 was started!
The event 3 was started!
The event 4 was started!

However, if after pasting the four events I try to create a new one with the same settings, I'll get

The event 5 was started!
The event 1 was started!
The event 2 was started!
The event 3 was started!
The event 4 was started!

Is there any way to force the events to be executed by id number? The hash @events (line 80) at Game_Map is already starting with the correct event order but somewhere down the line they get scrambled, apparently.

 

All help is greatly appreciated, and I thank in advance.

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

All right, this took me an entire weekend of maddening hash debugging. I'm still not sure why, but RMXP's hashes seem to be sorted by something else other than hash. Even on a for loop, inserting the values one by one from 1 to 6 (number of events I was working with), but the end hash would always be 5, 6, 1, 2, 3, 4. I think at some point I even tried to hardcoding the hashes receiving the value in the right order, but the end hash would still have weird order.

 

But after a lot of trial and errors, I managed to make the events run by id order. In the Interpreter 1 script, on setup_starting_event method, at line 92 I think, I changed the for loop to use a number from 1..number of events, and then access the events array with this number. The final code is

    # Loop (evento de mapa)
    for i in 1..$game_map.events.size
      # Se houver um Evento ocorrendo
      if $game_map.events[i].starting
        # Se não é uma execução automática
        if $game_map.events[i].trigger < 3
          # Limpar flag de inicialização
          $game_map.events[i].clear_starting
          # Trava
          $game_map.events[i].lock
        end
        # Um evento é configurado
        setup($game_map.events[i].list, $game_map.events[i].id)
        return
      end
    end

Hope this helps someone in the future.

Share this post


Link to post
Share on other sites
  • 0

I have been working all day on this, and still couldn't fix it. I have managed to pinpoint the source of the problem though, it comes from Game_Map, on the following line

@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))

so I guess the events are being saved in the wrong (for me) order. I have tried many times to manually create the hash with for loops, but couldn't get it working. Hashes are satan's work, probably.

I have an idea for an ugly fix that hopefully will work, I should get to it tomorrow. In the meantime I'm open to suggestions of better ways to fix this.

Edited by HeathLocke

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...