您好,欢迎来到气泡游戏网!

气泡游戏网
手机应用中心 热门攻略 轩辕传奇 气泡问问 疾风之刃 枪神纪 天堂2M 救世者之树 上古世纪 黑色沙漠MOBILE 未来战 冒险岛M(楓之谷 M) 传说对决 瓦尔海姆 鬼谷八荒 怪物猎人系列

当前位置:首页 > 资讯 > 游戏资讯 > 正文

《CS Online﹝绝对武力﹞》【攻略】想制作地图但不会写程序?没关系!您也能使用lua设备方块!

更新时间:2020-12-25 09:21:32   |   编辑:气泡游戏网

大家好 我是misk。

相信有很多接触studio的玩家都有看过这个方块,但却不知道这个方块的用途,

而这个方块是什么呢?就是函数调用Script方块(这边简称为蓝lua)。

这边先说明这颗方块的用处。

这个方块能在游戏中调用lua函数,举一个比较贴近生活的例子,今天您想跟一位朋友聊天,但是你们身处在不同地点,这时候就需要电话,而电话就是蓝lua,也就是负责连接你(游戏)跟朋友(lua)的桥梁。有的时候你需要使用蓝lua来达成一般设备方块做不到的事情,例如重置设备方块。

但我就是不会写程序阿,怎么办?没关系,本人写了一些比较实用的指令让大家使用,让大家也能在不会写程序的情况下,使用蓝lua达成重置设备方块,更改玩家金钱、血量等功能。


首先介绍一下蓝lua方块的接口。

按E打开蓝lua方块接口,应该会是这个样子。

(上面是指令名称,下方是要设置的参数。)

接下来,您需要复制以下代码到Game.lua中。

(如果不知道Game.lua的文件位置,请参考这篇。


function pos_transform(str)

    — x座标

    locate = string.find(str, “,”, 1)

    x = string.sub(str, 1, locate – 1)

    str = string.gsub(str, x .. “,”, “”, 1)

    x = math.floor(x)

    — y座标

    locate = string.find(str, “,”, 1)

    y = string.sub(str, 1, locate – 1)

    str = string.gsub(str, y .. “,”, “”, 1)

    y = math.floor(y)

    — z座标

    z = math.floor(str)

    return {x = x, y = y, z = z}

end

— 重置设备方块

function Reset(onoff, position)

    if onoff == false then

        return

    end

    EntityBlock = Game.EntityBlock:Create(pos_transform(position))

    EntityBlock:Event({action = “reset”})

end

— 发送玩家位置

function Convey(onoff, position)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    player.position = pos_transform(position)

end

— 增加玩家金币

function Add_coin(onoff, coin)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    

    player.coin = player.coin + math.floor(coin)

end

— 更改玩家金币

function Change_coin(onoff, coin)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    

    player.coin = math.floor(coin)

end

— 更改玩家最大血量

function Change_maxhealth(onoff, maxhealth)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    

    player.maxhealth = math.floor(maxhealth)

end

— 增加玩家最大血量

function Add_maxhealth(onoff, maxhealth)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    

    player.maxhealth = player.maxhealth + math.floor(maxhealth)

end

— 更改玩家血量

function Change_health(onoff, health)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    

    player.health = math.floor(health)

end

— 增加玩家血量

function Add_health(onoff, health)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    

    player.health = player.health + math.floor(health)

end

— 更改玩家最大护甲

function Change_maxarmor(onoff, maxarmor)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    

    player.maxarmor = math.floor(maxarmor)

end

— 增加玩家最大护甲

function Add_maxarmor(onoff, maxarmor)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    

    player.maxarmor = player.maxarmor + math.floor(maxarmor)

end

— 更改玩家护甲

function Change_armor(onoff, armor)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    

    player.armor = math.floor(armor)

end

— 更改玩家护甲

function Add_armor(onoff, armor)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    

    player.armor = player.armor + math.floor(armor)

end

— 杀死玩家

function Kill(onoff)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    player:Kill()

end

— 移除武器

function Remove_weapon(onoff)

    if onoff == false then

        return

    end

    if Game.GetTriggerEntity() ~= nil then

        player = Game.GetTriggerEntity():ToPlayer()

    else

        return

    end

    player:RemoveWeapon()

end

— 所有玩家复活

function Allplayer_spawn(onoff)

    if onoff == false then

        return

    end

    Game.Rule:Respawn()

end


而指令有那些呢?我写了一些自制指令列在下方。

Reset    

重置一个设备方块(参数为位置,详细在下方说明)。

Convey        

将玩家发送(参数为位置,详细在下方说明)。

Add_coin

增加玩家金币(参数为金币数量(整数))。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Change_coin

更改玩家金币(参数为金币数量(整数))。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Add_maxhealth

增加玩家最大血量(参数为血量(整数))。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Change_maxhealth

更改玩家最大血量(参数为血量(整数))。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Add_health         

增加玩家血量(参数为血量(整数))。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Change_health

更改玩家血量(参数为血量(整数))。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Add_maxarmor

增加玩家最大护甲(参数为护甲量(整数))。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Change_maxarmor

更改玩家最大护甲(参数为护甲量(整数))。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Add_armor

增加玩家护甲(参数为护甲量(整数))。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Change_armor

更改玩家护甲(参数为护甲量(整数))。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Kill   

杀死玩家(不须填入参数)。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Remove_weapon 

移除玩家武器(不须填入参数)。

注意:若使用该指令,设备方块与蓝lua之间不得有任何逻辑方块,例如and, or等。

Allplayer_spawn 

让所有玩家复活(不须填入参数)。

*位置参数

如果位置为(x = 0, y = 0, z = 0),参数就填0,0,0

同样的,如果位置为(x = -80, y = 100, z = 0),参数就填-80,100,0

下方图片为举例(重置一个位置为(x = -80, y = 100, z = 0)的设备方块):

*不允许中间接上逻辑方块的指令

有些指令不允许中间有逻辑方块,下方说明正确的连接方式。

正确(中间无连接逻辑方块)

错误(中间连接了逻辑方块)

也就是说,设备方块下一个连接点必须是蓝lua,另外标靶,怪物目标方块等设备也无法使用于这类指令,因为这些设备方块并未由玩家直接操作。


目前想到了这些指令,如果有新的想法会增加上去,另外如果有问题或是想法也可以提出来,谢谢大家观看,祝大家圣诞节快乐!

精彩推荐

Wonderful recommendation

更多

关于我们 | 商务合作 | 广告服务 | 法律声明 | 内容导航 | 游戏帮助 | 问题反溃

本站所有软件,来自于互联网或网友上传,版权属原著所有,如有需要请购买正版。如有侵权,敬请来信联系我们,我们立刻删除。

抵制不良游戏 拒绝盗版游戏 注意自我保护 谨防受骗上当 适度游戏益脑 沉迷游戏伤身 合理安排时间 享受健康生活

Copyright 2019-2025 by 鲁ICP备2024066534号-1 成都市互联网举报中心