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.

Looking for Help on Service Event Script

I have been creating an original ABS for a game I am creating. For all the projectiles in my game, I have been using a "Service_Event" script. What this script does is it takes an event from one map, and replicates the same event on the current map. I use this to have a single map with all the projectile events that can be generated at will.

Everything has been working perfectly, except for a bug I noticed. Whenever this script generates an event, all of the event graphics on the current map turn back to the default brightness, despite whatever screen tone is being used, and all the events on the map also appear in front of objects that would normally cover them, such as trees. I also noticed all of the event graphics go back to normal whenever you enter and back out of the menu, so I'm hoping this is something that isn't too difficult to fix. If anyone could help I'd be so grateful!

Code:
#==============================================================================

# ** Service_Event

#------------------------------------------------------------------------------

#  24/03/08 - MGCaladtogel

#==============================================================================

class Service_Event

  #--------------------------------------------------------------------------

  # * copy_event : copies a Game_Event from one map to the current map

  #     map_id    : source map's id

  #     event_id  : source event's id

  #     x         : new event's x-coordinate (facultative)

  #     y         : new event's y-coordinate (facultative)

  #--------------------------------------------------------------------------

  def self.copy_event(map_id, event_id, x=nil, y=nil)

    # loads the source map and the event

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

    event = map.events[event_id]

    # alters default coordinates

    if x != nil

      event.x = x

      event.y = y

    end

    # finds a unused id

    new_event_id =  $game_map.events.keys.sort[$game_map.events.keys.size - 1] + 1

    event.id = new_event_id

    # instanciates a new Game_Event from the loaded event

    new_event = Game_Event.new($game_map.map_id, event)

    # adds the event to the current map

    $game_map.events[new_event_id] = new_event

    #Ace ABS Edits

    $game_self_switches[[$game_map.map_id, new_event_id, 'A']] = false

    $game_self_switches[[$game_map.map_id, new_event_id, 'B']] = false

    $game_self_switches[[$game_map.map_id, new_event_id, 'C']] = false

    $game_self_switches[[$game_map.map_id, new_event_id, 'D']] = false

    $game_map.need_refresh = true

    #End Edits

    # clears and re-creates the spriteset's character_sprites to obtain a correct display

    character_sprites = $scene.spriteset.character_sprites

    for sprite in character_sprites

      sprite.dispose

    end

    character_sprites.clear

    for i in $game_map.events.keys.sort

      sprite = Sprite_Character.new(@viewport1, $game_map.events[i])

      character_sprites.push(sprite)

    end

    character_sprites.push(Sprite_Character.new(@viewport1, $game_player))

  end

end

 

#==============================================================================

# ** Scene_Map

#------------------------------------------------------------------------------

class Scene_Map

    attr_accessor :spriteset

end

 

#==============================================================================

# ** Spriteset_Map

#------------------------------------------------------------------------------

class Spriteset_Map

  attr_accessor :character_sprites

  attr_accessor :viewport1

end
 

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