- NozvezMembre
- Nombre de messages : 354
Distinction : aucune
Date d'inscription : 16/03/2012
Prendre et Lancer FR
Mer 25 Avr 2012 - 9:00
Prendre et Lancer
Script qui peut être utile, que j'ai entièrement traduit en français.
Auteur : Moghunter
Traduction : Nozvez
Principe du script : Le script permet au personnage de prendre des objets et de les lancer.
Instructions : Les instructions sont dans le code.
Script :
- Code:
#==============================================================================
# ¦ +++ MOG - PICKUP AND THROW (v1.0) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com
#==============================================================================
# Système pour ramasser et jeter des événements, utile pour créer des puzzles.
#==============================================================================
# Pour définir les événements qui seront jetés nommer simplement l'événement
# comme suit:
#
# <ThrowX>
#
# X correspond à la distance à laquelle l'événement peut être lancé.
#
# Exemple
#
# Event01<Throw4>
#
#==============================================================================
# Sprite du personnage portant l'objet (optionnel)
#==============================================================================
# Vous devez avoir une image du personnage dans une position adéquate et
# vous devez nommer l'image comme suit:
#
# Character_Name + _Pickup
#
# Exemple
#
# Actor1_Pickup.png
#==============================================================================
module MOG_PICK_THROW
#Hauteur du sprite de l'objet chargé.
SPRITE_POSITION = 20
#Définir le son joué quand l'objet est lancé.
THROW_SE = "Jump2"
#Définir le son joué quand l'objet est chargé.
PICK_UP_SE = "Jump1"
#ID du Switch qui désactive le système de charge.
DISABLE_PICKUP_SWITCH_ID = 20
# Définir la touche du clavier qui permet de prendre (jeter) les objets.
PICKUP_BUTTON = Input::C
end
#==============================================================================
# ¦ Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :pickup_lock
attr_accessor :pickup_lock_time
attr_accessor :character_pre_name
attr_accessor :can_throw
attr_accessor :throw_position
#--------------------------------------------------------------------------
# ? initialize
#--------------------------------------------------------------------------
alias mog_pick_initialize initialize
def initialize
@pickup_lock = false
@pickup_lock_time = 0
@character_pre_name = ""
@can_throw = true
@throw_position = []
mog_pick_initialize
end
end
#==============================================================================
# ¦ Game_Event
#==============================================================================
class Game_Event < Game_Character
attr_reader :jump_count
attr_accessor :x
attr_accessor :y
attr_accessor :bush_depth
attr_accessor :direction
#--------------------------------------------------------------------------
# ? initialize
#--------------------------------------------------------------------------
alias mog_pickup_initialize initialize
def initialize(map_id, event)
mog_pickup_initialize(map_id, event)
@throw_active = false
if event.name =~ /<Throw(\d+)>/i
@throw = $1.to_i
end
end
end
#==============================================================================
# ¦ Game_Character
#==============================================================================
class Game_Character < Game_CharacterBase
attr_accessor :throw_active
attr_accessor :throw
#--------------------------------------------------------------------------
# ? initialize
#--------------------------------------------------------------------------
alias x_pickup_initialize initialize
def initialize
@throw_active = false
@throw = 0
x_pickup_initialize
end
#--------------------------------------------------------------------------
# ? Throw Action
#--------------------------------------------------------------------------
def throw_action(range)
moveto($game_player.x,$game_player.y)
jump_range = range
#@x = $game_player.x
#@y = $game_player.y
moveto($game_player.x,$game_player.y)
range.times do
unless jumping?
case $game_player.direction
when 6
jump(jump_range,0) if throw_range?(jump_range,0,jump_range)
when 4
jump(-jump_range,0) if throw_range?(-jump_range,0,jump_range)
when 2
jump(0,jump_range) if throw_range?(0,jump_range,jump_range)
when 8
jump(0,-jump_range) if throw_range?(0,-jump_range,jump_range)
end
if @x == $game_player.x and @y == $game_player.y and jump_range == 1
$game_temp.can_throw = false
end
jump_range -= 1
end
end
end
#--------------------------------------------------------------------------
# ? Throw Range?
#--------------------------------------------------------------------------
def throw_range?(x, y,range )
x = $game_player.x
y = $game_player.y
case $game_player.direction
when 2
y += range
when 6
x += range
when 4
x -= range
when 8
y -= range
end
return false if collide_with_characters?(x, y)
return false unless map_passable?(x, y,$game_player.direction)
return true
end
end
#==============================================================================
# ¦ Game_Player
#==============================================================================
class Game_Player < Game_Character
include MOG_PICK_THROW
#--------------------------------------------------------------------------
# ? Update Player Before Movement
#--------------------------------------------------------------------------
alias pickup_update update
def update
pickup_update
update_pickup_command
end
#--------------------------------------------------------------------------
# ? Update Pickup Command
#--------------------------------------------------------------------------
def update_pickup_command
$game_temp.pickup_lock_time -= 1 if $game_temp.pickup_lock_time > 0
return if $game_temp.pickup_lock_time > 0
if Input.trigger?(PICKUP_BUTTON)
throw_event if can_check_throw_event?
check_event_pickup([0,1,2]) if can_check_pickup_event?
end
end
#--------------------------------------------------------------------------
# ? Check Action Event
#--------------------------------------------------------------------------
alias mog_pickup_check_action_event check_action_event
def check_action_event
return if $game_temp.pickup_lock_time > 0 or $game_temp.pickup_lock
mog_pickup_check_action_event
end
#--------------------------------------------------------------------------
# ? Can Check Pickup Event
#--------------------------------------------------------------------------
def can_check_pickup_event?
return false if $game_temp.pickup_lock
return false if $game_temp.pickup_lock_time > 0
return false if $game_map.interpreter.running?
return false if $game_message.visible
return false if $game_switches[DISABLE_PICKUP_SWITCH_ID]
return true
end
#--------------------------------------------------------------------------
# ? Can Check Throw Event
#--------------------------------------------------------------------------
def can_check_throw_event?
return false if $game_temp.pickup_lock == false
return false if $game_temp.pickup_lock_time > 0
return false if $game_map.interpreter.running?
return false if $game_message.visible
return false if $game_switches[DISABLE_PICKUP_SWITCH_ID]
return true
end
#--------------------------------------------------------------------------
# ? Reserve Transfer
#--------------------------------------------------------------------------
alias mog_pickup_reserve_transfer reserve_transfer
def reserve_transfer(map_id, x, y, direction)
if $game_temp.pickup_lock == true
for event in $game_map.events.values
if event.throw_active == true
event.throw_active = false
event.moveto(@x,@y)
case @direction
when 2
event.jump(0,-1)
when 4
event.jump(1,0)
when 6
event.jump(-1,0)
when 8
event.jump(0,1)
end
end
end
$game_temp.pickup_lock = false
$game_temp.pickup_lock_time = 0
@character_name = $game_temp.character_pre_name
end
mog_pickup_reserve_transfer(map_id, x, y, direction)
end
#--------------------------------------------------------------------------
# ? Move By Input
#--------------------------------------------------------------------------
alias mog_pickup_move_by_input move_by_input
def move_by_input
return if $game_temp.pickup_lock_time > 0
mog_pickup_move_by_input
end
#--------------------------------------------------------------------------
# ? Throw Event
#--------------------------------------------------------------------------
def throw_event
for event in $game_map.events.values
if event.throw_active and not jumping?
$game_temp.can_throw = true
event.throw_action(event.throw)
return if $game_temp.can_throw == false
$game_temp.pickup_lock_time = event.jump_count
$game_temp.throw_position[0] = event.x
$game_temp.throw_position[1] = event.y
event.throw_active = false
$game_temp.pickup_lock = false
Audio.se_play("Audio/SE/" + THROW_SE, 100, 100)
@character_name = $game_temp.character_pre_name
break
end
end
if event == nil
$game_map.reset_pickup
end
end
#--------------------------------------------------------------------------
# ? Check Event Pickup
#--------------------------------------------------------------------------
def check_event_pickup(triggers)
front_x = $game_map.x_with_direction(@x, @direction)
front_y = $game_map.y_with_direction(@y, @direction)
for event in $game_map.events_xy(front_x, front_y)
if event.throw > 0 and not jumping?
event.throw_active = true
$game_temp.pickup_lock = true
event.jump(0,0)
$game_temp.pickup_lock_time = event.jump_count
event.x = $game_player.x
event.y = $game_player.y
Audio.se_play("Audio/SE/" + PICK_UP_SE, 100, 100)
$game_temp.character_pre_name = @character_name
make_pickup_pose
break
end
end
end
#--------------------------------------------------------------------------
# ? Img Pickup Exist?
#--------------------------------------------------------------------------
def img_pickup_exist?
Cache.character(@character_name + "_Pickup") rescue return false
end
#--------------------------------------------------------------------------
# ? Make Pickup Pose
#--------------------------------------------------------------------------
def make_pickup_pose
@character_name = @character_name + "_Pickup" if img_pickup_exist?
end
end
#==============================================================================
# ¦ Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
include MOG_PICK_THROW
#--------------------------------------------------------------------------
# ? Update X Effects
#--------------------------------------------------------------------------
alias mog_pickup_update_position update_position
def update_position
mog_pickup_update_position
update_pickup_position if can_pickup_position?
end
#--------------------------------------------------------------------------
# ? Can Pickup Position
#--------------------------------------------------------------------------
def can_pickup_position?
return false if $game_temp.pickup_lock_time > 0
return false if $game_temp.pickup_lock == false
return false if @character.throw_active == false
return false if @character.is_a?(Game_Player)
return false if @character.jumping?
return true
end
#--------------------------------------------------------------------------
# ? Update Pickup Position
#--------------------------------------------------------------------------
def update_pickup_position
@character.x = $game_player.x
@character.y = $game_player.y
@character.bush_depth = 0
unless @character.direction_fix
@character.direction = $game_player.direction
end
self.x = $game_player.screen_x
self.y = $game_player.screen_y - SPRITE_POSITION
self.z = $game_player.screen_z + 1
end
end
#==============================================================================
# ¦ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ? Call Menu
#--------------------------------------------------------------------------
alias mog_pickup_call_menu call_menu
def call_menu
return if $game_temp.pickup_lock == true
mog_pickup_call_menu
end
end
#==============================================================================
# ¦ Game Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ? Command 352
#--------------------------------------------------------------------------
alias mog_pickup_command_352 command_352
def command_352
return if $game_temp.pickup_lock == true
mog_pickup_command_352
end
end
#==============================================================================
# ¦ Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ? XAS Initial Setup
#--------------------------------------------------------------------------
alias mog_pickup_setup setup
def setup(map_id)
mog_pickup_setup(map_id)
reset_pickup
end
#--------------------------------------------------------------------------
# ? Reset Pickup
#--------------------------------------------------------------------------
def reset_pickup
for i in $game_map.events.values
if i.throw_active
i.throw_active = false
i.moveto($game_player.x,$game_player.y)
i.jump(0,0)
i.move_backward
$game_player.character_name = $game_temp.character_pre_name
end
end
$game_temp.pickup_lock_time = 0
$game_temp.pickup_lock = false
end
end
$mog_rgss3_pickup_and_throw = true
Et en plus du script, un lien de téléchargement de la démo (dans laquelle le script est aussi en français) : http://dl.free.fr/getfile.pl?file=/tggAiWwj
+1 pt de participation
- GummyStaffeux retraité
- Nombre de messages : 2666
Age : 33
Localisation : Belgique
Distinction : Modérateur imprévisible
Papy Lolo' [Nabots Nimousse]
Date d'inscription : 27/01/2008
Re: Prendre et Lancer FR
Mer 25 Avr 2012 - 9:32
Intéressant pour ajouter des trucs intéressants au gameplay.
Merci, +2pts de participation
Merci, +2pts de participation
- LightNoxMembre
- Nombre de messages : 1759
Age : 34
Localisation : Chez Moi ^^
Date d'inscription : 10/04/2008
Re: Prendre et Lancer FR
Mer 25 Avr 2012 - 11:40
ce script et plutot bien ^^
merci du partage
merci du partage
- faller-magieMembre
- Nombre de messages : 873
Age : 30
Localisation : Diubdal, France.
Distinction : aucune
Date d'inscription : 20/02/2012
Re: Prendre et Lancer FR
Mer 25 Avr 2012 - 16:14
Un partage de controle intéressant comme le dit Gummy.
Merci pour le partage Norvez.
Merci pour le partage Norvez.
- NozvezMembre
- Nombre de messages : 354
Distinction : aucune
Date d'inscription : 16/03/2012
Re: Prendre et Lancer FR
Mer 25 Avr 2012 - 17:26
Merci, je me suis mise à la traduction de scripts donc j'en posterai d'autres plus ou moins intéressants, j'ai mis celui-là pour le moment parce qu'il était très rapide à traduire (donc j'ai pu le faire devant mon petit-déj ce matin^^).
- SilverSoulMembre
- Nombre de messages : 274
Age : 31
Localisation : Canada~
Distinction : aucune
Date d'inscription : 22/04/2012
Re: Prendre et Lancer FR
Mer 25 Avr 2012 - 18:35
Sympa C:
Merci du partage <3
Merci du partage <3
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum