|
| [VX] On-map Bullet System | |
| | Pengirim | Message |
---|
bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | Subyek: [VX] On-map Bullet System 2011-11-09, 19:49 | |
| On-map Bullet System Version: 1.0 Type: Misc Add-on PengenalanThis script enables you to spawn a bullet that can trigger using event's self switch or switch (for hitting player). You may use this for creating your own ABS (action battle system) because this is also used as a part of ABS. NB: Script ini termasuk yang digunakan dalam game The Mystery House Petunjuk & Pemasangan - Just place the script above Main. - To create a bullet, use code: @bullet = $scene.createbullet(name, source, speed, dir, atk[, target]) where @bullet = last created bullet object name = picture name for created bullet source = Game_Character object from which the bullet is spawned ($game_player or $game_map.events[@event_id]) speed = bullet speed dir = 1: down 2: left 3: right 4: up 5: Southwest 6: Northwest 7: Northeast 8: Southeast 9: Toward target 10: Toward target (homing) 11: Angled direction (use @bullet.bullet_angle to determine angle) atk = bullet attack value target = Game_Character object to which the bullet move (if use dir = 9 or 10) - Accessible bullet properties: @bullet.speed @bullet.bullet_dir @bullet.bullet_angle (in degrees, CCW from east) @bullet.source (read-only) @bullet.atk and all attributes inherited from Game_Picture - Global variables: $scene.bullet_hitting = bullet that just hit an object - Script configurations: see and edit at module BulletMod. Screenshot- Spoiler:
http://www.indojpg.com/images/105ut_.png
(Usage on The Mystery House) - Spoiler:
http://www.indojpg.com/images/939ut_.png
- Spoiler:
http://www.indojpg.com/images/113ut_.png
Demohttp://dl.dropbox.com/u/39428704/Bullet%20System.zip Script - Code:
-
#============================================================================== # On-map Bullet System #============================================================================== # Information: # This script enables you to spawn a bullet that can trigger using event's # self switch or switch (for hitting player). # # Usage: # - To create a bullet, use code: # @bullet = $scene.createbullet(name, source, speed, dir, atk[, target]) # where # @bullet = last created bullet object # name = picture name for created bullet # source = Game_Character object from which the bullet is spawned # ($game_player or $game_map.events[@event_id]) # speed = bullet speed # dir = 1: down # 2: left # 3: right # 4: up # 5: Southwest # 6: Northwest # 7: Northeast # 8: Southeast # 9: Toward target # 10: Toward target (homing) # 11: Angled direction (use @bullet.bullet_angle to determine angle) # atk = bullet attack value # target = Game_Character object to which the bullet move # (if use dir = 9 or 10) # # - Accessible bullet properties: # @bullet.speed # @bullet.bullet_dir # @bullet.bullet_angle (in degrees, CCW from east) # @bullet.source (read-only) # @bullet.atk # and all attributes inherited from Game_Picture # # - Global variables: # $scene.bullet_hitting = bullet that just hit an object # # - Script configurations at module BulletMod. # # Installation: # Just place above Main. # # Credits # Alissa Liu # #==============================================================================
#--------------------------------------------------------------------------- # ** BulletMod Module #--------------------------------------------------------------------------- module BulletMod FromPicID = 31 # Min Picture ID ToPicID = 61 # Max Picture ID PlayerHit = 16 # Player Hit Switch TriggerSS = "D" # Target's Self Switch triggered when touching # the bullet end
#============================================================================== # ** Game_Character #------------------------------------------------------------------------------ # This class deals with characters. It's used as a superclass of the # Game_Player and Game_Event classes. #==============================================================================
class Game_Character #-------------------------------------------------------------------------- # * Determine Character Collision # x : x-coordinate # y : y-coordinate # Detects normal character collision, including the player and vehicles. #-------------------------------------------------------------------------- def collide_with_characters2?(x, y) if self != $game_player && x==$game_player.x && y==$game_player.y return $game_player end for event in $game_map.events_xy(x, y) # Matches event position unless event.through # Passage OFF? if event!=self return event if event.priority_type == 1 # Target is normal char end end end return nil end end
#============================================================================== # ** Bullet #------------------------------------------------------------------------------ # #============================================================================== class Bullet < Game_Picture attr_accessor :speed attr_accessor :bullet_dir attr_accessor :bullet_angle attr_reader :source attr_accessor :atk alias bulletinit initialize unless method_defined?('bulletinit') alias bulletshow show unless method_defined?('bulletshow') alias bulletupdate update unless method_defined?('bulletupdate') #-------------------------------------------------------------------------- # * Object Initialization # number : picture index #-------------------------------------------------------------------------- def initialize(number) bulletinit(number) @bullet_dir = -1 @bullet_angle = 0 @speed = 0 end #-------------------------------------------------------------------------- # * Show Picture #-------------------------------------------------------------------------- def show(name, source, speed, dir, target=nil) bulletshow(name,1,source.screen_x,source.screen_y-16,100,100,255,0) @real_x = source.real_x.to_f @real_y = source.real_y.to_f @real_xo = @real_x @real_yo = @real_y @speed = speed @bullet_dir = dir @source = source @target = target if source==target erase else if dir==9 @dx = speed/Math::sqrt((target.real_x-source.real_x)*(target.real_x-source.real_x)+ (target.real_y-source.real_y)*(target.real_y-source.real_y))*(target.real_x-source.real_x) @dy = speed/Math::sqrt((target.real_x-source.real_x)*(target.real_x-source.real_x)+ (target.real_y-source.real_y)*(target.real_y-source.real_y))*(target.real_y-source.real_y) end end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update if @name != "" x_last = @real_x y_last = @real_y case @bullet_dir when 1 @real_y += @speed # Down when 2 @real_x -= @speed # Left when 3 @real_x += @speed # Right when 4 @real_y -= @speed # Up when 5 # Southwest @real_y += @speed*0.707 @real_x -= @speed*0.707 when 6 # Northwest @real_y -= @speed*0.707 @real_x -= @speed*0.707 when 7 # Northeast @real_y -= @speed*0.707 @real_x += @speed*0.707 when 8 # Southeast @real_y += @speed*0.707 @real_x += @speed*0.707 when 9 # Towards target @real_x += @dx @real_y += @dy when 10 # Homing @dx = speed/Math::sqrt((@target.real_x-@real_x)*(@target.real_x-@real_x)+ (@target.real_y-@real_y)*(@target.real_y-@real_y))*(@target.real_x-@real_x) @dy = speed/Math::sqrt((@target.real_x-@real_x)*(@target.real_x-@real_x)+ (@target.real_y-@real_y)*(@target.real_y-@real_y))*(@target.real_y-@real_y) @real_x += @dx @real_y += @dy when 11 # Angled direction @dx = @speed*Math::cos(@bullet_angle*Math::PI/180) @dy = -@speed*Math::sin(@bullet_angle*Math::PI/180) @real_x += @dx @real_y += @dy end @x = (($game_map.adjust_x(@real_x) + 8007) / 8 - 1000 + 16).round @y = (($game_map.adjust_y(@real_y) + 8007) / 8 - 1000 + 16).round if ((x_last/256).round!=(@real_xo/256).round || (y_last/256).round!=(@real_yo/256).round) if !$game_map.passable?($game_map.round_x(@real_x/256).round,$game_map.round_y(@real_y/256).round) && !$game_map.ship_passable?($game_map.round_x(@real_x/256).round,$game_map.round_y(@real_y/256).round) erase else coli = @source.collide_with_characters2?($game_map.round_x(@real_x/256).round,$game_map.round_y(@real_y/256).round) if (coli != nil) if coli == $game_player || coli.id<=0 $game_switches[BulletMod::PlayerHit] = true else key = [$game_map.map_id,coli.id,BulletMod::TriggerSS] $game_self_switches[key] = true end $scene.bullet_source = @source $scene.bullet_hitting = self $scene.bullet_hitting_name = name erase end end end if @x<=0 || @x>=544 || @y<=0 || @y>=416 erase end bulletupdate end end end
#============================================================================== # ** Scene_Map #------------------------------------------------------------------------------ # This class performs the map screen processing. #============================================================================== class Scene_Map < Scene_Base attr_accessor :bullet_source attr_accessor :bullet_hitting attr_accessor :bullet_hitting_name # Alias things alias bulletinit initialize unless method_defined?('bulletinit') alias bulletupdate update unless method_defined?('bulletupdate') alias bulletterminate terminate unless method_defined?('bulletterminate') #-------------------------------------------------------------------------- # * Initialize #-------------------------------------------------------------------------- def initialize $bullet_sprite = [] for i in BulletMod::FromPicID..BulletMod::ToPicID $bullet_sprite[i-BulletMod::FromPicID] = Bullet.new(i) end bulletinit end #-------------------------------------------------------------------------- # * createbullet #-------------------------------------------------------------------------- def createbullet(name, source, speed, dir, atk, target=nil) ret_id = BulletMod::FromPicID while $bullet_sprite[ret_id-BulletMod::FromPicID].name != "" && ret_id<BulletMod::ToPicID ret_id += 1 end if $bullet_sprite[ret_id-BulletMod::FromPicID].name == "" $bullet_sprite[ret_id-BulletMod::FromPicID].show(name, source, speed, dir, target) $bullet_sprite[ret_id-BulletMod::FromPicID].atk = atk return $bullet_sprite[ret_id-BulletMod::FromPicID] end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update bulletupdate for bulletspr in $bullet_sprite if bulletspr.name != "" if $game_player.transfer? bulletspr.erase else bulletspr.update end end end end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate for bulletspr in $bullet_sprite bulletspr.erase end bulletterminate end end
class Spriteset_Map alias bulletcreatepic create_pictures unless method_defined?('bulletcreatepic') #-------------------------------------------------------------------------- # * Create Picture Sprite #-------------------------------------------------------------------------- def create_pictures(*args);bulletcreatepic(*args) for bulletspr in $bullet_sprite @picture_sprites.push(Sprite_Picture.new(@viewport1,bulletspr)) end end end
class Sprite_Picture < Sprite alias bulletpic_upd update unless method_defined?('bulletpic_upd') #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update(*args);bulletpic_upd(*args) if @picture.number >= BulletMod::FromPicID && @picture.number <= BulletMod::ToPicID self.z = $game_player.screen_z+50+@picture.number-BulletMod::FromPicID end end end Credit | |
| | | shikami Member 1000 Konsep
Posts : 3744 Thanked : 31 Engine : Multi-Engine User Skill : Beginner Type : Developer
Trophies
Awards:
| Subyek: Re: [VX] On-map Bullet System 2011-11-09, 19:55 | |
| sepertinya ga praktis sekali bikinnya =,=a ga bisakah lebih disederhanakan ? | |
| | | bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | | | | Kuru Senior
Posts : 985 Thanked : 9 Engine : RMVX Skill : Beginner Type : Writer
Trophies
Awards:
| Subyek: Re: [VX] On-map Bullet System 2011-11-09, 21:05 | |
| Unduh lagi | |
| | | nisamerica Living Skeleton
Posts : 1668 Thanked : 25 Engine : RMVX Skill : Very Beginner Type : Artist
Trophies
Awards:
| Subyek: Re: [VX] On-map Bullet System 2011-11-09, 23:00 | |
| Hey, hey, jangan bilang kalo ini bisa memungkinkan event untuk bergerak lebih dari 8 arah, atau bahkan secara sin cos tan?? | |
| | | bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | | | | nisamerica Living Skeleton
Posts : 1668 Thanked : 25 Engine : RMVX Skill : Very Beginner Type : Artist
Trophies
Awards:
| Subyek: Re: [VX] On-map Bullet System 2011-11-09, 23:07 | |
| *jleb* AHAGH picture toh Tapi keren nih pake picture bisa dibikin collision, rumit ga bikinnya? Tapi hebat bikinnya ga terlalu banyak abrisnya, bisa dibilang dikit malah Btw Kuro Creator kayanya bakal seneng ini | |
| | | maihime Senior
Posts : 677 Thanked : 143 Engine : Multi-Engine User Skill : Very Beginner Type : Artist
| Subyek: Re: [VX] On-map Bullet System 2011-11-10, 20:40 | |
| *baru lihat... Ehm! Peluru berupa picture? Menarik! Mai mau coba... Mai download dulu, ya... | |
| | | Bcyborg21 Novice
Posts : 204 Thanked : 1 Engine : RMVX Skill : Advanced Type : Artist
| Subyek: Re: [VX] On-map Bullet System 2011-11-11, 06:21 | |
| , wahhh, sangar nih, perlu di jajal. ijin unduh ya . . . | |
| | | Sponsored content
| Subyek: Re: [VX] On-map Bullet System | |
| |
| | | | [VX] On-map Bullet System | |
|
Similar topics | |
|
| Permissions in this forum: | Anda tidak dapat menjawab topik
| |
| |
| Latest topics | » [Web Novel] Gloria Infidelis by LightNightKnight 2016-11-17, 21:27
» [Announcement] Forum baru untuk RMID by TheoAllen 2016-08-25, 16:39
» Where I'm Wrong ? by ReydVires 2016-07-24, 16:10
» flakeheartnet's Resources part III by flakeheartnet 2016-07-08, 14:30
» Keira's Art Warehouse by KeiraBlaze 2016-06-28, 19:27
» Theo Core Time System + Bingung by Lockin 2016-06-27, 16:24
» Error Script, Maybe ? by Lockin 2016-06-27, 16:20
» Nusaimoe @ RMID Lounge by Jihad Bagas 2016-06-21, 05:02
» Call Random Battle by Lockin 2016-06-15, 17:04
» Flakeheartnet Resources Part II [come back gift] by flakeheartnet 2016-06-07, 15:51
|
Statistics
|
Members: [ 4947 ]
Topics: [ 8258 ]
Posts: [ 112606 ]
Newest member: [ https://rmid.forumotion.net/u4968 ]
|
|
|
|