Project1
标题:
我做的教程;在地图中显血
[打印本页]
作者:
dengwei
时间:
2012-7-13 09:30
标题:
我做的教程;在地图中显血
=begin
哈哈!我在制作游戏时想让游戏地图能显示主人公1号的HP,就做了这款软件。
事后,我有仔细的看来一下这个脚本,突然发现,这款软件很适合当教材,就有了这个教材脚本!
呵呵~~虽然这款脚本不强大,但是足以满足某些游戏的需要
我在想要不要做一个开关控制,当x号开关开启时打开,其他时候关闭!
但是我觉得木有必要,哈哈~~~
如果哪位仁兄看了之后觉得有帮助,那么你们能尝试修改下次脚本吗?当作一次作业嘛!
例;修改方案↓
↓
做一个按键控制,当按下Q键打开,按下W键关闭!
↑
↑作业奥~~~~~
哈哈/ \
口。
=end
#==============================================================================
# ■ Window_HP-----<在地图中显血> ▼蚂蚁制作▼(STUPID ANT)
#------------------------------------------------------------------------------
class Window_hp < Window_Base
#class Window_hp是这个窗口的名称 ↑
#Window_hp < Window_Base表示这个窗口必须要放在 Window_Base窗口下面!当然还有你一个含义,这个可以不用明白! ↑
#----------《窗口初始化》--------------------------------------------------------------
def initialize #初始化变量
super( 0, 0, 160, 64) #super(0,0,窗口的宽度, 窗口的高度)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255 # 背景透明度,如果把_opacity去掉,就是窗口透明度。
self.opacity =0 # 窗口透明度
self.contents_opacity = 255 #内容透明
self.visible = true #窗口显示,如果把true改成false,则就是隐藏窗口。
refresh #刷新
end
#-------------《窗口刷新》-------------------------------------------------------------
def refresh #刷新变量
actor = $game_party.actors[0] #第N号角色,$game_party.actors[n]
# ↑→这是个变量,在这个脚本里不要修改它 ↑→第n号角色(n的取值范围 = 0~3)
self.contents.clear #清除以前的东西
# ↓→→→→→→→→→→→这是所写的坐标Y位置
draw_actor_hp(actor, 0, 0)
# ↑ ↑→这是所写的坐标X位置
# ↑
# ↑
# 这个在Window_Base里已经定义好了!
self.contents.font.color = normal_color#颜色,normal_color代表系统颜色,这个在Window_Base里已经定义好了!
end
end
#-------------------------《场景;Map(地图)》-------------------------------------
class Scene_Map #Scene是场景类,map是名称
alias hp_main main
#-------------------------《主处理》------------------------------------------------
def main #主处理的变量
@hp_window = Window_hp.new #打开Window_hp窗口
@hp_window.x = rand(480) #释放Window_hp窗口的X坐标
# ↑ ↑
# ↑ ↑→代表x,即随即范围是0~479
# ↑
# ↑→rand是一个函数,表达的意思是取x - 1的值
@hp_window.y = 0 #释放Window_hp窗口的Y坐标
@hp_window.opacity = 255 #释放Window_hp窗口的透明度
hp_main
@hp_window.dispose #释放Window_hp窗口
end
end
#---------------------《事件处理7的一部分》------------------------------------------
class Interpreter
#----------------------《第311号命令》------------------------------------------------
def command_311
value = operate_value(@parameters[1], @parameters[2], @parameters[3])# 获取操作值
# ↑→参数1 ↑→参数2 ↑→参数3
iterate_actor(@parameters[0]) do |actor| # 处理重复
if actor.hp > 0 # HP 不为 0 的情况下
if @parameters[4] == false and actor.hp + value <= 0 # 更改 HP
actor.hp = 0 #设置(如果不允许战斗不能的状态就设置为 x)
# ↑→x
else
actor.hp += value
end
end
end
$game_temp.gameover = $game_party.all_dead?# 游戏结束判定
$scene = Scene_Map.new #为了更好的刷新!
return true#继续
end
end
复制代码
作者:
1584927450
时间:
2012-7-13 16:55
毕竟大家都是新手菜鸟,就不坑人了,话说LZ,这脚本的功能……好像……
作者:
杀人神经婆
时间:
2012-7-16 13:13
1584927450 发表于 2012-7-13 16:55
毕竟大家都是新手菜鸟,就不坑人了,话说LZ,这脚本的功能……好像……
魔塔样板,我有显示全部能力的
Playerdate_SWITCH = 1 # 当1号开关打开,本脚本才开始工作。
Playerdate_magicdef =19
Yellowkey_itemid=1
Bluekey_itemid=2
Redkey_itemid=3
Greenkey_itemid=41
#==============================================================================
# ■ Window_PlayerDate
#------------------------------------------------------------------------------
# 显示玩家状态的窗口。
#==============================================================================
class Window_PlayerDate < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(0, 0, 800, 608)#395)#192,416
self.contents = Bitmap.new(width - 32, height - 32)
self.z =210
self.opacity=0
self.back_opacity =255
# self.contents_opacity = 255
self.visible = false
# self.contents.clear
refresh
# if $game_switches[XY_SWITCH]
# self.contents_opacity = 0
# else
# self.contents_opacity = 5
# end
end
def refresh
if $game_switches[50]#进入屏幕右侧状态栏换到左侧
self.x=0
else#进入屏幕左侧状态栏换到右侧
self.x=600
end
self.contents.clear
x=25
y=75
draw_actor_graphic($game_party.actors[0], 20, 40)
#勇士图形
self.contents.font.color = system_color
# bitmap = Bitmap.new("Graphics/Pictures/状态栏.png")
# self.contents.blt(-30, -30, bitmap, Rect.new(0, 0, 192, 610))
if $game_switches[73]==false
self.contents.draw_text(35, 11, 50, 20, "魔塔", 0) if $game_switches[36]
self.contents.draw_text(100, 11, 25, 20, "F", 0)if $game_switches[36]
else
if $game_variables[3]<10 and $game_variables[3]>=0
if $game_variables[2]<10 and $game_variables[2]>=0
self.contents.draw_text(-10, -100, 3025, 200, $data_mapname[$game_variables[37]].name.to_s, 0)
else
if $game_variables[2]<100 and $game_variables[2]>=10
self.contents.draw_text(-20, -100, 3025, 200, $data_mapname[$game_variables[37]].name.to_s, 0)
else
if $game_variables[2]>=100
self.contents.draw_text(-30, -100, 3025, 200, $data_mapname[$game_variables[37]].name.to_s, 0)
end
end
end
else
if $game_variables[3]<100 and $game_variables[3]>=10
if $game_variables[2]<10 and $game_variables[2]>=0
self.contents.draw_text(-20, -80, 3025, 200, $data_mapname[$game_variables[37]].name.to_s, 0)
else
if $game_variables[2]<100 and $game_variables[2]>=10
self.contents.draw_text(-30, -80, 3025, 200, $data_mapname[$game_variables[37]].name.to_s, 0)
else
if $game_variables[2]>=100
self.contents.draw_text(-40, -80, 3025, 200, $data_mapname[$game_variables[37]].name.to_s, 0)
end
end
end
else
if $game_variables[3]>=100
if $game_variables[2]<10 and $game_variables[2]>=0
self.contents.draw_text(-30, -80, 3025, 200, $data_mapname[$game_variables[37]].name.to_s, 0)
else
if $game_variables[2]<100 and $game_variables[2]>=10
self.contents.draw_text(-40, -80, 3025, 200, $data_mapname[$game_variables[37]].name.to_s, 0)
else
if $game_variables[2]>=100
self.contents.draw_text(-50, -80, 3025, 200, $data_mapname[$game_variables[37]].name.to_s, 0)
end
end
end
end
end
end
#以上是判定地图名字显示
end
self.contents.draw_text(0, 55, 50, 20, "LV", 0)
if $game_switches[1]
@data = []
@data.push($data_weapons[$game_party.actors[0].weapon_id])
@data.push($data_armors[$game_party.actors[0].armor1_id])
@data.push($data_armors[$game_party.actors[0].armor2_id])
@data.push($data_armors[$game_party.actors[0].armor3_id])
@data.push($data_armors[$game_party.actors[0].armor4_id])
@item_max = @data.size
draw_item_bitmap(@data[0], 0, 60+x*15)
draw_item_bitmap(@data[1], 32, 60+x*15)
draw_item_bitmap(@data[2], 64, 60+x*15)
draw_item_bitmap(@data[3], 96, 60+x*15)
draw_item_bitmap(@data[4], 128,60+x*15)
self.contents.font.color = system_color
bitmap = RPG::Cache.icon($data_items[1].icon_name)#黄钥匙)
self.contents.blt(0, 60+x*18, bitmap, Rect.new(0, 0, 32, 32))
#draw_item_bitmap($game_party.item_icon(item.id),32,60)
end
draw_actor_graphic($game_party.actors[0], 20, 40)#角色正面图
self.contents.font.color = text_color(1)
self.contents.draw_text(4, 65+x, 40, 20, "HP", 0)
self.contents.font.color = text_color(8)
self.contents.draw_text(4, 65+x*2, 40, 20, "SP", 0)
if $game_switches[19]
self.contents.font.color = text_color(1)
self.contents.draw_text(4, 65+x*3, 40, 20,"魔攻", 0)
self.contents.font.color = text_color(8)
self.contents.draw_text(4, 65+x*4, 40, 20,"魔防", 0)
else
self.contents.font.color = text_color(4)
self.contents.draw_text(4, 65+x*3, 40, 20,"物攻", 0)
self.contents.font.color = text_color(6)
self.contents.draw_text(4, 65+x*4, 40, 20,"物防", 0)
end
self.contents.font.color = text_color(7)
self.contents.draw_text(4, 65+x*5, 40, 20, "科攻", 0)
self.contents.draw_text(4, 65+x*6, 40, 20, "科防", 0)
self.contents.font.color = text_color(11)
self.contents.draw_text(4, 65+x*7, 40, 20,"攻速", 0)
self.contents.draw_text(4, 65+x*8, 40, 20,"移速", 0)
self.contents.font.color = text_color(2)
self.contents.draw_text(4, 65+x*9, 40, 20, "吸血", 0)
self.contents.font.color = text_color(12)
self.contents.draw_text(4, 65+x*10, 40, 20, "反弹", 0)
self.contents.font.color = text_color(2)
self.contents.draw_text(4, 65+x*11, 40, 20, "命中", 0)
self.contents.font.color = text_color(9)
self.contents.draw_text(4, 65+x*12, 40, 20, "闪避", 0)
self.contents.font.color = text_color(4)
self.contents.draw_text(4, 65+x*13, 40, 20, "ELY", 0)
self.contents.draw_text(4, 65+x*14, 40, 20, "EXP", 0)
@xgraphic=$game_party.actors[0]
if $game_switches[73]==false
@xfloor=$game_variables[2]
else
end
@xlevel=$game_actors[$game_variables[1]+1].level
@xlife=$game_actors[$game_variables[1]+1].hp
@xmagic=$game_actors[$game_variables[1]+1].sp
if $game_switches[19]
@xattact=$game_actors[$game_variables[1]+1].agi
@xdefence=$game_actors[$game_variables[1]+1].int
else
@xattact=$game_actors[$game_variables[1]+1].str
@xdefence=$game_actors[$game_variables[1]+1].dex
end
@xmagicdef=$game_actors[$game_variables[1]+2].hp
@xspeed=$game_actors[$game_variables[1]+2].sp
@xgongsu=$game_actors[$game_variables[1]+2].level
@xyisu=$game_actors[$game_variables[1]+2].exp
@xxixue=$game_actors[$game_variables[1]+2].str
@xfantan=$game_actors[$game_variables[1]+2].dex
@xmingzhong=$game_actors[$game_variables[1]+2].agi
@xshanbi=$game_actors[$game_variables[1]+2].int
@xgold=$game_party.gold
@xexp= $game_actors[$game_variables[1]+1].exp
@xyellowkey=$game_party.item_number(Yellowkey_itemid)
@xbluekey=$game_party.item_number(Bluekey_itemid)
@xredkey=$game_party.item_number(Redkey_itemid)
@xgreenkey=$game_party.item_number(Greenkey_itemid)
@xhong=$game_switches[59]
@xcheng=$game_switches[15]
@xhuang=$game_switches[58]
@xlv=$game_switches[13]
@xqing=$game_switches[16]
@xlan=$game_switches[12]
@xzi=$game_switches[61]
@xfen=$game_switches[60]
@xhui=$game_switches[11]
@xhei=$game_switches[62]
@xbai=$game_switches[63]
@xchange=$game_switches[50]
self.contents.font.color = normal_color
if $game_switches[73]==false
self.contents.draw_text(32, 0, 60, 45, @xfloor.to_s, 2) if $game_switches[36]
self.contents.draw_text(40, 0, 80, 45, @xfloor.to_s, 2) if !$game_switches[36]
else
end
self.contents.draw_text(50, 50, 65, 30, @xlevel.to_s, 2)
self.contents.draw_text(43, 65+x, 72, 20,@xlife .to_s, 2)
self.contents.draw_text(43, 65+x*2, 72, 20,@xmagic .to_s, 2)
if $game_switches[19]
self.contents.draw_text(50, 65+x*3, 65, 20,@xattact .to_s, 2)
self.contents.draw_text(50, 65+x*4, 65, 20,@xdefence .to_s, 2)
else
self.contents.draw_text(50, 65+x*3, 65, 20,@xattact .to_s, 2)
self.contents.draw_text(50, 65+x*4, 65, 20,@xdefence .to_s, 2)
end
self.contents.draw_text(50, 65+x*5, 65, 20,@xmagicdef .to_s, 2)
self.contents.draw_text(50, 65+x*6, 65, 20,@xspeed .to_s, 2)
self.contents.draw_text(50, 65+x*7, 65, 20,@xgongsu.to_s, 2)
self.contents.draw_text(50, 65+x*8, 65, 20,@xyisu.to_s, 2)
self.contents.draw_text(50, 65+x*9, 65, 20,@xxixue.to_s+"%", 2)
self.contents.draw_text(50, 65+x*10, 65, 20,@xfantan.to_s+"%", 2)
self.contents.draw_text(50, 65+x*11, 65, 20,@xmingzhong.to_s+"%", 2)
self.contents.draw_text(50, 65+x*12, 65, 20,@xshanbi.to_s+"%", 2)
self.contents.draw_text(50, 65+x*13, 65, 20, @xgold.to_s, 2)
self.contents.draw_text(50, 65+x*14, 65, 20,@xexp.to_s, 2)
self.contents.font.color = text_color(6)
self.contents.draw_text(75, 2850, 25, 20, @xyellowkey.to_s, 2)
self.contents.font.color = text_color(4)
self.contents.draw_text(75, 3130, 25, 20, @xbluekey .to_s, 2)
self.contents.font.color = text_color(2)
self.contents.draw_text(75, 3410, 25, 20, @xredkey.to_s, 2)
self.contents.font.color = text_color(3)
self.contents.draw_text(75, 3690, 25, 20, @xgreenkey.to_s, 2)
self.contents.font.color = text_color(1)
self.contents.draw_text(0, 65+x*16,20,20, "灼".to_s, 0) if $game_switches[59]
self.contents.font.color = text_color(3)
self.contents.draw_text(16, 65+x*16,20,20, "衰".to_s, 0) if $game_switches[15]
self.contents.font.color = text_color(4)
self.contents.draw_text(32, 65+x*16,20,20, "衰".to_s, 0) if $game_switches[58]
self.contents.font.color = text_color(6)
self.contents.draw_text(48, 65+x*16,20,20, "毒".to_s, 0) if $game_switches[13]
self.contents.font.color = text_color(7)
self.contents.draw_text(64, 65+x*16,20,20, "咒".to_s, 0) if $game_switches[16]
self.contents.font.color = text_color(8)
self.contents.draw_text(80, 65+x*16,20,20, "缓".to_s, 0) if $game_switches[12]
self.contents.font.color = text_color(10)
self.contents.draw_text(96, 65+x*16,20,20, "锁".to_s, 0) if $game_switches[61]
self.contents.font.color = text_color(11)
self.contents.draw_text(112,65+x*16,20,20, "怨".to_s, 0) if $game_switches[60]
self.contents.font.color = text_color(13)
self.contents.draw_text(128,65+x*16,20,20, "亡".to_s, 0) if $game_switches[11]
self.contents.font.color = text_color(14)
self.contents.draw_text(144,65+x*16,20,20, "引".to_s, 0) if $game_switches[62]
self.contents.font.color = text_color(0)
self.contents.draw_text(160,65+x*16,20,20, "反".to_s, 0) if $game_switches[63]
end
def judge#用于判断是否数据变更,节约内存
return true if @xgraphic!=$game_party.actors[0]
return true if @xfloor!=$game_variables[2]
return true if @xlevel!=$game_actors[$game_variables[1]+1].level
return true if @xlife!=$game_actors[$game_variables[1]+1].hp
return true if @xmagic!=$game_actors[$game_variables[1]+1].sp
if $game_switches[19]
return true if @xattact!=$game_actors[$game_variables[1]+1].agi
return true if @xdefence!=$game_actors[$game_variables[1]+1].int
else
return true if @xattact!=$game_actors[$game_variables[1]+1].str
return true if @xdefence!=$game_actors[$game_variables[1]+1].dex
end
return true if @xmagicdef!=$game_actors[$game_variables[1]+2].hp
return true if @xspeed!=$game_actors[$game_variables[1]+2].sp
return true if @xgongsu!=$game_actors[$game_variables[1]+2].level
return true if @xyisu!=$game_actors[$game_variables[1]+2].exp
return true if @xxixue!=$game_actors[$game_variables[1]+2].str
return true if @xfantan!=$game_actors[$game_variables[1]+2].dex
return true if @xmingzhong!=$game_actors[$game_variables[1]+2].agi
return true if @xshanbi!=$game_actors[$game_variables[1]+2].int
return true if @xgold!=$game_party.gold
return true if @xexp!= $game_actors[$game_variables[1]+1].exp
return true if @xyellowkey!=$game_party.item_number(Yellowkey_itemid)
return true if @xbluekey!=$game_party.item_number(Bluekey_itemid)
return true if @xredkey!=$game_party.item_number(Redkey_itemid)
return true if @xgreenkey!=$game_party.item_number(Greenkey_itemid)
return true if @xhong!=$game_switches[59]
return true if @xcheng!=$game_switches[15]
return true if @xhuang!=$game_switches[58]
return true if @xlv!=$game_switches[13]
return true if @xqing!=$game_switches[16]
return true if @xlan!=$game_switches[12]
return true if @xzi!=$game_switches[61]
return true if @xfen!=$game_switches[60]
return true if @xhui!=$game_switches[11]
return true if @xhei!=$game_switches[62]
return true if @xbai!=$game_switches[63]
return true if @xchange!=$game_switches[50]
return false
end
end
###########################################################################
# 下面的东西不需要掌握~ #
###########################################################################
class Scene_Map
alias xy_66rpg_main main
def main
$mapdamage.mapupdate
@Playerdate_window = Window_PlayerDate.new
@Playerdate_window.x = $game_variables[105]
# @xy_window.y = 480 - 96
# @xy_window.opacity = 0
xy_66rpg_main
@Playerdate_window .dispose
$mapdamage.pic.bitmap.clear
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
alias xy_66rpg_update update
def update
xy_66rpg_update
if $game_switches[Playerdate_SWITCH]
@Playerdate_window .visible = true
if @Playerdate_window.judge
@Playerdate_window .refresh
$mapdamage.mapupdate
end
else
@Playerdate_window .visible = false
end
end
end
#==========================================================================
# 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
#==========================================================================
复制代码
作者:
865491990
时间:
2012-9-21 22:03
这个怎么每次打开那个显示血的窗口坐标都不一样
作者:
囧小杰
时间:
2012-12-1 10:42
蚂蚁不见你上q啊!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1