魔塔编程题
❶ 魔塔的问题
1、插入个新脚本(用复制)。
#==============================================================================
# ■ Window_Demons
#------------------------------------------------------------------------------
# 显示战斗的窗口。
#==============================================================================
class Window_Demons < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(0, 0, 296, 128)
self.contents = Bitmap.new(width - 28, height - 30)
@width = self.width
self.x = 320-@width/2
self.y = 240-96
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh(actor,event)
self.contents.clear
self.contents.font.size = 16
enemy = event.enemy
w = get(enemy.name)
self.contents.draw_text(@width-w-32,0,w,16,enemy.name)
w = get("血:#{enemy.hp}")
self.contents.draw_text(@width-w-32,16,w,16,"血:" + (enemy.hp.to_s))
w = get("攻击:#{enemy.atk}")
self.contents.draw_text(@width-w-32,48,w,16,"攻击:" + (enemy.str.to_s))
w = get("防御:#{enemy.pdef}")
self.contents.draw_text(@width-w-32,64,w,16,"防御:" + (enemy.dex.to_s))
unless enemy.skill.nil?
w = get("Skill:" + (enemy.skill.name))
else
w = get("Skill:" + ("无"))
end
unless enemy.skill.nil?
self.contents.draw_text(@width-w-32,80,w,16,"Skill:" + (enemy.skill.name))
else
self.contents.draw_text(@width-w-32,80,w,16,"Skill:" + ("无"))
end
draw_actor_graphic($game_party.actors[0], 85, 32)
self.contents.draw_text(3, 83, 70, 70, @pro2.to_s)
self.contents.font.color = text_color(2)
self.contents.draw_text(170, 0, 50, 30, "V S")
self.contents.draw_text(230, 83, 70, 70, @pro.to_s)
self.contents.font.color = text_color(3)
@pro2=" 普通"
@v=$game_variables[91]
if $game_party.item_number(@v[0])>=1
self.contents.font.color = text_color(2)
@pro2=" 炎"
end
if $game_party.item_number(@v[4])>=1
self.contents.font.color = text_color(4)
@pro2=" 冰"
end
if $game_party.item_number(@v[3])>=1
self.contents.font.color = text_color(6)
@pro2=" 灵"
end
self.contents.draw_text(4,0,get(actor.name),16,actor.name)
self.contents.draw_text(4,16,get((actor.hp.to_s) + ":HP"),16,(actor.hp.to_s) + ":血")
self.contents.draw_text(4,48,get((actor.str.to_s) + ":str"),16,(actor.str.to_s) + ":攻击")
self.contents.draw_text(4,64,get((actor.dex.to_s) + ":dex"),16,(actor.dex.to_s) + ":防御")
end
end
改掉Game_Battler。
#==============================================================================
# ■ Game_Battler (分割定义 3)
#------------------------------------------------------------------------------
# 处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
# 超级类来使用。
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 应用通常攻击效果
# attacker : 攻击者 (battler)
#--------------------------------------------------------------------------
def attack_effect(attacker)
# 计算基本伤害
str = [attacker.str - 0].max
self.damage =attacker.str - dex / 1
# HP 的伤害计算
# 状态变化
# Miss 的情况下
self.hp -= self.damage
end
end
再插入。
class Game_DemonsEnemy < Game_Battler
#--------------------------------------------------------------------------
# ● 初始化对像
# id : ID
#--------------------------------------------------------------------------
def initialize(id)
super()
enemy = $data_enemies[id]
@enemy_id = enemy.id
@battler_name = enemy.battler_name
@battler_hue = enemy.battler_hue
@hp = maxhp
@sp = maxsp
end
def skill?
if self.actions[0].nil?
return false
end
# if @sp <= skill.sp_cost
return false
end
# return rand(100) > (100 - (self.actions[0].rating * 10))
end
def skill
if self.actions[0].nil?
return nil
end
if self.actions[0].kind == 1
return $data_skills[self.actions[0].skill_id]
else
return nil
end
end
#--------------------------------------------------------------------------
# ● 获取敌人 ID
#--------------------------------------------------------------------------
def id
return @enemy_id
end
#--------------------------------------------------------------------------
# ● 获取索引
#--------------------------------------------------------------------------
def index
return @member_index
end
#--------------------------------------------------------------------------
# ● 获取名称
#--------------------------------------------------------------------------
def name
return $data_enemies[@enemy_id].name
end
#--------------------------------------------------------------------------
# ● 获取基本 MaxHP
#--------------------------------------------------------------------------
def base_maxhp
return $data_enemies[@enemy_id].maxhp
end
#--------------------------------------------------------------------------
# ● 获取基本力量
#--------------------------------------------------------------------------
def base_str
return $data_enemies[@enemy_id].str
end
#--------------------------------------------------------------------------
# ● 获取基本灵巧
#--------------------------------------------------------------------------
def base_dex
return $data_enemies[@enemy_id].dex
end
#--------------------------------------------------------------------------
# ● 普通攻击 获取攻击方动画 ID
#--------------------------------------------------------------------------
def animation1_id
return $data_enemies[@enemy_id].animation1_id
end
#--------------------------------------------------------------------------
# ● 普通攻击 获取对像方动画 ID
#--------------------------------------------------------------------------
def animation2_id
return $data_enemies[@enemy_id].animation2_id
end
#--------------------------------------------------------------------------
# ● 获取 EXP
#--------------------------------------------------------------------------
def exp
return $data_enemies[@enemy_id].exp
end
#--------------------------------------------------------------------------
# ● 获取金钱
#--------------------------------------------------------------------------
def gold
return $data_enemies[@enemy_id].gold
end #--------------------------------------------------------------------------
def make_action
# 清除当前行动
self.current_action.clear
# 无法行动的情况
unless self.movable?
# 过程结束
return
end
# 抽取现在有效的行动
available_actions = []
rating_max = 0
for action in self.actions
# 确认回合条件
n = $game_temp.battle_turn
a = action.condition_turn_a
b = action.condition_turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
# 确认 HP 条件
if self.hp * 100.0 / self.maxhp > action.condition_hp
next
end
# 确认等级条件
if $game_party.max_level < action.condition_level
next
end
# 确认开关条件
switch_id = action.condition_switch_id
if switch_id > 0 and $game_switches[switch_id] == false
next
end
# 符合条件 : 添加本行动
available_actions.push(action)
if action.rating > rating_max
rating_max = action.rating
end
end
# 最大概率值作为 3 合计计算(0 除外)
ratings_total = 0
for action in available_actions
if action.rating > rating_max - 3
ratings_total += action.rating - (rating_max - 3)
end
end
# 概率合计不为 0 的情况下
if ratings_total > 0
# 生成随机数
value = rand(ratings_total)
# 设置对应生成随机数的当前行动
for action in available_actions
if action.rating > rating_max - 3
if value < action.rating - (rating_max - 3)
self.current_action.kind = action.kind
self.current_action.basic = action.basic
self.current_action.skill_id = action.skill_id
self.current_action.decide_random_target_for_enemy
return
else
value -= action.rating - (rating_max - 3)
end
end
end
end
end
修改脚本:
在Game_Event里面的。
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :trigger # 目标
attr_reader :list # 执行内容
attr_reader :starting # 启动中标志
最后一行加上:
attr_reader :enemy # 敌人
如果不加就会有BUG。
再在Window_Base里加上:
def get(str)
return self.contents.text_size(str).width
end
Scene_Map里加上:
attr_reader :spriteset
召唤界面脚本DemonsTap.attk(self_event)
他会自动关闭的。
2、
攻:$data_enemies[怪物编号].atk=值
防:$data_enemies[怪物编号].pdef=值
血(一般用不着):$data_enemies[怪物编号].maxhp=值
自行更改。
❷ Prg编程魔塔:敌方可以设置特殊魔法吗
恩,可以的。
❸ pascal编程语言 编一个魔塔游戏
http://tieba..com/p/2254936209
谁说做不出来的。。这是我写的,暂时没写完,不过已经能玩到33层了
❹ 问一个做魔塔的问题
这个,比较麻烦,建议LZ不要采用这种方法,这样的魔塔以个人角度来说算是比较次的魔塔了,除非LZ是做魔塔迷宫,这样或许还有趣味。
要这样也可以:
首先打开数据库,选择公共事件0017:每层的并行处理内容,在:
条件分歧:开关【0046:进入漆黑世界】==NO 这一行的前面加上:
条件分歧:开关【一个空的开关,比如:9999:全部楼层变黑】==NO
开关操作:【0046:进入漆黑世界】==NO
除此以外的场合
开关操作:【0046:进入漆黑世界】==OFF
分歧结束
这个分歧后,在你要让全部楼层变黑的事件上打开这个你刚才设置的新开关,然后在你要让全部楼层变亮的事件上关闭这个开关,就行了。
你明白了吗?不信可以试试,有问题来找我啦。
❺ @@会魔塔制作的高手请进,答对追加50分@@
1.脚本:▲Scene_Title
这里面的紫色字体也就是我们可以改的地方。有几行是:
#
生成命令窗口
s1
=
"新游戏"
s2
=
"继续"
s3
=
"退出"
S1后面引号是开始游戏选择的时候出现的文字,可以改一下,S2、S3以此类推。
确定后按F12游戏测试
2.脚本:▲Scene_Menu
里面有如下几行:
#
生成命令窗口
#
s1
=
$data_system.words.item
#
s2
=
$data_system.words.skill
#
s3
=
$data_system.words.equip
#
s4
=
"状态"
s1
=
"敌物资料"
s2
=
"使用物品"
s3
=
"存档"
s4
=
"读档"
s5
=
"重新开始"
s6
=
"结束游戏"
前面不带#的S1~S6后面的文字可以改变,也就是游戏时按ESC开启画面的时候左边的一行了。
3.脚本:▲Scene_Save
里面的这几行
#--------------------------------------------------------------------------
#
●
初始化对像
#--------------------------------------------------------------------------
def
initialize
super("要保存到这个文件吗?")
SUPER后括号中引号里面的“要保存到这个文件么?”是可以改的,存档的时候上面写的字就是改后的文字。
4(两个脚本连说)脚本:①▲Scene_Load②■Scene_Load2
这两个脚本非常相似,一个是按ESC之后的读档显示文字,另一个是开始界面读取进度的文字,到底哪个是哪个我搞不清楚,先看代码:
#--------------------------------------------------------------------------
#
●
初始化对像
#--------------------------------------------------------------------------
def
initialize
#
再生成临时对像
$game_temp
=
Game_Temp.new
#
选择存档时间最新的文件
$game_temp.last_file_index
=
0
latest_time
=
Time.at(0)
for
i
in
0..3
filename
=
make_filename(i)
if
FileTest.exist?(filename)
file
=
File.open(filename,
"r")
if
file.mtime
>
latest_time
latest_time
=
file.mtime
$game_temp.last_file_index
=
i
end
file.close
end
end
super("要载入哪个文件?")
end
SUPER后“要载入哪个文件?”是要改的,与存档近似。
@@@@@最重要的@@@@@
5.脚本:■Window_PlayerDate
这个脚本应该是最有用的,显示了玩游戏的时候左面的攻击防御等一系列东西!脚本也要复制很长,所以我分开来讲:
self.contents.font.color
=
text_color(3)
#
self.contents.draw_text(4,
0,
70,
45,
"第",
2)
self.contents.draw_text(4,
0,
125,
45,
"层",
2)
这一段代码,是最前面显示XX层的界面,如果想在前面加上“第”(也就是第XX层)的话就要把#符号去掉,如果想改变字体的颜色就要看前面的color后面小括号里显示的数字了,每一个数字代表的颜色都不同,一共有7个颜色,就是1~7,可以换颜色。
self.contents.draw_text(4,
0,
40,
142,
"等级",
2)
self.contents.draw_text(4,
0,
40,
208,
"生命",
2)
self.contents.draw_text(4,
0,
40,
263,
"攻击",
2)
self.contents.draw_text(4,
0,
40,
318,
"防御",
2)
self.contents.draw_text(4,
0,
40,
373,
"魔防",
2)
if
$game_switches[Playerdate_magicdef]
self.contents.draw_text(4,
0,
40,
439,
"经验",
2)
self.contents.draw_text(4,
0,
40,
494,
"金币",
2)
self.contents.font.color
=
text_color(6)
self.contents.draw_text(4,
0,
60,
576,
"黄钥匙",
2)
self.contents.font.color
=
text_color(4)
self.contents.draw_text(4,
0,
60,
640,
"蓝钥匙",
2)
self.contents.font.color
=
text_color(2)
self.contents.draw_text(4,
0,
60,
704,
"红钥匙",
2)
这一段代码,是显示等级生命等东西的了,这里面好多我都没研究明白,以红钥匙那行的代码来说,4,0,60,704中的704代表上下,如果输入704以前的数字,“红钥匙”这三个字就会往上挪。不改变是正常的,要不就会里出外进了。如果要想等级一个颜色,生命一个颜色等,就要加脚本了,先给你们看加了颜色的代码,再给你们讲:
self.contents.font.color
=
text_color(1)
self.contents.draw_text(4,
0,
40,
142,
"等级",
2)
self.contents.font.color
=
text_color(2)
self.contents.draw_text(4,
0,
40,
208,
"生命",
2)
self.contents.font.color
=
text_color(3)
self.contents.draw_text(4,
0,
40,
263,
"攻击",
2)
self.contents.font.color
=
text_color(4)
self.contents.draw_text(4,
0,
40,
318,
"防御",
2)
self.contents.font.color
=
text_color(5)
self.contents.draw_text(4,
0,
40,
373,
"魔防",
2)
if
$game_switches[Playerdate_magicdef]
self.contents.font.color
=
text_color(6)
self.contents.draw_text(4,
0,
40,
439,
"经验",
2)
self.contents.font.color
=
text_color(7)
self.contents.draw_text(4,
0,
40,
494,
"金币",
2)
self.contents.font.color
=
text_color(6)
self.contents.draw_text(4,
0,
60,
576,
"黄钥匙",
2)
self.contents.font.color
=
text_color(4)
self.contents.draw_text(4,
0,
60,
640,
"蓝钥匙",
2)
self.contents.font.color
=
text_color(2)
self.contents.draw_text(4,
0,
60,
704,
"红钥匙",
2)
self.contents.font.color
=
text_color(3)
self.contents.draw_text(4,
0,
60,
768,
"绿钥匙",
2)
就是在每个代码前面加了self.contents.font.color
=
text_color(n)(n代表颜色代码)
就让每个字活灵活现了~~如果没改,将跟第XX层显示的颜色一样!
再继续说:下一段代码:
self.contents.font.color
=
text_color(3)
self.contents.draw_text(4,
0,
60,
770,
"中毒".to_s,
2)
if
$game_switches[13]
self.contents.font.color
=
text_color(5)
self.contents.draw_text(4,
0,
110,
770,
"衰弱".to_s,
2)
if
$game_switches[15]
self.contents.font.color
=
text_color(1)
self.contents.draw_text(4,
0,
60,
820,
"迟缓".to_s,
2)
if
$game_switches[12]
这就是中毒、衰弱、迟缓加到勇士身上后在左边显示的字了,如果不喜欢可以换哦!~~
6.脚本:■Window_EnemyDate
里面有得到怪物手册后可以显示怪物资料的东西了(镜子怪物在样板0729中没有,在0808样板中有了)
self.contents.font.color
=
text_color(0)
@pro="普
通"
case
skill.maxsp
when
0
self.contents.font.color
=
text_color(0)
@pro="普
通"
when
1
self.contents.font.color
=
text_color(3)
@pro="中
毒"
when
2
self.contents.font.color
=
text_color(5)
@pro="衰
弱"
when
4
self.contents.font.color
=
text_color(2)
作者:
藕色猫
2006-8-13
18:26
回复此发言
--------------------------------------------------------------------------------
3
【分析】魔塔样板脚本分析(绝对原创,申精)
@pro="吸
血"
@vampire=($game_actors[$game_variables[1]+1].hp*0.2).to_i
when
16
self.contents.font.color
=
text_color(11)
@pro="先
攻"
@first=1
when
32
self.contents.font.color
=
text_color(1)
@pro="迟
缓"
when
64
self.contents.font.color
=
text_color(12)
@pro="魔
攻"
@magicatk=@md
when
128
self.contents.font.color
=
text_color(6)
@pro=skill.eva.to_s+"连击"
@turnatk=skill.eva
when
256
self.contents.font.color
=
text_color(4)
@pro="领
域"
when
512
self.contents.font.color
=
text_color(9)
@pro="爆
击"
@edam=1.2
when
1024
self.contents.font.color
=
text_color(10)
@pro="隐
形"
when
2048
self.contents.font.color
=
text_color(8)
@pro="无
敌"
when
4096
self.contents.font.color
=
text_color(9)
@pro="削
血"
when
8192
self.contents.font.color
=
text_color(7)
@pro="镜
子"
if
skill.atk<$game_actors[$game_variables[1]+1].str
skill.atk=($game_actors[$game_variables[1]+1].str).to_i
end#只有怪物基础防御小于勇士攻击后才使它的防御等于勇士攻击-1
when
8
self.contents.font.color
=
text_color(4)
@pro="坚
固"
if
skill.pdef<$game_actors[$game_variables[1]+1].str
skill.pdef=($game_actors[$game_variables[1]+1].str+1).to_i
end#只有怪物基础防御小于勇士攻击后才使它的防御等于勇士攻击-1
end
普通、中毒、衰弱、吸血、先攻、迟缓、魔攻、连击、领域、暴击、隐形、无敌、削血、镜子、坚固。这些文字都可以改,比如在颠峰魔塔中就改了部分文字,领域改成怪异者……这些如果改了,在怪物属性中也会显示的到!
下一段代码:
self.contents.draw_text(120,
y,
a,
32,
"生命",
0)
self.contents.draw_text(230,
y,a,
32,
"攻击",0)
self.contents.draw_text(340,
y,
a,
32,
"防御",0)
self.contents.draw_text(230,
y+32,
a,
32,
"经验",
0)
self.contents.draw_text(120,
y+32,a,
32,
"金币",
0)
self.contents.draw_text(340,
y+32,
a,
32,
"损失",
0)
这上面千万不要以为是你的生命攻击防御,而是怪物的,如果改一下会很好哦!在样板0808中把金币改成了魔塔币,经验改成经验点,感觉不错!
7.脚本:▲Window_Gold
这段脚本本来我不想说,因为做魔塔样板的人都会把这个写到里面,如果改了,魔塔样板的作者不会高兴的!就是按ESC后的左下角的东西,样板0729中显示Ver0729
,这些如果不征求样板作者同意不要改,除非在魔塔中绘制了样板资料。
#--------------------------------------------------------------------------
#
●
刷新
#--------------------------------------------------------------------------
def
refresh
self.contents.clear
self.contents.font.color
=
system_color
self.contents.draw_text(0,
0,
130,
32,
"Ver0816",
1)
end
end
这段代码中“Ver0816”(0816是我最近要弄的样板)是可以改的,在颠峰魔塔中就改成颠峰魔塔,如果字多了会发现字体小了,不好看!
8.脚本:Window_PlayTime
里面显示的是游戏时间的脚本,脚本部分代码如下:
#--------------------------------------------------------------------------
#
●
刷新
#--------------------------------------------------------------------------
def
refresh
self.contents.clear
self.contents.font.color
=
system_color
self.contents.draw_text(4,
0,
120,
32,
"游戏时间")
游戏时间是可以改的,最好是4个字的,要不字会小,可以改成追忆时间,回忆时间等
9.脚本:Window_Steps
显示的是走过的步数,代码如下:
#--------------------------------------------------------------------------
#
●
刷新
#--------------------------------------------------------------------------
def
refresh
self.contents.clear
self.contents.font.color
=
system_color
self.contents.draw_text(4,
0,
120,
32,
"步数")
步数是可以改的,我就不多说了。
❻ Prg编程魔塔:多跳层设置会搞乱整个程序的进程吗
不会的,但要小心一点,我不容易啊,给我分把