Falcao MMO Alchemy - Corss Map Ingredient Respawn

Discussion in 'RGSSx Script Support' started by Vis_Mage, Oct 15, 2019.

  1. Vis_Mage

    Vis_Mage Novice Magician Veteran

    Messages:
    389
    Likes Received:
    141
    Location:
    Ridge Island
    First Language:
    English
    Primarily Uses:
    RMVXA
    Hello!

    By any chance, could someone help me resolve a long standing issue I've ran into regarding Flacao's MMO Alchemy script?

    https://www.rpgmakercentral.com/top...-alchemy-and-extraction-system/#comment-94754

    The problem I've ran into isn't to do with the actual alchemy system, but the ingredient harvesting and respawn system also build into the script. With it, you can set a harvestable event to respawn after X in game seconds. Thenonpy issue is this tiner only accounts for time spent in that map in which the event is in.

    As such, could someone please help me create an edit or add-on script to allow for this respawn timer to be active anywhere in the game, instead of just the one specific map?

    Thank you!
     
    #1
  2. Vis_Mage

    Vis_Mage Novice Magician Veteran

    Messages:
    389
    Likes Received:
    141
    Location:
    Ridge Island
    First Language:
    English
    Primarily Uses:
    RMVXA
    Bump
     
    #2
  3. A-Moonless-Night

    A-Moonless-Night WINTER IS COMING Veteran

    Messages:
    505
    Likes Received:
    362
    Location:
    New Zealand
    First Language:
    English
    Primarily Uses:
    RMVXA
    You could try this:
    Code:
    class FalcaoExtraction
    
      def data
        $game_party.ev_extdata
      end
        
      def update_respawn
        data.each_key do |map|
          next if data[map].empty?
          data[map].each do |event_id, event_data|
            next unless event_data[2]
            if $game_system.playtime >= event_data[1]
              $game_map.events[event_id].fading = [:fade_out, 60] if map == $game_map.map_id
              data[map].delete(event_id)
              data.delete(map) if data[map].empty?
            end
          end
        end
      end
     
      def apply_variance
        data[$game_map.map_id] = {} if data[$game_map.map_id].nil?
        event = $game_party.extract_data[7]
        times = event.check_ext("<extract_times: ")
        res   = $game_system.playtime + event.check_ext("<extract_respawn: ")
        if data[$game_map.map_id][event.id].nil?
          data[$game_map.map_id][event.id] = [times, res, false]
        end
        data[$game_map.map_id][event.id][0] -= 1
        if data[$game_map.map_id][event.id][0] == 0
          event.fading = [:fade_in, 60]
          data[$game_map.map_id][event.id][2] = true
        end
      end
     
    end
    If an event is ready to be respawned and you aren't on the map, it will be there next time you enter the map. Otherwise, it will fade in. I haven't tested it extensively, so let me know how it goes.
     
    #3
    Vis_Mage likes this.
  4. Vis_Mage

    Vis_Mage Novice Magician Veteran

    Messages:
    389
    Likes Received:
    141
    Location:
    Ridge Island
    First Language:
    English
    Primarily Uses:
    RMVXA
    Sorry that I'm a bit late with a response. I'm happy to say that it works great for me, although in a somewhat odd way.

    If I set up a harvestable event the normal way, it will indeed respawn while I'm off map, but if it does respawn while I'm not in the map, it will never respawn again after I harvest it again.

    However, the way I have it set up, I use Shaz's Clone Event script ( https://forums.rpgmakerweb.com/index.php?threads/clone-events.18727/ ), to keep all the events in one place, in case I want to edit them later. And oddly enough, events spawned this way do indeed work perfectly with your script.

    In my case, it works perfectly fine, just thought I'd bring it up, since I found it pretty peculiar.
     
    #4

Share This Page