- UID
- 635501
- 主题
- 0
- 阅读权限
- 30
- 帖子
- 456
- 精华
- 0
- 积分
- 228
- 金钱
- 2187
- 荣誉
- 0
- 人气
- 0
- 在线时间
- 470 小时
- 评议
- 0
- 帖子
- 456
- 精华
- 0
- 积分
- 228
- 金钱
- 2187
- 荣誉
- 0
- 人气
- 0
- 评议
- 0
|
昨晚学习了一下 l-pq 的 “战争/战火/warfare 调出车辆人员及位置的修改” (http://game.ali213.net/thread-2744771-1-1.html)
学会了如何调车辆及人员,很有乐趣,受益匪浅。但是调用多种单位时,要多次退出游戏,多次存档,还要把utils.lua文件改来改去,很是麻烦。
经过观察+试验,发现utils.lua文件的调出代码段是可以重复添加的。最近没有翻论坛帖子,如果我火星了,请莫见怪,呵呵。
具体方法如下:
这是原本utils.lua文件最后一段调出狙击手的完整代码段:
giveSniper = function()
game.selectEntity(game.spawnSquad("us_rangers_sniper_01", 10, 10, game.getLandHeight(10, 10), 0, "usa"))
console.log("CHEATS >> Spawned snipers")
end,
这是原本调用坦克的完整代码段:
giveAbrams = function(num)
local dist = 5
local x = 10 - dist
local y = 10 - dist
if ((num == nil) or (num < 1)) then
num = 1
end
for count = 1, num, 1 do
local xx = x + count * dist
local yy = y + count * dist
local zz = game.getLandHeight(xx, yy)
game.selectEntity(game.spawnTank("tank_abrams_muss", xx, yy, zz, 0, "usa"))
end
console.log("CHEATS >> Spawned ", num, " Abrams")
end,
可以把这两段代码复制,另起一行再粘贴上去,然后相应修改(具体如何修改看 l-pq 的帖子吧,很详细了),utils.lua文件代码如下(注意红字部分)(help 那部分代码暂且去掉,闹眼睛):
utils = {
vtune = function(frames, framestep, frames_to_wait, need_exit)
if (frames_to_wait ~= nil) then
console.waitFrames(frames_to_wait)
end
game.startVtuning(frames, framestep)
console.waitFrames(frames + 1)
if (need_exit) then
game.exit()
end
end,
}
cheats = {
giveAbrams = function(num)
local dist = 5
local x = 10 - dist
local y = 10 - dist
if ((num == nil) or (num < 1)) then
num = 1
end
for count = 1, num, 1 do
local xx = x + count * dist
local yy = y + count * dist
local zz = game.getLandHeight(xx, yy)
game.selectEntity(game.spawnTank("tank_abrams_muss", xx, yy, zz, 0, "usa"))
end
console.log("CHEATS >> Spawned ", num, " Abrams")
end,
---添加调火箭炮代码
giveHJP = function(num)
local dist = 5
local x = 10 - dist
local y = 10 - dist
if ((num == nil) or (num < 1)) then
num = 1
end
for count = 1, num, 1 do
local xx = x + count * dist
local yy = y + count * dist
local zz = game.getLandHeight(xx, yy)
game.selectEntity(game.spawnTank("tank_mlrs", xx, yy, zz, 0, "usa"))
end
console.log("CHEATS >> Spawned ", num, " Abrams")
end,
---添加调美军重型油罐车代码
giveYou = function(num)
local dist = 5
local x = 10 - dist
local y = 10 - dist
if ((num == nil) or (num < 1)) then
num = 1
end
for count = 1, num, 1 do
local xx = x + count * dist
local yy = y + count * dist
local zz = game.getLandHeight(xx, yy)
game.selectEntity(game.spawnCar("car_m978_tanker", xx, yy, zz, 0, "usa"))
end
console.log("CHEATS >> Spawned ", num, " Abrams")
end,
---添加调美军重型弹药补给车代码
giveYao = function(num)
local dist = 5
local x = 10 - dist
local y = 10 - dist
if ((num == nil) or (num < 1)) then
num = 1
end
for count = 1, num, 1 do
local xx = x + count * dist
local yy = y + count * dist
local zz = game.getLandHeight(xx, yy)
game.selectEntity(game.spawnCar("car_m978_truck", xx, yy, zz, 0, "usa"))
end
console.log("CHEATS >> Spawned ", num, " Abrams")
end,
showAll = function()
game.enableHideInvisible(false)
console.log("CHEATS >> Enemies are visible now")
end,
showAll = function()
game.enableHideInvisible(true)
console.log("CHEATS >> Enemies are invisible now")
end,
giveSniper = function()
game.selectEntity(game.spawnSquad("us_rangers_sniper_01", 10, 10, game.getLandHeight(10, 10), 0, "usa"))
console.log("CHEATS >> Spawned snipers")
end,
---添加调用德尔塔代码
giveD = function()
game.selectEntity(game.spawnSquad("us_delta_01", 10, 10, game.getLandHeight(10, 10), 0, "usa"))
console.log("CHEATS >> Spawned snipers")
end,
}
这样不必退出游戏,在控制台分别输入 cheats.giveSniper () / cheats.giveD () /cheats.giveAbrams () / cheats.giveHJP () / cheats.giveYou () /cheats.giveYao () 就可以分别调出狙击手、德尔塔、坦克、火箭炮、重型油罐车、重型弹药车。(D、HJP、You、Yao等字符只是一个输入秘技时调用所需要的代号而已,可以随便命名,只要别把各种单位在游戏里的名称搞错就行,比如X:\Warfare\basis\textures\ui\pictures\tech_pic目录下的那些)当然,如果还有其他你所喜欢的单位,可以往复添加代码段,不必 存档-退出-修改 就可以直接用有强大军队了,岂不快哉,哈哈哈。
ps:至于如何调用飞机我昨晚没来得及试验,方法请参照 l-pq 的帖子吧,但我想往复添加代码段的方式应该和车辆是一样的吧。
[ 本帖最后由 wuwuya 于 2009-7-16 10:51 编辑 ] |
-
总评分: 金钱 + 20
查看全部评分
|