• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Generating Events from script

  • 1,189
    Posts
    11
    Years
    How does one create a new event from the script editor? I tried using Game_Event.new, but that seems like it requires that event number to exist on the map's data, unless I'm doing it wrong.

    Code:
    #$SearchingMap is the map's id
    $SpecialEvent=Game_Event.new($SearchingMap,$game_map.events.keys.length+1,$game_map)

    In the long run I intend to create this event, change it's graphic, give it an action to do when the player touches it, and remove itself afterwards. Creating it is obviously the first step though, but I really don't see any examples or documentation so I'm not really sure.
     
    You have to create an RPG-Event first

    Code:
     def create_ev(x, y)
        ev = RPG::Event.new(x, y)
        ev.id = $game_map.events.keys.length+1
        
        game_ev = Game_Event.new($game_map.map_id, ev)
        $game_map.events[ev.id] = game_ev
        
        return game_ev
    end
    reference:
    /forums*rpgmakerweb*com/index*php?/topic/22795-create-new-event-by-script/
     
    Back
    Top