第136页:装备回旋镖召唤猎物
展开一三六.装备回旋镖召唤猎物(打猎游戏)
用记事本打开游戏目录\data\scripts\prefabs\boomerang.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local function cancreatelight(staff, caster, target, pos)
local ground = GetWorld()
if ground and pos then
local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z)
return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND
end
return false
end
local function createlight(staff, target, pos)
local names = {"crow","robin","robin_winter","frog","mosquito","bee","killerbee","butterfly","rabbit","babybeefalo"}
local name = names[math.random(#names)]
local prey = SpawnPrefab(name)
prey.Transform:SetPosition(pos.x, pos.y, pos.z)
end
inst:AddComponent("spellcaster")
inst.components.spellcaster:SetSpellFn(createlight)
inst.components.spellcaster:SetSpellTestFn(cancreatelight)
inst.components.spellcaster.canuseonpoint = true
inst.components.spellcaster.canusefrominventory = false
即可在装备回旋镖后,在空地上点鼠标右键召唤猎物,包括鸟、昆虫、青蛙、兔子、小牛,尽情捕猎吧
更多相关内容请关注:饥荒专区
责任编辑:Shy夏夏