Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Current Event ID

Hi there,

How would I get the event id of the current event? Something like RPG::Current_Event.id is kind of what I'm looking for.

I can't seem to figure this one out.

Thanks in advance,

-Webgovernor
 
there is no RPG::Current_Event class

Are you using this in a call script of the event if so then the Interpreter class keeps track of this and you can use @event_id within the call script, if not then try this

Code:
class Interpreter
  attr_reader :event_id
end

and now you can do $game_system.map_interpreter.event_id to get the current event running

but I really don't know what you are trying to do
 
Thanks for the reply,

I'm well aware that there isn't a RPG::Current_Event class, I was just giving an example on the call method I was looking for.

Basically, I'm indexing all the NPCs to have their own information, their index is the event id. Then I'd call the "Set_Npc" method from the event.
PHP:
def set_npc
  npc_id = $game_system.map_interpreter.event_id
  npc_name = $cur_name
  npc_gold = $cur_gold
  npc_polarity = $cur_polarity
  npc_faction = $faction_names[$fid]
  if $npc[npc_id]
    $npc[npc_id].gold = $npc[npc_id].gold
    #p "NPC Exists"
    #p "NPC, Gold: #{$npc[npc_name].gold}"
  
  else
    $npc[npc_id] = NPC.new
    $npc[npc_id].gold = npc_gold
    $npc[npc_id].polarity = npc_polarity
    $npc[npc_id].name = npc_name
    $npc[npc_id].faction = npc_faction
    #p "NEW NPC"
  end
end

So that's what I'm using it for, this method is ONLY called from the event, and all seems to be working ok.

Thanks for the help, I appreciate it.

-Webgovernor
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top