!Other1.png (2.16 KB, 下载次数: 54)
se_maoudamashii_se_footstep01.ogg
11.69 KB, 下载次数: 257
#------------------------------------------------------------------------------# # Galv's Region Effects #------------------------------------------------------------------------------# # For: RPGMAKER VX ACE # Version 1.7 # Credit to Yanfly and Quack for event spawning method #------------------------------------------------------------------------------# # 2012-11-15 - Version 1.7 - Made effects work during forced move routes # 2012-11-15 - Version 1.6 - Fixed a major bug caused with last update. # 2012-11-04 - Version 1.5 - streamline updates and bug fix suggested by Quack # 2012-10-23 - Version 1.4 - updated alias naming convention for compatability # 2012-10-09 - Version 1.3 - re-wrote the code to be more efficient when # - using many different region effects. # 2012-10-09 - Version 1.2 - code tweak that may reduce lag on low-end pc's # 2012-09-16 - Version 1.1 - now compatible with Yanfly's spawn events # 2012-09-15 - Version 1.0 - release #------------------------------------------------------------------------------# # Designed to activate effects when regions are stood on. # An effect can include: # - Sound Effect # - An event that appears at the player's location # - Activating a common event # # # INSTRUCTIONS: # 1. Copy image from /Graphics/Characters/!Other-specials.png to your project # 2. Copy the map from this demo into your game. # - this map has events set up for the pre-made effects # 3. Check the map ID of the map you copied in your game # 4. Change the SPAWN_MAP_ID number to this map ID # 5. Change REGION_EFFECT_SWITCH to a switch you are not using in your game. # 6. Add some regions to your map to test. # #------------------------------------------------------------------------------# $imported = {} if $imported.nil? $imported["Region_Effects"] = true module Region_Effects #------------------------------------------------------------------------------# # SCRIPT SETUP OPTIONS #------------------------------------------------------------------------------# REGION_EFFECT_SWITCH = 1 # Turn this switch ON to disable the effects. MAX_EFFECTS = 30 # Number of effects that can be on screen # before being removed. (To prevent lag) SPAWN_MAP_ID = 2 # Map ID of the map you store event effects in. #------------------------------------------------------------------------------# # ENVIRONMENT REGIONS SETUP #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # # region => ["sound", vol, pitch, event_id, common_event_id] # # region - the region ID the effect will activate on # sound - the name of the SE file. "" for no sound # vol - the volume of the SE (0 - 100) # pitch - the pitch of the SE (50 - 150) # event_id - event ID called from the spawn map. 0 for none. # common_event_id - common event ID to call. 0 for no common event. # #------------------------------------------------------------------------------# EFFECT = { # ! don't touch this #------------------------------------------------------------------------------# 0 => ["", 0, 0, 0, 0], # No Effect (no region) # Pre-made effects (requires demo events) 1 => ["", 0, 0, 5, 0], # Dirt dust 2 => ["Blow7", 60, 150, 0, 0], # Wood surface noise only 3 => ["Water1", 60, 110, 1, 0], # Shallow Water 18 => ["Earth2", 40, 130, 0, 0], # Hard surface noise only 5 => ["Damage3", 40, 150, 2, 0], # Footprints 6 => ["Ice9", 50, 130, 3, 0], # Walking over thick grass 7 => ["", 0, 0, 0, 1], # Calls common event 1 only 8 => ["Fire3", 80, 120, 4, 2], # Calls fire trap 37 => ["", 80, 120, 6, 0], # Dust cloud # You can add more as required. eg: # 42 => ["", 0, 0, 0, 0], # 18 => ["", 0, 0, 0, 0], # etc. etc. # Only one effect per region number will work #------------------------------------------------------------------------------# } # ! don't touch this #------------------------------------------------------------------------------# # END SCRIPT SETUP #------------------------------------------------------------------------------# end # Region_Effects module DataManager #-------------------------------------------------------------------------- # alias method: load_normal_database #-------------------------------------------------------------------------- class <<self; alias load_normal_database_spawn_alias load_normal_database; end def self.load_normal_database load_normal_database_spawn_alias $data_spawn_map = load_data(sprintf("Data/Map%03d.rvdata2", Region_Effects::SPAWN_MAP_ID)) end end class Game_Player < Game_Character alias galv_region_effects_update_update_nonmoving update_nonmoving def update_nonmoving(last_moving) if last_moving galv_region_check unless $game_switches[Region_Effects::REGION_EFFECT_SWITCH] == true end galv_region_effects_update_update_nonmoving(last_moving) end def galv_region_check return if Input.trigger?(:C) v = rand(10) - rand(10) p = rand(40) - rand(40) @r_id = $game_map.region_id($game_player.x, $game_player.y) return if Region_Effects::EFFECT[@r_id] == nil sound = Region_Effects::EFFECT[@r_id][0] vol = Region_Effects::EFFECT[@r_id][1] pit = Region_Effects::EFFECT[@r_id][2] eve = Region_Effects::EFFECT[@r_id][3] com_eve = Region_Effects::EFFECT[@r_id][4] RPG::SE.new(sound, vol + v, pit + p).play if eve > 0 $game_map.region_event($game_player.x, $game_player.y, eve, Region_Effects::SPAWN_MAP_ID) end $game_temp.reserve_common_event(com_eve) unless com_eve == nil end end # Game_Player #============================================================================== # Credit to Yanfly for modified Spawn event script below #============================================================================== class Game_Map alias galv_region_effects_setup setup def setup(map_id) @effect_var = [] galv_region_effects_setup(map_id) end def region_event(dx, dy, event_id, map_id) map_id = @map_id if map_id == 0 map = $data_spawn_map event = generated_region_event(map, event_id) if @effect_var.length < Region_Effects::MAX_EFFECTS if @events.keys.max.nil? new_id = 1 else new_id = @events.keys.max + 1 end @effect_var.push(new_id) else new_id = @effect_var.shift @effect_var.push(new_id) end @events[new_id] = Game_Event.new(@map_id, event) @events[new_id].moveto(dx, dy) SceneManager.scene.spriteset.refresh_characters end def generated_region_event(map, event_id) for key in map.events event = key[1] next if event.nil? return event if event.id == event_id end return nil end end # Game_Map class Scene_Map < Scene_Base attr_accessor :spriteset end # Scene_Map
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |