注册 | 登录

游侠NETSHOW论坛





查看: 8941|回复: 4
打印 上一主题 下一主题

关于战火(warfare)不必退出游戏就能调出多种单位 [复制链接]

帖子
456
精华
0
积分
228
金钱
2187
荣誉
0
人气
0
评议
0
跳转到指定楼层
楼主
发表于 2009-7-16 10:37:57 |只看该作者 |倒序浏览
昨晚学习了一下 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 编辑 ]
已有 1 人评分金钱 收起 理由
scc1003 + 20 文章不错,继续努力!

总评分: 金钱 + 20   查看全部评分

使用道具 举报

帖子
123
精华
0
积分
62
金钱
763
荣誉
0
人气
0
评议
0
沙发
发表于 2009-7-16 23:17:20 |只看该作者
沙发,难得啊,顶楼主个,战火这个游戏真是有太多东西可以DIY了

使用道具 举报

帖子
13
精华
0
积分
7
金钱
99
荣誉
0
人气
0
评议
0
板凳
发表于 2009-7-20 18:06:09 |只看该作者
或者直接修改reservers.lua,第一关就把自己喜欢的单位全部加好,以后就不用愁了:)

使用道具 举报

帖子
296
精华
0
积分
148
金钱
1826
荣誉
0
人气
4
评议
0
地板
发表于 2009-8-13 15:48:16 |只看该作者

多謝LS的貼子~不過有關WarFare的修改有几個疑問嚮大家請教~

l关于战火(warfare)不必退出游戏就能调出多种单位:http://game.ali213.net/thread-2801777-1-1.htm
1.1控制台分别输入 cheats.giveSniper () / cheats.giveD () /cheats.giveAbrams () / cheats.giveHJP () / cheats.giveYou () /cheats.giveYao ()  就可以分别调出狙击手、德尔塔、坦克、火箭炮、重型油罐车、重型弹药车()
改成,

是指"cheats.give"輸入一次給一類(一個)單位,

還是指“cheats.giveSniper () / cheats.giveD () /cheats.giveAbrams () / cheats.giveHJP () / cheats.giveYou () /cheats.giveYao ()”
*作為指令隻要鍵入一次過就可以調齊各軍种所填的的數量?*

1.2,車類全都改為console.log("CHEATS >> Spawned ", num, " Abrams")、

阻、Delta其它兵种也都全改成console.log("CHEATS >> Spawned Snipers")是否也具有以上的相同效果“*”

好像具体的如game.selectEntity(game.spawnSquad("us_rangers_sniper_01", 60, 550, game.getLandHeight(60, 550), 0, "usa"))
關鍵的的spawnSquad("us_rangers_sniper_01"沒有寫錯,這裡寫成什麼也不會有問題:help = function()
console.log("***************************************************************************************")
        console.log("     - cheats.giveX(num)")
        console.log("         Spawns Snipers squad at 60, 550")
        console.log("***************************************************************************************")

2.就首關阻、Delta、重油‘弹補、MRLS火箭炮、愛國者(M198、C75還沒試,也許一樣)調齣來之后與先頭部隊齣現的位置不同,是遊戲的BUD,還是能修改到相同方位,可以的話請教如何修改?

使用道具 举报

帖子
456
精华
0
积分
228
金钱
2187
荣誉
0
人气
0
评议
0
5#
发表于 2009-8-14 16:05:32 |只看该作者
回楼上:
1.1 要分别键入每种单位的,不能一次搞定多个单位,我是为了省事才连起来写的。一次一个或多个,如cheats.giveAbrams (5)  表示一次五个坦克。
1.2 console.log 一行似乎是注释什么的,对于修改没有影响。help = function()那段删除会不会对游戏有影响我也没试过,只是发帖时为了简洁,不过感觉删除应该也没问题。这游戏好久没玩了。
2  local x = 10 - dist
    local y = 10 - dist
这是修改出现位置的,改那两个数字就行,至于改多大合适,哪个横向哪个纵向,你自己一试便知。我改到过100,也还是离地图边缘比较近,但是位置的确是变化了。
至于步兵单位能不能改位置,你可以试试,把
       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)
加到giveSniper = function()下面,试一下(别忘把那两个数字改大点,以便能看出变化)

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

手机版|Archiver|游侠NETSHOW论坛 ( 苏ICP备2023007791号 )

GMT+8, 2025-8-17 09:10 , Processed in 0.367846 second(s), 13 queries , Gzip On, Memcache On.

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

分享到