Le Deal du moment :
Réassort du coffret Pokémon 151 ...
Voir le deal

Aller en bas
Anonymous
Invité
Invité

[Résolu] Script 8 directions Empty [Résolu] Script 8 directions

Mar 10 Juil 2012 - 22:35
Après avoir chercher sur le web, j'ai trouvé plusieurs script concernant la marche dans les 8 directions

Mais en fait je voudrais un script qui permette de marcher dans les 8 directions si un interrupteur est activé ou desactivé.

Merci d'avance

PS : Etant donné que je ne sais pas manier les script (même si c'est un de mes objectifs)je ne sais pas modifier un script déja existant

En fait le nombre de direction peut-être supérieur à 8 du moment qu'il à un un interupteur|


Dernière édition par sensee28 le Sam 14 Juil 2012 - 17:55, édité 1 fois
Gummy
Gummy
Staffeux retraité

Nombre de messages : 2666
Age : 32
Localisation : Belgique
Distinction : Modérateur imprévisible

Papy Lolo' [Nabots Nimousse]


Date d'inscription : 27/01/2008

[Résolu] Script 8 directions Empty Re: [Résolu] Script 8 directions

Jeu 12 Juil 2012 - 13:56
Quel est l'intérêt de restreindre le mouvement à 8 directions? Quelle est la raison valable derrière ce choix?
Anonymous
Invité
Invité

[Résolu] Script 8 directions Empty Re: [Résolu] Script 8 directions

Ven 13 Juil 2012 - 19:24
C'est pour pouvoir bouger en 4 directions dans certaines map et en 8 directions dans d'autre
Gummy
Gummy
Staffeux retraité

Nombre de messages : 2666
Age : 32
Localisation : Belgique
Distinction : Modérateur imprévisible

Papy Lolo' [Nabots Nimousse]


Date d'inscription : 27/01/2008

[Résolu] Script 8 directions Empty Re: [Résolu] Script 8 directions

Ven 13 Juil 2012 - 20:15
Sans blague... Je m'en doute bien, mais pourquoi? Bref ce genre de choses est faisable en events, en jouant avec des conditions qui repose sur l'appui des touches directionnelles et les coordonnées du personnage.
Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

[Résolu] Script 8 directions Empty Re: [Résolu] Script 8 directions

Ven 13 Juil 2012 - 20:47
Saloute Sensee28

Peux-tu mettre les scripts que tu as trouvé en ligne que je puisse voir ce que je peux faire ?
Anonymous
Invité
Invité

[Résolu] Script 8 directions Empty Re: [Résolu] Script 8 directions

Sam 14 Juil 2012 - 12:38
En faiit je viens d'en trouver un lien
sauf que l'interrupteur n'est pas présent enfin
Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

[Résolu] Script 8 directions Empty Re: [Résolu] Script 8 directions

Sam 14 Juil 2012 - 15:26
Essaie ça pour voir si ça te convient :

Code:
=begin
#-------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Script Features and Directions:

Move Diagonally + Optimization:
Proceed in an direction and input the jump button while holding a
directional button to jump.

In addition, you can optimize the controls by making the input button close or
comfortable for the player while using the arrow keys

There is no feature to jump while moving in a diagonal direction.

The High Jump Ability:
The original jump distance of two cells (spaces) can be increased to 3 cells
with the use of high jump.

You can also create equipment that will be able to use jump. If you do not have
that equipment on, then the player won't be able to jump

If you do not want the player to be able to jump, you can deactivate it by a
script in the customization below.

If you want the player to be able to jump over something, make sure that the
player has enough space to do so.

Movement speed adjustment:
Change the default movement speed.

 NANAME_SPEED:
The jump speed. Default is 4. The higher the number is, the faster.

Dash features all the time:
A dash to the state at all times regardless of input.

 AUTO_DASH:
The player will dash on their own.
true = Enable false = Disabled


This Script has redefined:
 Game_Character
 Game_Player < Game_Character

 Changing this script may result in compatability errors, so do so at your own
risk...

=end
#==============================================================================
# Begin Customization
#==============================================================================
module DAI

# Set diagonal movement
# Pour activer le mouvement 8 directions activer l'interrupteur 1 (modifiable ligne 118)

#Speed and Dash settings
SPEED = 4 #The player speed. Default is 4. 5 and 6 is the
#speed of light!
AUTO_DASH = false # Allow Auto Dash?

# Jump Settings
JUMP = true # Allow Jump? (2 cells)
HIJUMP = true # Allow High Jump (3 cells)
JUMP_INPUT = Input::X # Button used for jumping
JUMP_SE = RPG::SE.new("jump1", 60, 100) # SE for jumping (Name,Pitch,Vol.)

# Disable Jump Switch
JUMP_OP = 10 # Turn on this switch to disable jumping
# Equipment Settings
JUMP_ARMOR = 31 #ID of the Equipment using jump.
#If the number is 0, jump is always on.
HIJUMP_ARMOR = 32 # ID of the Equipment using high jump.
#If the number is 0, high jump will always be on
Activer = 1

end
#==============================================================================
# End Customization
#==============================================================================

#==============================================================================
# ■ Game_Player
#------------------------------------------------------------------------------
#  プレイヤーを扱うクラスです。イベントの起動判定や、マップのスクロールなどの
# 機能を持っています。このクラスのインスタンスは $game_player で参照されます。
#==============================================================================
#--------------------------------------------------------------------------
# ● 方向ボタン入力による移動処理(再定義)
#--------------------------------------------------------------------------
class Game_Player < Game_Character
def move_by_input
if @jump_Reservation && jump_movable? # ジャンプ予約中でジャンプが可能?
unless $game_map.interpreter.running? or jumping?
jump_down if @direction == 2
jump_left if @direction == 4
jump_right if @direction == 6
jump_up if @direction == 8
return
end
end
unless movable?
if Input.trigger?(DAI::JUMP_INPUT) && in_vehicle? == false &&
@jump_Reservation == false && dai_jump_possible?
@jump_Reservation = true # ジャンプ予約
return
else
return
end
end
if jumping? or $game_map.interpreter.running?
@jump_Reservation = false # ジャンプ予約解除
return
end
if $game_switches[1] == true
mood = Input.dir8
else
mood = Input.dir4
end
speed = DAI::SPEED
@move_speed = speed if $game_player.vehicle_type == -1 # 徒歩なら速度変更
if Input.trigger?(DAI::JUMP_INPUT) && dai_jump_possible? && in_vehicle? == false
case mood
when 0 then jump(0, 0)
DAI::JUMP_SE.play
@jump_Reservation = false
when 2 then jump_down
when 4 then jump_left
when 6 then jump_right
when 8 then jump_up
when 1 then jump_down if @direction == 2
jump_left if @direction == 4
when 3 then jump_down if @direction == 2
jump_right if @direction == 6
when 7 then jump_left if @direction == 4
jump_up if @direction == 8
when 9 then jump_right if @direction == 6
jump_up if @direction == 8
end
else
case mood
when 2 then move_down
when 4 then move_left
when 6 then move_right
when 8 then move_up
when 1 then move_lower_left
when 3 then move_lower_right
when 7 then move_upper_left
when 9 then move_upper_right
end
end
end
#--------------------------------------------------------------------------
# ● 予約ジャンプの制御判定(追加定義)
#--------------------------------------------------------------------------
def jump_movable?
return false if @move_route_forcing # 移動ルート強制中
return false if @vehicle_getting_on # 乗る動作の途中
return false if @vehicle_getting_off # 降りる動作の途中
return false if $game_message.visible # メッセージ表示中
return false if in_airship? and not $game_map.airship.movable?
return true
end
end
#==============================================================================
# ■ Game_Character
#------------------------------------------------------------------------------
#  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
# クラスのスーパークラスとして使用されます。
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# ● 移動時の更新(再定義)
#--------------------------------------------------------------------------
def update_move
distance = (2 ** @move_speed) # 移動速度から移動距離に変換
if DAI::AUTO_DASH
distance *= 2 # オートダッシュONなら常に倍に
else
distance *= 2 if dash? # オートダッシュOFF時、ダッシュ状態なら倍に
end
if @x * 256 != @real_x and @y * 256 != @real_y # 斜め移動時は速度調整
distance = (distance / 1.4).to_i
end
@real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
@real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
@real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
@real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
update_bush_depth unless moving?
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end
#--------------------------------------------------------------------------
# ● ジャンプ可能判定(追加定義)
#--------------------------------------------------------------------------
def dai_jump_possible?
return false unless DAI::JUMP
return false if $game_switches[DAIJUMP_OP]
return true if DAI::JUMP_ARMOR == 0
b = []
for i in 0...$game_party.members.size # パーティー内に指定装備があるか検索
actor = $game_party.members[i]
b.push(actor.armors.include?($data_armors[DAIJUMP_ARMOR]))
end
if b.include?(true)
return true
else
c =[]
for i in 0...$game_party.members.size # パーティー内に指定装備があるか検索
actor = $game_party.members[i]
c.push(actor.armors.include?($data_armors[DAIHIJUMP_ARMOR]))
end
if c.include?(true)
return true
else
return false
end
end
end
#--------------------------------------------------------------------------
# ● ハイジャンプ可能判定(追加定義)
#--------------------------------------------------------------------------
def dai_hi_jump_possible?
return false unless dai_jump_possible?
return false unless DAI::HIJUMP
return true if DAI::HIJUMP_ARMOR == 0
b = []
for i in 0...$game_party.members.size # パーティー内に指定装備があるか検索
actor = $game_party.members[i]
b.push(actor.armors.include?($data_armors[DAIHIJUMP_ARMOR]))
end
if b.include?(true)
return true
else
return false
end
end
#--------------------------------------------------------------------------
# ● 左下に移動(1)追加定義
#--------------------------------------------------------------------------
def move_lower_left # 方向キーが左下に入力されている場合の処理
unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
end
pa = passable?(@x, @y +1) # 下が通行可能か?
pb = passable?(@x -1, @y) # 左が通行可能か?
pc = passable?(@x -1, @y +1) # 左下が通行可能か?
if pa && pb && pc # 上記三方向が通行可能なら左下に移動
@x = $game_map.round_x(@x -1)
@real_x = (@x +1) * 256
@y = $game_map.round_y(@y +1)
@real_y = (@y -1) * 256
increase_steps # 斜め移動時の歩数を加算
else
if @direction == 2 # 下を向いている場合
if pb ; move_left # 左が通行可能なら左に移動
else
move_down if pa # 下が通行可能なら左に移動
end
elsif @direction == 4 # 左を向いている場合
if pa ; move_down # 下が通行可能なら下に移動
else
move_left if pb # 左が通行可能なら左に移動
end
end
end
if not moving?
@move_failed = true
@direction = Input.dir4
end
end
#--------------------------------------------------------------------------
# ● 右下に移動(3)追加定義
#--------------------------------------------------------------------------
def move_lower_right # 方向キーが右下に入力されている場合の処理
unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
end
pa = passable?(@x, @y +1) # 下が通行可能か?
pb = passable?(@x +1, @y) # 右が通行可能か?
pc = passable?(@x +1, @y +1) # 右下が通行可能か?
if pa && pb && pc # 上記三方向が通行可能なら右下に移動
@x = $game_map.round_x(@x +1)
@real_x = (@x -1) * 256
@y = $game_map.round_y(@y +1)
@real_y = (@y -1) * 256
increase_steps # 斜め移動時の歩数を加算
else
if @direction == 2 # 下を向いている場合
if pb ; move_right # 右が通行可能なら右に移動
else
move_down if pa # 下が通行可能なら下に移動
end
elsif @direction == 6 # 右を向いている場合
if pa ; move_down # 下が通行可能なら下に移動
else
move_right if pb # 右が通行可能なら右に移動
end
end
end
if not moving?
@move_failed = true
@direction = Input.dir4
end
end
#--------------------------------------------------------------------------
# ● 左上に移動(7)追加定義
#--------------------------------------------------------------------------
def move_upper_left # 方向キーが左上に入力されている場合の処理
unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
end
pa = passable?(@x, @y -1) # 上が通行可能か?
pb = passable?(@x -1, @y) # 左が通行可能か?
pc = passable?(@x -1, @y -1) # 左上が通行可能か?
if pa && pb && pc # 上記三方向が通行可能なら左上に移動
@x = $game_map.round_x(@x -1)
@real_x = (@x +1) * 256
@y = $game_map.round_y(@y -1)
@real_y = (@y +1) * 256
increase_steps # 斜め移動時の歩数を加算
else
if @direction == 8 # 上を向いている場合
if pb ; move_left # 左が通行可能なら左に移動
else
move_up if pa # 上が通行可能なら上に移動
end
elsif @direction == 4 # 左を向いている場合
if pa ; move_up # 上が通行可能なら上に移動
else
move_left if pb # 左が通行可能なら左に移動
end
end
end
if not moving?
@move_failed = true
@direction = Input.dir4
end
end
#--------------------------------------------------------------------------
# ● 右上に移動(9)追加定義
#--------------------------------------------------------------------------
def move_upper_right # 方向キーが右上に入力されている場合の処理
unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
end
pa = passable?(@x, @y -1) # 上が通行可能か?
pb = passable?(@x+1, @y) # 右が通行可能か?
pc = passable?(@x+1, @y -1) # 右上が通行可能か?
if pa && pb && pc # 上記三方向が通行可能なら右上に移動
@x = $game_map.round_x(@x + 1)
@real_x = (@x - 1) * 256
@y = $game_map.round_y(@y - 1)
@real_y = (@y + 1) * 256
increase_steps # 斜め移動時の歩数を加算
else
if @direction == 8 # 上を向いている場合
if pb ; move_right # 右が通行可能なら右に移動
else
move_up if pa # 上が通行可能なら上に移動
end
elsif @direction == 6 # 右を向いている場合
if pa ; move_up # 上が通行可能なら上に移動
else
move_right if pb # 右が通行可能なら右に移動
end
end
end
if not moving?
@move_failed = true
@direction = Input.dir4
end
end
#--------------------------------------------------------------------------
# ● 下へジャンプ(追加定義)
#--------------------------------------------------------------------------
def jump_down
pa = passable?(@x, @y +1) # 1 マス下が通行可能か?
pb = passable?(@x, @y +2) # 2 マス下が通行可能か?
pc = passable?(@x, @y +3) # 3 マス下が通行可能か?
DAI::JUMP_SE.play # SEの演奏
@jump_Reservation = false # ジャンプ予約解除
if dai_hi_jump_possible? && pc # ジャンプ可能な最も遠い位置へジャンプ
jump(0, +3)
return
end
if pb
jump(0, +2)
return
end
if pa
jump(0, +1)
return
else
jump(0, 0)
end
end
#--------------------------------------------------------------------------
# ● 左へジャンプ(追加定義)
#--------------------------------------------------------------------------
def jump_left
pa = passable?(@x -1, @y) # 1 マス左が通行可能か?
pb = passable?(@x -2, @y) # 2 マス左が通行可能か?
pc = passable?(@x -3, @y) # 3 マス左が通行可能か?
DAI::JUMP_SE.play # SEの演奏
@jump_Reservation = false # ジャンプ予約解除
if dai_hi_jump_possible? && pc # ジャンプ可能な最も遠い位置へジャンプ
jump(-3, 0)
return
end
if pb
jump(-2, 0)
return
end
if pa
jump(-1, 0)
return
else
jump(0, 0)
end
end
#--------------------------------------------------------------------------
# ● 右へジャンプ(追加定義)
#--------------------------------------------------------------------------
def jump_right
pa = passable?(@x +1, @y) # 1 マス右が通行可能か?
pb = passable?(@x +2, @y) # 2 マス右が通行可能か?
pc = passable?(@x +3, @y) # 3 マス右が通行可能か?
DAI::JUMP_SE.play # SEの演奏
@jump_Reservation = false # ジャンプ予約解除
if dai_hi_jump_possible? && pc # ジャンプ可能な最も遠い位置へジャンプ
jump(+3, 0)
return
end
if pb
jump(+2, 0)
return
end
if pa
jump(+1, 0)
return
else
jump(0, 0)
end
end
#--------------------------------------------------------------------------
# ● 上へジャンプ(追加定義)
#--------------------------------------------------------------------------
def jump_up
pa = passable?(@x, @y -1) # 1 マス上が通行可能か?
pb = passable?(@x, @y -2) # 2 マス上が通行可能か?
pc = passable?(@x, @y -3) # 3 マス上が通行可能か?
DAI::JUMP_SE.play # SEの演奏
@jump_Reservation = false # ジャンプ予約解除
if dai_hi_jump_possible? && pc # ジャンプ可能な最も遠い位置へジャンプ
jump(0, -3)
return
end
if pb
jump(0, -2)
return
end
if pa
jump(0, -1)
return
else
jump(0, 0)
end
end
end

Explication :

Si l'interrupteur n°1 est activé le personnage peut se déplacer dans les 8 directions
Si il est désactivé il peut se déplacer dans 4 directions.
Anonymous
Invité
Invité

[Résolu] Script 8 directions Empty Re: [Résolu] Script 8 directions

Sam 14 Juil 2012 - 17:44
Merci !!

Tu viens de me débloquer de mon jeu Merci encore Very Happy
cator. lol
cator. lol
Membre

Nombre de messages : 164
Age : 32
Localisation : Cherche pas, tu me trouveras jamais.
Distinction : Zoophile à ses heures perdues, au torse poilu et qui chante YMCA
Frère de poils!
[Mist' Wink]
Maître du plantage d'arbres à femme : pour la sauvegarde des arbres et des petits oiseaux, vive la nature. [Balb' Wink]
crefadet le violeur du bois [Balb' [Résolu] Script 8 directions 522164]
Date d'inscription : 02/02/2012

[Résolu] Script 8 directions Empty Re: [Résolu] Script 8 directions

Sam 14 Juil 2012 - 17:45
tu peux donc passer en résolu en ajoutant [Résolu] dans le titre de ton topic Wink
Contenu sponsorisé

[Résolu] Script 8 directions Empty Re: [Résolu] Script 8 directions

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