Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: ForeverZer0 on May 16, 2011, 02:29:57 am

Title: [XP] Event Proximity Icons
Post by: ForeverZer0 on May 16, 2011, 02:29:57 am
Event Proximity Icons
Authors: ForeverZer0
Version: 1.4
Type: Event Add-On
Key Term: Misc Add-on



Introduction

This script will allow you to have various icons appear over events' heads when the player gets within a certain range of them, and the appropriate tag is found as a comment in their page.


Features




Screenshots

Spoiler: ShowHide
(http://dl.dropbox.com/u/20787370/Scripts/Event%20Proximity%20Events/EventProx1.png)

Spoiler: ShowHide
(http://dl.dropbox.com/u/20787370/Scripts/Event%20Proximity%20Events/EventProx2.png)



Demo

Demo Link (https://dl.dropbox.com/u/20787370/Scripts/Event%20Proximity%20Icons.zip)


Script

The Script: ShowHide
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Event Proximity Icons
# Author: ForeverZer0
# Version: 1.4
# Date: 6.4.2012
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Introduction:
#   This script will allow you to have various icons appear over events' heads
#   when the player gets within a certain range of them, and the appropriate
#   tag is found asa comment in their page.
#
# Features:
#   - Easy to use
#   - Can use any number of custom tags you want
#   - Adjustable coordinates for icons
#   - Adjustable cycle times for changing icons
#   - Adjustable proximity before icons show
#   - Icons transition in/out smoothly
#   - Can use glow feature instead of icons
#   - Set custom glow color and speed
#
# Instructions:
#   - See configuration below.
#   - Make sure all icons are located in Graphics/Pictures directory
#
# Credits:
#   - ForeverZer0, for the script
#   - Zexion, for requesting it
#   - Taiine, for her constant reminders to add Blizz-ABS compatibility ;)
#
##+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#                            BEGIN CONFIGURATION
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

 TAGS = ['TALK', 'SEARCH', 'ATTACK']
 # These are th codes that will be searched for in event page comments
 ICONS = ['talk', 'search', 'attack']
 # These are the filenames of the respective codes, located in Pictures folder
 
 PROXIMITY = 3
 # The number of tiles away the player must be to event to show the icons.
 
 CYCLE_TIME = 2
 # The number of seconds before the icon cycles to the next one (if available)
 
 ICON_OFFSET = [0, -8]
 # The offset of the icon coodinates, adjust to your icon size
 # [X_OFFSET, Y_OFFSET]
 
 GLOW_ONLY = false
 # Set to true to have sprites glow when within range instead of using icons
 GLOW_COLOR = Color.new(255, 255, 200, 128)
 # The color of the glow.  (RED, GREEN, BLUE, ALPHA)
 GLOW_SPEED = 40
 # The glow speed.  40 = 1 second
 
 ALWAYS_ON_TOP = false
 # Set to true if icons always display over everything else.
 
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#                               END CONFIGURATION
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

#===============================================================================
# ** Game_Map
#===============================================================================

class Game_Map
 
 attr_accessor :proximity_data
 
 alias zer0_proximity_setup setup
 def setup(map_id)
   @proximity_data = {}
   zer0_proximity_setup(map_id)
 end
end

#===============================================================================
# ** Game_Event
#===============================================================================

class Game_Event
 
 alias zer0_proximity_init initialize
 def initialize(map_id, event)
   # Normal method
   $game_map.proximity_data[event.id] = [false, []]
   zer0_proximity_init(map_id, event)
   # A little extra work now, but it greatly reduces the number of checks later
   @event.pages.each {|page| page.list.each {|command|
     if [108, 408].include?(command.code) &&
       command.parameters.any? {|param| TAGS.include?(param) }
       $game_map.proximity_data[@id][0] = true
     end
   }}
   refresh
 end
 
 alias zer0_proximity_tag_refresh refresh
 def refresh
   # Call normal refresh method
   zer0_proximity_tag_refresh
   # Check current page
   if !GLOW_ONLY && $game_map.proximity_data[@id][0] && @page != nil
     # Set default values
     $game_map.proximity_data[@id] = [false, []]
     # Iterate commands and check if tag is present. If so, set respective flag
     @page.list.each {|command|
       if [108, 408].include?(command.code) &&
         TAGS.include?(command.parameters[0])
         $game_map.proximity_data[@id][0] = true
         $game_map.proximity_data[@id][1].push(command.parameters[0])
       end
     }
   end
 end
end

#===============================================================================
# ** Sprite_Character
#===============================================================================

class Sprite_Character
 
 alias zer0_proximity_tag_init initialize
 def initialize(viewport, character = nil)
   # Check if the sprite is that of an event, and has icons
   if character.id != 0
     flag = $game_map.proximity_data[character.id][0]
     if character.is_a?(Game_Event) && flag
       if ALWAYS_ON_TOP
         topview = Viewport.new(0, 0, 640, 480)
         topview.z = 9999
       end
       # Initialize sprite and bitmaps
       @icon_sprite = ALWAYS_ON_TOP ? Sprite.new(topview) : Sprite.new(viewport)
       @icon_sprite.opacity = @icon_index = 0
     end
   end
   # Normal initialize method
   zer0_proximity_tag_init(viewport, character)
 end
 
 alias zer0_proximity_tag_upd update
 def update
   # Normal update method
   zer0_proximity_tag_upd
   # Update the icons if needed
   if ![nil, 0].include?(@character.id)
     flag = $game_map.proximity_data[@character.id][0]
     if @character.is_a?(Game_Event) && flag
       GLOW_ONLY ? update_glow : update_icons
     end
   end
 end
 
 def update_glow
   # Check proximity, then set flash if within range.
   range_x = @character.x - $game_player.x
   range_y = @character.y - $game_player.y
   range = Math.hypot(range_x, range_y).abs
   if range <= PROXIMITY && Graphics.frame_count % GLOW_SPEED == 0
     self.flash(GLOW_COLOR, GLOW_SPEED)
   end
 end

 def update_icons
   # Return if no icons exist for page, or set icon if none is defined
   if $game_map.proximity_data[@character.id][1].empty?
     return
   elsif @icon_sprite.bitmap == nil
     icon_name = $game_map.proximity_data[@character.id][1][0]
     @icon_sprite.bitmap = RPG::Cache.picture(icon_name)
   end
   bw = bh = 0
   # Calculate width and height of icon and figure into the coordinates
   if @icon_sprite.bitmap != nil
     bw = ((self.bitmap.width / 4) - @icon_sprite.bitmap.width) / 2
     by = -@icon_sprite.bitmap.height
   end
   # Set coordinates of icon relative to sprite
   @icon_sprite.x = (self.x - self.ox) + bw + ICON_OFFSET[0]
   @icon_sprite.y = (self.y - self.oy) + bh + ICON_OFFSET[1]
   # Check range, fading in/out smoothly as needed
   if $BlizzABS
     pix = $BlizzABS.pixel
     char_x, char_y = @character.x, @character.y
     player_x, player_y = $game_player.x / pix , $game_player.y / pix
     if @character.is_a?(Map_Battler)
       char_x /= pix
       char_y /= pix
     end
   else
     char_x, char_y = @character.x, @character.y
     player_x, player_y = $game_player.x, $game_player.y
   end
   range_x = char_x - player_x
   range_y = char_y - player_y
   range = Math.hypot(range_x, range_y).abs
   @icon_sprite.opacity += (range <= PROXIMITY) ? 10 : -10
   # Cycle icon bitmap as needed
   if @icon_sprite.opacity > 0 && Graphics.frame_count % (CYCLE_TIME * 40) == 0
     size = $game_map.proximity_data[@character.id][1].size
     @icon_index = (@icon_index + 1) % size
     icon_name = $game_map.proximity_data[@character.id][1][@icon_index]
     @icon_sprite.bitmap = RPG::Cache.picture(icon_name)
   end
 end
 
 alias zer0_proximity_icon_dispose dispose
 def dispose
   # Disposed the icon sprite
   if @icon_sprite != nil && !@icon_sprite.disposed?
     @icon_sprite.dispose
   end
   zer0_proximity_icon_dispose
 end
end



Instructions

Place above "Main", and below default scripts.
Instructions are within the script.


Compatibility

Pixel movement scripts may cause issues, though I DID add compatibility for Blizz-ABS pixel-movement.

BlizzABS's ABSEAL will under certain circumstances not update events without graphics, which may include some of your proximity events, causing them not to work. To fix this issue, place the small script below anywhere below the BlizzABS scripts.
BlizzABS ABSEAL Fix: ShowHide
class Game_Character
 
  alias zer0_proximity_update? update?
  def update?
    if self.is_a?(Game_Event) && $game_map.proximity_data.include?(self.id)
      if @trigger == 3 || @trigger == 4 || self.name.clone.gsub!('\\eal') {''}
        return true
      end
      return in_abseal_range?
    end
    return zer0_proximity_update?
  end
end




Credits and Thanks




Author's Notes

Please report any bugs/issues so that they can be resolved.
Enjoy!
Title: Re: [XP] Event Proximity Icons
Post by: Zexion on May 16, 2011, 05:25:11 am
Wow thanks a lot for this :) gonna try it
Title: Re: [XP] Event Proximity Icons
Post by: Melvin on May 16, 2011, 06:17:46 am
Lol! :D Good script!!
Title: Re: [XP] Event Proximity Icons
Post by: G_G on May 16, 2011, 08:31:23 am
Nice job F0!
Title: Re: [XP] Event Proximity Icons
Post by: Jragyn on May 16, 2011, 11:25:49 am
Instead of drawing an icon, could the sprite within the event just... glow or something? Or both.

Just an idea.
Title: Re: [XP] Event Proximity Icons
Post by: Zexion on May 17, 2011, 01:34:46 am
I forgot to say that this script is not compatible with some of the other ones I have mainly blizz abs. It causes a wierd bug in my cutscenes like it leaves ghost pixels, ghost maps, and screen flashes linger. But if i take out blizz abs it works fine! Is there a way to make them compatible? I really like this script so I don't want to give up on it lol
Title: Re: [XP] Event Proximity Icons
Post by: LiTTleDRAgo on May 18, 2011, 09:05:05 pm
Quoteclass Spriteset_Map
 
  alias zer0_icon_dispose dispose
  def dispose
    # Dispose the icons when the map is disposed
    $game_map.events.each_value {|event| event.dispose_icons }
    zer0_icon_dispose  # Missing?
  end
end
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on May 18, 2011, 09:27:02 pm
Fixing now, thanks for pointing it out.  :D

I'm actually changing the whole thing. I should have had all the actual processing in Sprite_Character to begin with, it will allow for a lot easier manipulation and more features.

Should have it up within the hour.


EDIT:

Updated to version 1.1
- Fixed the above mentioned bugs
- Added the "glow" option instead of using icons
- Totally restructured the script
Title: Re: [XP] Event Proximity Icons
Post by: PhoenixFire on May 19, 2011, 12:14:07 pm
I might be hijacking this script as well...      Maybe...

I haven't tested it out yet, but, I like the glowing concept. I might bother you about it later, but, for right now, I'm at work, so, no downloading to company computers  :facepalm:

Damn corporate rules :rulez:
Title: Re: [XP] Event Proximity Icons
Post by: Shalaren on May 20, 2011, 10:24:24 pm
error of something in line 162, undefined method, only happens with blizz-abs
Title: Re: [XP] Event Proximity Icons
Post by: G_G on May 20, 2011, 10:25:17 pm
Did you place this below or above Blizz-ABS?
Title: Re: [XP] Event Proximity Icons
Post by: Shalaren on May 20, 2011, 10:33:27 pm
*facepalm*
I take my bug report back! Thanks g_g
Title: Re: [XP] Event Proximity Icons
Post by: Zexion on May 22, 2011, 03:39:09 am
Thanks you fixed the bug it had before, the ghost pixels and all! However I forgot to mention the other bug, err i did mention it but the post didn't go through and i was too tired to re-do it lol.
Anyways...the other bug was, the icon only triggers on one event on my map. The event that triggers it doesn't have a tag on it, but it shows up on the event with the tag. I know it sounds confusing so I made a pic.
Spoiler: ShowHide
(http://img813.imageshack.us/img813/8871/errork.png)
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on May 22, 2011, 03:46:52 am
You mean the wrong event is getting the icon?

ie. Event_A has a comment Tag, but the icon appears over Event_B?
Title: Re: [XP] Event Proximity Icons
Post by: Zexion on May 22, 2011, 11:58:36 am
Quote from: ForeverZer0 on May 22, 2011, 03:46:52 am
You mean the wrong event is getting the icon?

ie. Event_A has a comment Tag, but the icon appears over Event_B?


Yes exactly! Except it only happens to 1 event. The other event with tags doesn't show at all Idk why.
Title: Re: [XP] Event Proximity Icons
Post by: Raziel 0128 on June 03, 2011, 03:50:17 pm
Your script works nicely and is very useful but I've discovered an error with it.
If you attempt to save on a map using this code then you will get the following error:
"Script 'Scene_Save' Line 80: Type error occurred.
no marshal_dump is defined for class Bitmap"

This happens in your demo as well.
In future versions could you also allow glowing AND icons at the same time, for example if I wanted to have one item glow but another bring up a speech bubble?
Title: Re: [XP] Event Proximity Icons
Post by: yuhikaru on June 18, 2011, 09:01:11 am
Another bug I found was that if the actual event page has a tag, and you change the event page while the player is within it's range, but the new event page doesn't have a tag, the icon won't be erased until you exit the map. (Example: Chest with tag 'OPEN', and when it's open doesn't have any tag).
I tried to correct it with this change, but I don't know if it's a good approach. Apparently works.
def update_icons
    # Return if no icons exist for page, or set icon if none is defined
    if @character.icons.empty?
      @icon_sprite.dispose  #ADD THIS LINE
      return
[....]

(And just a little bump on the save error thing).
Title: Re: [XP] Event Proximity Icons
Post by: Taiine on July 12, 2011, 10:36:31 pm
Don't mean to bump this. But I'm hoping for a fix to the
"Script 'Scene_Save' Line 80: Type error occurred.
no marshal_dump is defined for class Bitmap"
error on saving.

I was hoping to use this to mark exits that may not be fully obvious to some (like side door ways in homes) but that error when trying to save is proving problematic.
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on July 12, 2011, 11:19:10 pm
Ah, yes, I keep forgetting about this one.
I'll make a note and fix it within the next day or so.
Title: Re: [XP] Event Proximity Icons
Post by: Taiine on July 15, 2011, 06:45:27 pm
*sits and waits for that next day or so* XD
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on July 15, 2011, 08:50:43 pm
* Updates script to version 1.2 *

Fixed the bug with save data. I was storing Bitmaps in a class that gets marshaled, and Bitmaps are not able to be marshaled.
I ended up just moving the icons to a hash in Game_Temp that gets changed whenever the map is loaded.

Thanks to Taiine for her reminders. ;)
Title: Re: [XP] Event Proximity Icons
Post by: Taiine on July 15, 2011, 10:44:44 pm
Your script don't like BABS. :P

I was discovering an oddity with in my game. It seemed the icons didn't want to show up when you drew near the event, but rather a space up and to the left of it.

(http://images.devs-on.net/Image/wwsfCqHIqT5DbpH-Region.png)
My games test map. Girl at the very bottom has a red orb behind her head that appears not when you get close to her, but rather when I step into where I am (the guy with the white hair)

This also happens in your demo when the BABS is added to it. The icons no longer show when you move near the event, but rather when you move close to the distance I show here.
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on July 15, 2011, 10:48:07 pm
Its the pixel movement, it messes with the coordinates.
I'll see if I can add some compatibility, I always forget about pixel-movement in BABS...
Title: Re: [XP] Event Proximity Icons
Post by: Raziel 0128 on July 16, 2011, 03:20:39 pm
Ah good I've been waiting for this. Thanks for the fix.
Title: Re: [XP] Event Proximity Icons
Post by: Taiine on July 16, 2011, 11:34:45 pm
*pokes the stubborn script*
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on July 16, 2011, 11:49:11 pm
Probably won't be until tomorrow. I'm setting up a fresh install of an OS right at the moment. That's gonna be a few hours minimum.
I did get RMXP reinstalled already if thats any consolation. ;)
Title: Re: [XP] Event Proximity Icons
Post by: Taiine on July 17, 2011, 09:21:37 pm
*puts a sticky note on FZ's forehead as a reminder!*  :naughty:
Title: Re: [XP] Event Proximity Icons
Post by: Taiine on July 21, 2011, 10:43:13 pm
*double posts to add another sticky note to FZ0's forehead as a reminder to check her last reminder!*

;)


>.>
<.<
Spoiler: ShowHide
(http://www.practicallyefficient.com/wp-content/uploads/2010/09/sticky-note-man-pe.png)

*runs*


But really, have less then 7 days before my nets cut off, really hoping to have this before then. :(
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on July 24, 2011, 10:15:51 pm
* Updates script to v.1.3 *

It is now compatible with Blizz-ABS pixel-movement.
Title: Re: [XP] Event Proximity Icons
Post by: Taiine on July 25, 2011, 12:12:27 am
*add's another sticky note with her thanks on it*


XD
Title: Re: [XP] Event Proximity Icons
Post by: Dweller on April 10, 2012, 03:45:07 pm
This script is fantastic and very use friendly.

I used to place a question mark on top of the NPCs that give quest to the player on my game. I discover a small bug when you use local switch. Example: When you talk to an NPC I add the quest to the player and use the comment to show the quest icon, then I active the first local switch so the NPC shows a different message, and I use no comments because in this case I don't want to show the icon (because the quest is already taken. Here is the problem, when the second conversation ends, the icon don't dissapear and begin to move when the players do.

I resolved myself this problem adding (in configuration) a new comment to the script with no content and adding in the second switch a comment with no content:
TAGS = ['quest', 'SEARCH', 'ATTACK', '']
  # These are th codes that will be searched for in event page comments
  ICONS = ['quest', 'search', 'attack', '']
  # These are the filenames of the respective codes, located in Pictures folder


Thanks to ForeverZer0, I was doing this with events and was a really hard work, now is so easy using this script.
Title: Re: [XP] Event Proximity Icons
Post by: AJNR95 on April 10, 2012, 04:42:36 pm
I done goofed
Spoiler: ShowHide
(http://www.mediafire.com/convkey/ad65/bhuu7fa0vmw2uiu5g.jpg)


Switched tags to TAGS = "['Event', 'Search', 'Enemy']" and all the Pictures corresponds.
The error begins after the title screen when entering a map. I disabled Glow_Only

Drago's Smooth Scroller probably conflicts with this.
Title: Re: [XP] Event Proximity Icons
Post by: Landith on May 04, 2012, 12:22:51 am
I know this topic is kinda old and they necroposted but I just wanted to give ForeverZer0 props for creating this haha

I seriously requested the same thing but with windows like 2 years ago haha
old request lol: ShowHide
(http://i1070.photobucket.com/albums/u499/Landith1/coincidence.png)


This is so much cooler though because it gives a whole new interactive element to your game.
Just nice job on such a simple script :)
Title: Re: [XP] Event Proximity Icons
Post by: Vexus on May 13, 2012, 01:03:17 pm
I edited the script coords so that the icon would show on your character's head and would like to know if how I made it is correct and won't give me any trouble in the future.

Lines are these (193-194):

@icon_sprite.x = $game_player.screen_x - 5
@icon_sprite.y = $game_player.screen_y - 58


It works but since I don't know how to script I'd rather ask to be 100% sure. (The minus values are there because without them the icon shows at the bottom of your character.)
Title: Re: [XP] Event Proximity Icons
Post by: Raziel 0128 on May 20, 2012, 01:28:45 pm
After some more testing I've found that if a map contains more than one event proximity icon and you save and reload you get the following error:
"Script 'Proximity Icons' line 140: NoMethodError occurred.
undefined method '[]' for nil:Nilclass"

This occurs even in a fresh project with just this script installed. For example if you create two npcs with TALK or one npc with TALK and SEARCH either will crash the game when reloaded from a save.
Title: Re: [XP] Event Proximity Icons
Post by: Landith on May 21, 2012, 01:45:41 am
I've been getting the same error Raziel has been getting.

Even if I don't have an event with a comment in it I still get the same error whenever I kill an enemy/use a skill that has a sprite on it.
(I use BABS)

flag = $game_temp.proximity_data[character.id][0]


That line is line 140 if that helps.
Title: Re: [XP] Event Proximity Icons
Post by: Fenriswolf on June 04, 2012, 01:40:16 pm
Hey F0, I'm thinking about using this script, but the bug that Raziel and Landith have been having,
makes this difficult, because I'm planning to have multiple quests in the same map in multiple locations.

Any chance you could try to fix this bug?
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on June 04, 2012, 02:07:07 pm
I'll take a look some after work and see if I can find a fix.
Title: Re: [XP] Event Proximity Icons
Post by: Fenriswolf on June 04, 2012, 02:16:53 pm
Thanks a bunch.
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on June 04, 2012, 05:54:50 pm
* Updates script and demo to version 1.4 *

Ok, all fixed. I made a rather amateur mistake when making this. I used a hash in Game_Temp to store sprite data, including the icons. I used Game_Temp simply because it does not get saved, since Bitmaps cannot be saved. That was rather stupid of me, I didn't need to store the icons at all, I can just use string and load them when needed with RPG::Cache using that.

I ended up moving @proximity_data to Game_Map so that it gets saved with and loaded with the game and no more "undefined" errors. Old save files you may try to use will be corrupted, so erase them if you plan on using the new version of the script.
Title: Re: [XP] Event Proximity Icons
Post by: Landith on June 04, 2012, 05:58:15 pm
Thank you for fixing this.

level++
Title: Re: [XP] Event Proximity Icons
Post by: Fenriswolf on June 04, 2012, 06:58:39 pm
Glad I waited before using it, thanks a lot for the fix.

*lvls up*
Title: Re: [XP] Event Proximity Icons
Post by: Raziel 0128 on June 05, 2012, 07:35:15 am
Thanks for taking the time to fix this I appreciate it.
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on June 05, 2012, 07:49:28 am
No problem, it only took a couple of minutes.
Title: Re: [XP] Event Proximity Icons
Post by: Vexus on August 07, 2012, 01:13:56 pm
Any chance you would see why this script: http://save-point.org/thread-2414.html conflicts with this script?

I get an error:

91 NoMethodError occurred.

Undefined method '[]=' for nil:NilClass

Line is:

$game_map.proximity_data[event.id] = [false, []]


I was thinking on trying a tileset swap for the footstep sound script of G_G to have different versions of sounds without having the need on doubling the maps in my game to be on different tilesets. (In my project you started bare footed so I want to use the bare foot noise then you change clothes and obviously stepping sound will switch too.)

Thanks

Title: Re: [XP] Event Proximity Icons
Post by: nathmatt on August 07, 2012, 04:47:34 pm
this should fix it place this below the tileset swap

class Game_Map
 
  attr_accessor :proximity_data
 
  alias zer02_proximity_setup setup
  def setup(map_id)
    @proximity_data = {}
    zer02_proximity_setup(map_id)
  end
end
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on August 07, 2012, 05:13:12 pm
Yes, it happens because the author of that script does not know how to alias and overwrites the whole method. You *should* be able to simply change the order of the scripts and place this one below that one to fix it instead of adding a redundant alias method.
Title: Re: [XP] Event Proximity Icons
Post by: Vexus on August 08, 2012, 10:33:33 am
It made it work, thanks.

Shame the sound doesn't change when I switch tileset but stops if I use a tileset from the database that doesn't give any sound :/
Title: Re: [XP] Event Proximity Icons
Post by: LiTTleDRAgo on August 08, 2012, 12:31:20 pm
Quote from: Vexus on August 08, 2012, 10:33:33 am
It made it work, thanks.

Shame the sound doesn't change when I switch tileset but stops if I use a tileset from the database that doesn't give any sound :/


you using game guy's terrain step sound script right?
from what I see, the script change the sound based on terrain tag
you can just switch the terrain tag on the map instead switching the entire tile
http://littledrago.blogspot.com/2012/08/rgss-terrain-tag-changer.html
Title: Re: [XP] Event Proximity Icons
Post by: Vexus on August 08, 2012, 01:51:59 pm
This is going off topic but the same problem with tileset swap happens.

First time you switch sound it works but if you try to revert the sound no sound plays.
Title: Re: [XP] Event Proximity Icons
Post by: G_G on August 08, 2012, 01:53:42 pm
Sometime this weekend, I'll make an alternate version of my script. It'll allow you to have multiple sets of sounds per tileset, then with a script call, you'll be able to choose which set of sounds you want to use.
Title: Re: [XP] Event Proximity Icons
Post by: Vexus on August 08, 2012, 02:03:08 pm
No need to do all that work for me really I can just figure out a work around. (Having double maps till you find some shoes)

Still thanks if you do but if it's time consuming don't worry about it.
Title: Re: [XP] Event Proximity Icons
Post by: Vexus on August 13, 2012, 01:57:42 pm
Any idea why sometimes events in a whole map or certain event's icon doesn't show?

I got 2 identical maps (For the step sound script to have different sounds) and icons show on one but on the other no icon shows when I go near events.

There's also a problem but I don't know how to create it as it happened randomly (Tough less than 10 times) where an icon wouldn't go away unless you opened/closed menu, go in a new map or go near another event which shows an icon.
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on August 13, 2012, 03:30:40 pm
No clue.
I would guess that it is some sort of script conflicting with it. Hard to say without a repeatable example.
Title: Re: [XP] Event Proximity Icons
Post by: Vexus on August 13, 2012, 05:22:25 pm
Well it seems to give problems (Error) if I place it under blizz abs, could it be the cause?
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on August 13, 2012, 05:52:00 pm
Might be, unfortunately I have no clue what scripts you are using, what order they are in, or a definitive answer as to when it occurs. This makes it pretty much impossible to give you any type of help with the matter.

If you uploaded a project, and maybe got a better idea how to make it reoccur, I might be able to help. If you could even get an idea, like it "it happens 1 out of every 10 times I do this:", it would help tremendously.
Title: Re: [XP] Event Proximity Icons
Post by: Vexus on August 13, 2012, 06:36:30 pm
For now here's a screenshot of my script list:

Spoiler: ShowHide
(http://img337.imageshack.us/img337/703/scriptsk.png)


[Edit]

Pmed you a demo.
Title: Re: [XP] Event Proximity Icons
Post by: ForeverZer0 on August 14, 2012, 02:37:37 pm
I found the problem, ABSEAL is not updating the events, which is what its supposed to do.

Here is a small script, which I will add to the main post, which will fix this issue.
It basically just tells ABSEAL to update the event if it is a proximity event and within ABSEAL's range.

class Game_Character
 
  alias zer0_proximity_update? update?
  def update?
    if self.is_a?(Game_Event) && $game_map.proximity_data.include?(self.id)
      if @trigger == 3 || @trigger == 4 || self.name.clone.gsub!('\\eal') {''}
        return true
      end
      return in_abseal_range?
    end
    return zer0_proximity_update?
  end
end


Place it below BlizzABS the scripts.
Title: Re: [XP] Event Proximity Icons
Post by: Magus on August 27, 2012, 02:59:48 pm
yes, yes, yes, YES! *POWERS UP* I've been craving a script like this. To think I was about to call it quits with rpg maker. I have some new ideas :o
Title: Re: [XP] Event Proximity Icons
Post by: Vexus on August 09, 2013, 08:31:22 am
Sorry for the necropost but I'm getting an error on line 133:

flag = $game_map.proximity_data[character.id][0]


When an event is attacking me (Using Blizz abs)

Error is:

NoMethod error occurred.

undefined method '[]' for nil:Class.


This doesn't happen all the time but it happens quite often.
Title: Re: [XP] Event Proximity Icons
Post by: LiTTleDRAgo on August 09, 2013, 10:30:23 am
try change that line to

flag = (($game_map.proximity_data||={})[character.id]||=[])[0]
Title: Re: [XP] Event Proximity Icons
Post by: Vexus on August 09, 2013, 10:44:34 am
Thanks that seems to have fixed the error :)
Title: Re: [XP] Event Proximity Icons
Post by: Parkman202 on June 24, 2015, 08:49:46 pm
Hello, ForeverZer0! I am using your scrip for my game, and it works great! There's just one thing, however; I use a lighting system that makes your events dark, and that's not what I need. I noticed you have a "show over top of everything" setting which fixed that particular issue, but I didn't expect it to show over top of everything including pictures, the player and even the text boxes. I looked into the script and found the viewport setting for when the setting is set to "true," and after some fixing, it shows above my lighting system and below text boxes, but not the player or the pictures. I don't mind it being on top of the player, because it's easier to see, but the pictures thing is kind of annoying. Is there any way to mend the script to make the pictures show over these icons?

Thanks!