Nager
Kryptomancia :: Section Création :: Script :: Autre
Page 1 sur 1 • Partager •
Nager
Presentation:by Paullo'z
Auteur: ToriVerly
Bon bah comme le nom l'indique, ce script permet de rendre possible la nage pour le héro.



Voilà les ressources nécessaires (en template):


Ces images doivent se trouver dans le dossier 'Characters' de votre projet et être nommées:
-Pour le plongeon, nom du fichier character_dive.png (001-Fighter01_dive.png)
-Pour la nage, nom du fichier character_swim.png (001-Fighter01_swim.png)
Bon biensûr, au dessus de main etc...
Dans la database vous devez mettre l'eau en traversable avec un ID de terrain égal à 1
Auteur: ToriVerly
Bon bah comme le nom l'indique, ce script permet de rendre possible la nage pour le héro.



Voilà les ressources nécessaires (en template):


Ces images doivent se trouver dans le dossier 'Characters' de votre projet et être nommées:
-Pour le plongeon, nom du fichier character_dive.png (001-Fighter01_dive.png)
-Pour la nage, nom du fichier character_swim.png (001-Fighter01_swim.png)
Bon biensûr, au dessus de main etc...
| Code: |
| #==============================================================================# # Swimming! v 1.7 # # By: ToriVerly @ rmxp.org # #==============================================================================# # Intructions: # #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# WATER = 1 SWIM_SWITCH = nil SWIM_ITEM = nil SWIM_ARMOR = nil SWIM_WEAPON = nil SNEAK_KEY = nil #Input::Letterres["Z"] for Mr.Mo's ABS or input letters script DASH_KEY = nil #Input::Letters["X"] for Mr.Mo's ABS or input letters script SWIM_SE = "022-Dive02" DROWNING = false WATER_DASHING = false DIVE_SOUND_OFF = false DIVE_GRAPHIC = true TREAD_ANI = true #------------------------------------------------------------------------------# #==============================================================================# # Game_Player # #------------------------------------------------------------------------------# # Modifies the Game_Player class initialization and updating # #==============================================================================# class Game_Player < Game_Character alias swim_init initialize def initialize @swim = false @swim_count = 0 @drown_count = 0 @wait = 0 swim_init end alias swim_update update def update # Checks if swimming is triggered if swim_available? and on?(WATER) and !@swim return jump_in if facing?(WATER, 'any', 1) end # Determines if swimming and sets up the character appropriately if swimming? swim_refresh end # Drowns or prevents swimming if it is not available if on?(WATER) and !swim_available? if DROWNING == true drown elsif DROWNING == false move_backward end end # Jumps out of water at shore jump_forward if !on?(WATER) and !facing?(WATER, 'any', 1) and !facing?(WATER, 'any', 2) and @swim and moving? # Returns original settings when out of water revert if @swim and !on?(WATER) swim_update end #------------------------------------------------------------------------------# # Custom Methods # #------------------------------------------------------------------------------# # Checks swimming availability def swim_available? if SWIM_SWITCH != nil return true if $game_switches[SWIM_SWITCH] return false if !$game_switches[SWIM_SWITCH] end if SWIM_ITEM != nil return true if $game_party.item_number(SWIM_ITEM) != 0 return false if $game_party.item_number(SWIM_ITEM) == 0 end if SWIM_ARMOR != nil return true if $game_party.actors[0].armor1_id == SWIM_ARMOR return true if $game_party.actors[0].armor2_id == SWIM_ARMOR return true if $game_party.actors[0].armor3_id == SWIM_ARMOR return true if $game_party.actors[0].armor4_id == SWIM_ARMOR return false end if SWIM_WEAPON != nil return true if $game_party.actors[0].weapon_id == SWIM_WEAPON return false end return true end # Jumps in the water if swimming is triggered def jump_in @swim = true unless DIVE_SOUND_OFF @play_sound = true end if DIVE_GRAPHIC == true @character_name = $game_party.actors[0].character_name @character_name = $game_party.actors[0].character_name + "_dive" end jump_forward end # Swimming setup def swim_refresh get_speed if moving? if !moving? @character_name = $game_party.actors[0].character_name @character_name = $game_party.actors[0].character_name + "_swim" end if @play_sound and !moving? Audio.se_play("Audio/SE/" + SWIM_SE + ".ogg", 80, 100) @play_sound = false end @swim = true if TREAD_ANI == true @step_anime = true end end # Drowning def drown $game_screen.start_flash(Color.new(255,0,0,128), 20) if @drown_count <= 10 jump_in if !@swim @drown_count += 1 elsif @drown_count >=10 @drown_count = 0 $scene = Scene_Gameover.new end end # Reverts original settings when out of water def revert @character_name = $game_party.actors[0].character_name @swim = false unless dashing? or sneaking? @move_speed = 4 @move_frequency = 6 end if TREAD_ANI == true @step_anime = false end end # Determines Speed (Swim Leveling) def get_speed # Gets Swim Count @swim_count += 0.05 case @swim_count when 0.05 @swim_speed = 1 @move_frequency = 1 when 100 @swim_speed = 2 @move_frequency = 1 when 250 @swim_speed = 3 @move_frequency = 1 when 750 @swim_speed = 4 @move_frequency = 1 when 2000 @swim_speed = 5 @move_frequency = 1 end @move_speed = @swim_speed if WATER_DASHING == true if DASH_KEY != nil and Input.press?(DASH_KEY) and !sneaking? @move_speed = @swim_speed + 1 @move_frequency = 6 end if SNEAK_KEY != nil and Input.press?(SNEAK_KEY) and !dashing? @move_speed = @swim_speed -1 @move_frequency = 2 end end end # Jumps forward def jump_forward case @direction when 2 jump(0, 1) when 4 jump(-1, 0) when 6 jump(1, 0) when 8 jump(0, -1) end end # Jumps backward def jump_backward case @direction when 2 jump(0, -1) when 4 jump(1, 0) when 6 jump(-1, 0) when 8 jump(0, 1) end end # Checks if dashing def dashing? return true if DASH_KEY != nil and Input.press?(DASH_KEY) return false if SNEAK_KEY != nil and Input.press?(SNEAK_KEY) end # Checks if sneaking def sneaking? return true if SNEAK_KEY != nil and Input.press?(SNEAK_KEY) return false if DASH_KEY != nil and Input.press?(DASH_KEY) end # Checks if swimming def swimming? return true if on?(WATER) and @swim end # Checks if player is on a terrain tag def on?(tag) return true if $game_map.terrain_tag($game_player.x, $game_player.y) == tag end # Checks if player is facing a terrain tag def facing?(tag, dir, dist) case dir when 2 if $game_player.direction == 2 tag_x = $game_player.x tag_y = $game_player.y + dist end when 4 if $game_player.direction == 4 tag_x = $game_player.x - dist tag_y = $game_player.y end when 6 if $game_player.direction == 6 tag_x = $game_player.x + dist tag_y = $game_player.y end when 8 if $game_player.direction == 8 tag_x = $game_player.x tag_y = $game_player.y - dist end when 'any' if $game_player.direction == 2 tag_x = $game_player.x tag_y = $game_player.y + dist end if $game_player.direction == 4 tag_x = $game_player.x - dist tag_y = $game_player.y end if $game_player.direction == 6 tag_x = $game_player.x + dist tag_y = $game_player.y end if $game_player.direction == 8 tag_x = $game_player.x tag_y = $game_player.y - dist end end return false if tag_x == nil or tag_y == nil return true if $game_map.terrain_tag(tag_x, tag_y) == tag end end |
Dans la database vous devez mettre l'eau en traversable avec un ID de terrain égal à 1

renji- Puissance Ténébreuse

- Nombre de messages: 51
Age: 15
Date d'inscription: 13/12/2007
Re: Nager
c cool, je vais te donner 2 PB

Scythe Darklight- Invoqueur de tempête

- Nombre de messages: 1166
Age: 20
Date d'inscription: 17/08/2006

Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum

















