Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: nathmatt on May 19, 2011, 10:39:04 am

Title: [XP] MCES
Post by: nathmatt on May 19, 2011, 10:39:04 am
ok so i am trying to get true event clicking so i am trying to create a table of the events visible pixel locations but i cant seem to figure out how to do it so far i have this

class Game_Event < Game_Character
 
 def mouse_over?
   return if !$scene.is_a?(Scene_Map)
   return check_sprite[$mouse.x,$mouse.y] == 0x01
 end
 
 def get_sprite
   return if !$scene.is_a?(Scene_Map)
   $scene.spriteset.character_sprites.each{|s|return s if s.character == self}
 end
 
 def check_sprite
   s = get_sprite
   a = Table.new($game_map.width*32, $game_map.height*32)
   w,h,x,y = s.src_rect.width,s.src_rect.height,s.src_rect.x,s.src_rect.y
   (x..w).each{|xs|(y..h).each{|ys| pix = s.bitmap.get_pixel(xs,ys)
   p s.x-xs/32,s.y-ys/32
   a[s.x-xs,s.y-ys] = 0x01 if pix.alpha == 255}}
   return a
 end
   
end
class Scene_Map;        attr_reader :spriteset         end
class Spriteset_Map;    attr_reader :character_sprites end
class Sprite_Character; attr_reader :ch,:cw            end
Title: Re: MCES
Post by: Twb6543 on May 19, 2011, 11:39:18 am
This was included in Wora's Christmas Giftbox 2008 over at rmrk.net I believe, you may get a few ideas over there try this link (http://rmrk.net/index.php?topic=31518.0).
Title: Re: [XP] MCES
Post by: nathmatt on May 19, 2011, 12:13:44 pm
that doesn't help at all i have already created a script i call (MCES) Mouse Controller Enhancement Script
which is a add_on for Blizzards Mouse controller im trying to rewrite it making it better and im trying to make true event clicking that goes by the pixels of the visible sprite so that it knows the size of the events sprite and create a table to store where those pixels are in relation to the map
Title: Re: [XP] MCES
Post by: PhoenixFire on May 19, 2011, 12:14:59 pm
And if I recall correctly, The Wora Xmas pack was for VX...? :P
Title: Re: [XP] MCES
Post by: nathmatt on May 19, 2011, 12:17:13 pm
yea it was lol but i checked it they didn't do true event clicking 
Title: Re: [XP] MCES
Post by: Twb6543 on May 19, 2011, 12:31:19 pm
Whoops sorry I automatically go to RMVX, sorry about that ..
For the size surely you can just load the sprite into a variable and then use
width = *.bitmap.width
height = *.bitmap.height
// with * being the variable, this would set the width and height variables to the height and width of the bitmap of a sprite.

would that help in any way...
Title: Re: [XP] MCES
Post by: PhoenixFire on May 19, 2011, 01:08:05 pm
Oh, meh..

Title: Re: [XP] MCES
Post by: nathmatt on May 19, 2011, 03:16:57 pm
actually you use
*.src_rect.width
*.src_rect.height

but that doesn't help either somewhere where i am calculating the range of positioning im messing up
Title: Re: [XP] MCES
Post by: Twb6543 on May 19, 2011, 03:42:20 pm
Really I shouldn't try to help anyone at this level I'll just stick to my Plain old simple scripts much easier to explain and help, also I think I should mainly stick to VX sorry if I was no help at all, (I know I wasn't)...
Title: Re: [XP] MCES
Post by: nathmatt on May 19, 2011, 03:43:46 pm
thats ok doesn't bother me any lol
Title: Re: [XP] MCES
Post by: ForeverZer0 on May 19, 2011, 05:45:42 pm
Are you factoring in the sprite's viewport origin?
Title: Re: [XP] MCES
Post by: nathmatt on May 19, 2011, 08:40:00 pm
i believe so what i doing is first im going through the entire sprites src_rect for pixels with alpha > 0
with that im creating an array of arrays with the current pixel being checked and adding the sprites x & y but its always off
Title: Re: [XP] MCES
Post by: ForeverZer0 on May 19, 2011, 08:53:51 pm
What do you by its "off"?
Like it just doesn't register blank pixels of the sprite correctly, or it does, but left/right/above/down of where the sprite actually is?
Title: Re: [XP] MCES
Post by: nathmatt on May 20, 2011, 11:22:57 am
how can i put a sprite below a character but above the ground ?

any1 im trying to create a set sprite that shows the location you are moving to but if you click behind an event the image is displayed on top them