Estou com um grande problema para adaptar esse sistema em meu ot alguém poderia me ajudar? estou usando o tfs 0.4
aqui esta o sistema!
em data/actions/scripts/gems.lua
Quote
function onUse(cid, item, fromPosition, itemEx, toPosition) gem = gems.id[getPlayerVocation(cid)] if item.itemid == gem then doUseGem(cid, item, getPlayerVocation(cid)) end return TRUE end
function doUseGem(cid, item) local voc = getPlayerVocation(cid) local interval = gems.interval[voc] if item.itemid ~= gems.id[voc] or getPlayerStorageValue(cid, gems.storage[voc]) > 0 then return FALSE end setPlayerStorageValue(cid, gems.storage[voc], 1) sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) doRemoveItem(item.uid, 1)
return TRUE end
function sendGemEffect(cid, storage, interval) local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local color = 1 if voc == 1 then color = gemMsg.colorDruid[math.random(1,#gemMsg.colorDruid)] elseif voc == 2 then color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorSorcerer)] elseif voc == 3 then color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorPaladin)] elseif voc == 4 then color = gemMsg.colorKnight[math.random(1,#gemMsg.colorKnight)] elseif voc == 5 then color = gemMsg.colorDruid[math.random(1,#gemMsg.colorElderDruid)] elseif voc == 6 then color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorMasterSorcerer)] elseif voc == 7 then color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorRoyalPaladin)] elseif voc == 8 then color = gemMsg.colorKnight[math.random(1,#gemMsg.colorEliteKnight)] end doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) >= 1 then addEvent(sendGemEffect, interval, cid, storage, interval) end end function doRemoveGemEffect(cid) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) < 1 then return FALSE end setPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)], 0) return TRUE end function doRemoveAllGemEffect(cid) for i = 1, table.maxn(gms.storage) do setPlayerStorageValue(cid, gems.storage, 0) end return TRUE end function isGemActivated(cid) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then return TRUE end return FALSE end
Pergunta
bernardes22 1
Boa noite Galera!
Estou com um grande problema para adaptar esse sistema em meu ot alguém poderia me ajudar? estou usando o tfs 0.4
aqui esta o sistema!
em data/actions/scripts/gems.lua
gem = gems.id[getPlayerVocation(cid)]
if item.itemid == gem then
doUseGem(cid, item, getPlayerVocation(cid))
end
return TRUE
end
data/actions/actions.xml
<action itemid="2155" script="gems.lua"/>
<action itemid="2158" script="gems.lua"/>
<action itemid="2153" script="gems.lua"/>
data/lib/Pivi.lua
local voc = getPlayerVocation(cid)
local interval = gems.interval[voc]
if item.itemid ~= gems.id[voc] or getPlayerStorageValue(cid, gems.storage[voc]) > 0 then
return FALSE
end
setPlayerStorageValue(cid, gems.storage[voc], 1)
sendGemEffect(cid, gems.storage[voc], gems.interval[voc])
doRemoveItem(item.uid, 1)
return TRUE
end
function sendGemEffect(cid, storage, interval)
local pos = getThingPos(cid)
local voc = getPlayerVocation(cid)
local color = 1
if voc == 1 then
color = gemMsg.colorDruid[math.random(1,#gemMsg.colorDruid)]
elseif voc == 2 then
color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorSorcerer)]
elseif voc == 3 then
color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorPaladin)]
elseif voc == 4 then
color = gemMsg.colorKnight[math.random(1,#gemMsg.colorKnight)]
elseif voc == 5 then
color = gemMsg.colorDruid[math.random(1,#gemMsg.colorElderDruid)]
elseif voc == 6 then
color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorMasterSorcerer)]
elseif voc == 7 then
color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorRoyalPaladin)]
elseif voc == 8 then
color = gemMsg.colorKnight[math.random(1,#gemMsg.colorEliteKnight)]
end
doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) >= 1 then
addEvent(sendGemEffect, interval, cid, storage, interval)
end
end
function doRemoveGemEffect(cid)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) < 1 then
return FALSE
end
setPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)], 0)
return TRUE
end
function doRemoveAllGemEffect(cid)
for i = 1, table.maxn(gms.storage) do
setPlayerStorageValue(cid, gems.storage, 0)
end
return TRUE
end
function isGemActivated(cid)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then
return TRUE
end
return FALSE
end
data/lib/Pivi_const.lua
id = {2156, 2155, 2158, 2153, 2156, 2155, 2158, 2156},
storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008},
interval = {600, 600, 600, 600, 600, 600, 600}, -- Intervalo dos efeitos
}
gemMsg = {
rnd = {"´ . ,", ". ´ ,", "` . ,", ", ´ ."},
colorDruid = {182,213},
colorSorcerer = {215,215},
colorPaladin = {89,89},
colorKnight = {210,210},
colorElderDruid = {182,213},
colorMasterSorcerer = {215,215},
colorRoyalPaladin = {89,89},
colorEliteKnight = {210,210}
}
data/item/items.xml
2156 - Gema de Sorcerer e Knight
2158 - Gema de Paladin
Link para o comentário
Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados