| 赞 | 5 |
| VIP | |
| 好人卡 | |
| 积分 | 73 |
| 经验 | |
| 最后登录 | 2026-7-13 |
| 在线时间 | 1244 小时 |
- 梦石
- 0
- 星屑
- 7296
- 在线时间
- 1244 小时
- 注册时间
- 2015-8-15
- 回帖
- 473
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 金芒芒 于 2022-11-30 14:35 编辑
ARPG 进入战斗地图cp值=0 快捷键1-7已经设好,快捷键是安放技能的,变量1-7号=快捷键1-7。
‘’如果‘’1号变量值等于角色2号. 角色2号=9号变量.9号变量的常量等于6000MS.
地图上价格CP条,那么1号快捷键满CP就=6000MS,等快捷键1号满CP的时候强行2号角色使用技能。
[pre lang="ruby"]class Game_Character
#--------------------------------------------------------------------------
# ● 指定イベントに近づく ●接近指定活动
#--------------------------------------------------------------------------
def move_toward_event(id)
# 指定イベントの座標との差を求める #求出与指定事件坐标的差
sx = @x - $game_map.events[id].x
sy = @y - $game_map.events[id].y
# 坐标相等时
if sx == 0 and sy == 0
return
end
# 差の絶対値を求める #求差的绝对值
abs_sx = sx.abs
abs_sy = sy.abs
# 横の距離と縦の距離が等しい場合#横向距离和纵向距离相等时
if abs_sx == abs_sy
# ランダムでどちらかを 1 増やす #随机增加1
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# 横の距離のほうが長い場合 横向距离较长时
if abs_sx > abs_sy
# 左右方向を優先し、指定イベントのいるほうへ移動
#优先左右方向,向有指定事件的方向移动
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
# 縦の距離のほうが長い場合 纵向距离较长时
else
# 优先上下方向,向有指定事件的方向移动
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
#--------------------------------------------------------------------------
# ● 指定イベントから遠ざかる #距离指定事件
#--------------------------------------------------------------------------
def move_away_from_event(id)
# 指定イベントの座標との差を求める
#求出与指定事件坐标的差
sx = @x - $game_map.events[id].x
sy = @y - $game_map.events[id].y
# 座標が等しい場合#坐标相等时
if sx == 0 and sy == 0
return
end
# 差の絶対値を求める求差的绝对值
abs_sx = sx.abs
abs_sy = sy.abs
# 横の距離と縦の距離が等しい場合
#横向距离和纵向距离相等时
if abs_sx == abs_sy
# ランダムでどちらかを 1 増やす
#随机增加1
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# 横の距離のほうが長い場合#横向距离较长时
if abs_sx > abs_sy
# 左右方向を優先し、指定イベントのいないほうへ移動
#优先左右方向,向没有指定事件的方向移动
sx > 0 ? move_right : move_left
if not moving? and sy != 0
sy > 0 ? move_down : move_up
end
# 縦の距離のほうが長い場合
# 纵向距离较长时
else
# 上下方向を優先し、指定イベントのいないほうへ移動
#优先上下方向,向没有指定事件的方向移动
sy > 0 ? move_down : move_up
if not moving? and sx != 0
sx > 0 ? move_right : move_left
end
end
end
#--------------------------------------------------------------------------
# ● 指定座標に近づく#接近指定坐标
#--------------------------------------------------------------------------
def move_toward_position(x, y)
# 座標の差を求める #求坐标差
sx = @x - x
sy = @y - y
# 座標が等しい場合 坐标相等时
if sx == 0 and sy == 0
return
end
# 求差的绝对值
abs_sx = sx.abs
abs_sy = sy.abs
# 横の距離と縦の距離が等しい場合
# 横向距离和纵向距离相等时
if abs_sx == abs_sy
# ランダムでどちらかを 1 増やす
#随机增加一个
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# 横の距離のほうが長い場合
# 横向距离较长时
if abs_sx > abs_sy
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
# 縦の距離のほうが長い場合
# 纵向距离较长时
else
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
#--------------------------------------------------------------------------
# ● 指定座標から遠ざかる ●远离指定坐标
#--------------------------------------------------------------------------
def move_away_from_position(x, y)
# 座標の差を求める 求坐标差
sx = @x - x
sy = @y - y
# 座標が等しい場合 坐标相等时
if sx == 0 and sy == 0
return
end
# 差の絶対値を求める 求差的绝对值
abs_sx = sx.abs
abs_sy = sy.abs
# 横の距離と縦の距離が等しい場合
# 横向距离和纵向距离相等时
if abs_sx == abs_sy
# ランダムでどちらかを 1 増やす
# 随机增加一个
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# 横の距離のほうが長い場合
# 横向距离较长时
if abs_sx > abs_sy
sx > 0 ? move_right : move_left
if not moving? and sy != 0
sy > 0 ? move_down : move_up
end
# 縦の距離のほうが長い場合
#纵向距离较长时
else
sy > 0 ? move_down : move_up
if not moving? and sx != 0
sx > 0 ? move_right : move_left
end
end
end
#--------------------------------------------------------------------------
# ● 指定イベントの方を向く ●面向指定活动
#--------------------------------------------------------------------------
def turn_toward_event(id)
# 指定イベントの座標との差を求める
#求出与指定事件坐标的差
sx = @x - $game_map.events[id].x
sy = @y - $game_map.events[id].y
# 座標が等しい場合 坐标相等时
if sx == 0 and sy == 0
return
end
# 横の距離のほうが長い場合
#横向距离较长时
if sx.abs > sy.abs
# 左右方向で指定イベントのいるほうを向く
# 在左右方向朝向有指定活动的方向
sx > 0 ? turn_left : turn_right
# 縦の距離のほうが長い場合 #纵向距离较长时
else
# 上下方向で指定イベントのいるほうを向く
# 在上下方向朝向有指定活动的方向
sy > 0 ? turn_up : turn_down
end
end
#--------------------------------------------------------------------------
# ● 指定イベントの逆を向く
#--------------------------------------------------------------------------
def turn_away_from_event(id)
# 指定イベントの座標との差を求める
sx = @x - $game_map.events[id].x
sy = @y - $game_map.events[id].y
# 座標が等しい場合
if sx == 0 and sy == 0
return
end
# 横の距離のほうが長い場合
if sx.abs > sy.abs
# 左右方向で指定イベントのいないほうを向く
sx > 0 ? turn_right : turn_left
# 縦の距離のほうが長い場合
else
# 上下方向で指定イベントのいないほうを向く
sy > 0 ? turn_down : turn_up
end
end
#--------------------------------------------------------------------------
# ● 指定座標の方を向く
#--------------------------------------------------------------------------
def turn_toward_position(x, y)
# 座標の差を求める
sx = @x - x
sy = @y - y
# 座標が等しい場合
if sx == 0 and sy == 0
return
end
# 横の距離のほうが長い場合
if sx.abs > sy.abs
sx > 0 ? turn_left : turn_right
# 縦の距離のほうが長い場合
else
sy > 0 ? turn_up : turn_down
end
end
#--------------------------------------------------------------------------
# ● 指定座標の逆を向く
#--------------------------------------------------------------------------
def turn_away_from_position(x, y)
# 座標の差を求める
sx = @x - x
sy = @y - y
# 座標が等しい場合
if sx == 0 and sy == 0
return
end
# 横の距離のほうが長い場合
if sx.abs > sy.abs
sx > 0 ? turn_right : turn_left
# 縦の距離のほうが長い場合
else
sy > 0 ? turn_down : turn_up
end
end
#--------------------------------------------------------------------------
# ● 指定範囲内をランダムに移動
#--------------------------------------------------------------------------
def move_random_area(x, y, distance)
# 自分とエリア中心の座標の差を求める
sx = @x - x
sy = @y - y
# 既に範囲外にいる場合
if sx.abs + sy.abs > distance
# エリア中心に近づく
move_toward_position(x, y)
return
end
# とりあえずどの方向に進むか決定した後に距離判定
case rand(4)
when 0 # 下に移動
if sx.abs + sy < distance
move_down(false)
end
when 1 # 左に移動
if -sx + sy.abs < distance
move_left(false)
end
when 2 # 右に移動
if sx + sy.abs < distance
move_right(false)
end
when 3 # 上に移動
if sx.abs - sy < distance
move_up(false)
end
end
end
end
[/pre]
[pre lang="ruby"]module SXL_ICON
ICONS = {
1=>"$R_Key_1",
2=>"$R_Key_2",
3=>"$R_Key_3",
4=>"$R_Key_4",
5=>"$R_Key_5",
6=>"$R_Key_6",
7=>"$R_Key_7",
}
SKIN = "123"
X = 32
Y = 16
end
class KZGJ
def initialize
@base = Sprite.new
@base.bitmap = RPG::Cache.picture(SXL_ICON::SKIN)
@base.x = SXL_ICON::X
@base.y = SXL_ICON::Y
@base.z = SXL_ICON::Y+100
@width = @base.bitmap.width
@height = @base.bitmap.height
refresh
end
def refresh
sort
n = 0
@icon_set = []
for battler in @battlers_array
p battler.id
iconname = SXL_ICON::ICONS[battler.id]
sprite = Sprite.new
sprite.bitmap = RPG::Cache.icon(iconname)
sprite.x = SXL_ICON::X + n * 25 + 25
sprite.y = SXL_ICON::Y
sprite.z = @base.z + 100
@icon_set.push([sprite,battler.id])
n += 1
end
end
def reset
@icon_set.each { |set| set[0].dispose}
refresh
end
def cr(actor_id, position)
for set in @icon_set
if set[1] == actor_id then
set[0].x = SXL_ICON::X + position * 25 + 25
set[0].y = SXL_ICON::Y - 25
7.times { Graphics.update }
7.times { set[0].y += 7; Graphics.update}
break
end
end
end
def move_up(array)
for element in array
for i in 1..7
for set in @icon_set
if $game_map.events[element].at < $game_map.events[set[1]].at and set[0].visible == true then
set[0].x -= 7
end
end
Graphics.update
end
end
end
def move_down(index)
for i in 1..7
for set in @icon_set
if $game_map.events[index].at < $game_map.events[set[1]].at and set[0].visible == true then
set[0].x += 7
end
end
Graphics.update
end
end
def forward
for i in 1..7
for set in @icon_set
if set[0].visible == true then
set[0].x -= 7
end
end
Graphics.update
end
end
def conceal(array)
for id in array
for set in @icon_set
if id == set[1] then
set[0].visible = false
end
end
end
end
def sort
@battlers_array = []
for i in $game_system.tactics_actors.keys
actor = $game_map.events
if !$game_system.tactics_actors.dead? then
@battlers_array.push(actor)
end
end
for i in $game_system.tactics_enemies.keys
enemy = $game_map.events
if !$game_system.tactics_enemies.dead? then
@battlers_array.push(enemy)
end
end
@battlers_array.sort! {|a,b| a.at - b.at }
end
def dispose
@base.dispose
@icon_set.each { |set| set[0].dispose}
end
end
[/pre]
|
|