200字
lua脚本:植物催熟道具
2025-11-22
2025-11-22

依旧改一下道具id,玩家使用道具触发效果。

local Script = {}
function Script:OnStart()
    self:AddTriggerEvent(TriggerEvent.PlayerUseItem, self.f)
-- 组件启动时调用
end
cropsid={241,234,236,231,240,234,1194,760,436,437,435,431,432,433,434,435,200394,200396,383}
flowerid={440,441,442,443,444}
function Script: f(e)
    if e.itemid~="r2_7529877397157806682_23337" then return end
    local playerObjId = e.eventobjid
    Actor:PlayHandAnim(playerObjId, 100105, 1, false)
    threadpool:wait(1)
    Actor:PlayHandAnim(playerObjId, 100105, 1, false)
    range=10
    local x1,y1,z1=Actor:GetPosition(e.eventobjid)
    for i=x1-range,x1+range do
        for j=y1-range,y1+range do
            for k=z1-range,z1+range do
                local id=Block:GetBlockID(i,j,k)
                for n=1,#cropsid do
                    if id==cropsid[n] then
                        Block:SetBlockAll(i,j,k,id,7)
                    elseif id==458 then
                        Block:SetBlockAll(i,j,k,459,7)
                    elseif id==1051 then
                        Block:SetBlockAll(i,j,k,1051,13)
                    elseif id==150007 then
                        Block:SetBlockAll(i,j,k,150009,0)
                    elseif id==150010 then
                        Block:SetBlockAll(i,j,k,150012,0)
                    elseif id==263 then
                        Block:SetBlockAll(i,j,k,id,2)
                    elseif id==380 then
                        Block:SetBlockAll(i,j,k,392,0)
                    elseif id==469 then
                        Block:SetBlockAll(i,j,k,469,7)
                    end
                end
                for m=1,#flowerid do
                    if id==flowerid[m] then
                        Block:SetBlockAll(i,j,k,id-131,0)
                    end
                end
            end
        end
    end
    for i=x1-range,x1+range do
        for j=y1-range-20,y1+range-10 do
            for k=z1-range,z1+range do
                local id=Block:GetBlockID(i,j,k)
                if id==229 then
                    Block:SetBlockAll(i,j,k,id,7)
                end
            end
        end
    end
end
return Script

lua脚本:植物催熟道具
作者
站长
发表于
2025-11-22

评论