Créditos: newsoftzzz(pelo code) e SuperGillis(Pela Action recriando o Code)
O SuperGillis resolveu recriar o code do fogo dinâmico do newsoftzzz, porém, ao invés de fazer em C++ ele fez de um modo muito mais prático, em Lua.
Está é o Code Recriado pelo SuperGillis
Faça um arquivo chamado fire.lua e coloque-o em sua pasta Data.
Dentro do fire.lua deve conter o que está escrito abaixo.
dofile('data/wood.lua') fires = {} function addFire(pos, toItemId) local fire = getFire(pos) if fire ~= nil then transFormFire(fire, pos) else local uid = doCreateItem(1489, 1, pos) if uid > 0 then local info = nil if burningStuff[toItemId] == nil then info = burningStuff[1] else info = burningStuff[toItemId] end fires[posToStr(pos)] = {interval = info[1], event = 0, continue = 1, running = 0, data = info} fires[posToStr(pos)].event = addEvent(checkFire, info[1], {pos = pos}) end end return 1 end function posToStr(pos) return (pos.x..' '..pos.y..' '..pos.z) end function strToPos(str) local firstPoint = string.find(str, ' ') local secondPoint = string.find(str, ' ', firstPoint+1) local outputPos = {x=0, y=0, z=0} outputPos.x = tonumber(string.sub(str, 1, firstPoint-1)) outputPos.y = tonumber(string.sub(str, firstPoint+1, secondPoint-1)) outputPos.z = tonumber(string.sub(str, secondPoint+1)) return outputPos end function getFire(pos) local fire = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=2}) if fire ~= nil and isInArray({1487, 1488, 1489}, fire.itemid) == 1 then return fire end return nil end function transFormFire(fire, pos) local toId = math.min(math.max(fire.itemid-1, 1487), 1489) doTransformItem(fire.uid, toId) return toId end function checkFire(vars) if fires[posToStr(vars.pos)] == nil then return 0 end local fire = getFire(vars.pos) if fire == nil then return 0 end if math.random(0, 100) < fires[posToStr(vars.pos)].data[3] then local randX = math.random(-1, 1) local randY = math.random(-1, 1) if randX == 0 and randY == 0 then transFormFire(fire, vars.pos) else local coX = vars.pos.x+randX local coY = vars.pos.y+randY local coZ = vars.pos.z local wood = getThingfromPos({x=coX, y=coY, z=coZ, stackpos=1}) if wood == nil then return 0 end if burningStuff[wood.itemid] ~= nil then addFire({x=coX, y=coY, z=coZ, stackpos=2}, wood.itemid) end end end if fires[posToStr(vars.pos)].running > fires[posToStr(vars.pos)].data[2]*1000 then print('[checkFire] Stopping!') local wood = getThingfromPos({x=vars.pos.x, y=vars.pos.y, z=vars.pos.z, stackpos=1}) if wood ~= nil then fires[posToStr(vars.pos)].continue = 0 doRemoveItem(wood.uid) end doDecayItem(fire.uid) end if fires[posToStr(vars.pos)].continue == 0 then fires[posToStr(vars.pos)] = nil return 0 end if fire.itemid == 1487 then fires[posToStr(vars.pos)].running = fires[posToStr(vars.pos)].running+fires[posToStr(vars.pos)].data[1] --print('[checkFire] '..fires[posToStr(vars.pos)].running) end fires[posToStr(vars.pos)].event = addEvent(checkFire, fires[posToStr(vars.pos)].data[1], vars) return 1 end
Faça um arquivo chamado wood.lua e coloque-o em sua pasta Data.
Dentro do fire.lua deve conter o que está escrito abaixo.
--[[ info [id] = {check, burn, chance} id = the id of the item that you want to be burnt burn = after howmuch seconds (when the big flame started) must the item dissapear chance = how big is the chance that the fire jumps to another burning item? ]]-- burningStuff = { -- wet trees [2700] = {2000, 30, 80}, [2700] = {2000, 30, 80}, [2701] = {2000, 30, 80}, [2702] = {2000, 30, 80}, [2703] = {2000, 30, 80}, [2704] = {2000, 30, 80}, [2705] = {2000, 30, 80}, [2706] = {2000, 30, 80}, [2707] = {2000, 30, 80}, [2708] = {2000, 30, 80}, [2711] = {2000, 30, 80}, [2712] = {2000, 30, 80}, -- dry trees [2709] = {1500, 20, 85}, [2710] = {1500, 20, 85}, [2713] = {1500, 20, 85}, [2714] = {1500, 20, 85}, [2715] = {1500, 20, 85}, [2716] = {1500, 20, 85}, [2717] = {1500, 20, 85}, [2718] = {1500, 20, 85}, [2719] = {1500, 20, 85}, [2720] = {1500, 20, 85}, [2721] = {1500, 20, 85}, [2722] = {1500, 20, 85}, }
Depois adicione antes de tudo no global.lua o código a seguir.
dofile('data/fire.lua')
Você também poderá escolher vários itens para queimar as árvores adicionando-os a este código abaixo.
Depois de escolher os itens, ou deixar como realmente é só por o código abaixo no começo do fire.lua
function onUse(cid, item, frompos, item2, topos) if isInArray({1488, 1489}, item2.itemid) or burningStuff[item2.itemid] ~= nil then return addFire(topos, item2.itemid) end return 0 end
Caso tenha algum erro de tradução feito por minha pessoa, por favor, me comunique.
Não dou Suporte.
Espero que aproveitem a Action,
Sem mais.