RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Finding an events ID from the event name

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 83
I am trying to find the ID of a map event by using that event's name. I might have "Enemy1" be event # 005 on one map, but it might be event # 002 on another. So I am hoping to use "Enemy1" from the name box to help me find that event's ID#.

I have been trying so far and have only gotten this

  def find_enemy_event_ID(i)
    # Determine the enemies' event IDs
    $events ||= load_data('data/MapInfos.rxdata')
    for key, value in $events
      return key if value == "Enemy" + (i).to_s
    end
      return 000
  end
 

Where i would be the enemy# I am looking for
I don't know if this is just incorrect coding or if it is even possible to retrieve the information I need like this. I am trying to modify some code Zeriab previously helped me with, but I do not know where the information I need is stored.

Any help would be greatly appreciated.
« Last Edit: November 04, 2011, 01:10:05 AM by czernobog »

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
MapInfos.rxdata contains the information needed for building the map tree you see in the editor. It does not contain the information you are looking for.
Assuming you need to look at the events on the current map then need to expose the name in Game_Event (present in its internal @event which is an RPG::Event).
After that you can just look at the events in $game_map. (You can consider making a method there for finding what you want)

Do consider the case where multiple events has the name you are looking for. What then?
Do you want a particular one?
All of them?
Any one, doesn't matter which?
The name you are looking for should be unique? (In that case consider throwing an error if $DEBUG to let the game dev know of the problem)

P.s. be careful about leading zeroes. 000 is just fine, but try 009 and you'll see what I mean.

*hugs*
 - Zeriab

**
Rep: +0/-0Level 83
Thank you for the help. I'm still trying to get this figured out, but I will post when I get some kind of results.