HenrikDiamond 17 Postado Março 17, 2014 Share Postado Março 17, 2014 Queria pedir um sistema de boost machine que seria assim: - Boost com stones do tipo do pokemon mesmo - Nao será feito o boost em 1 em 1 - Será direto. Exemplo: O player coloca 50 Water stones e um Blastoise, ai ele fica +15 por aí.. - No meu server, 1 Stone boosta o pokemon ate 50 '-'. E isso e chato =( - Em outros que ja vi, o player tem so vai boostando de 1 em 1. Assim: o player coloca 50 stones, da USE na Machine ai aumenta 1 boost e as outras continuam la!! - Queria uma que poupasse o tempo.. Espero que tenham me entendido '-'. Meu boost.lua: (irei pular as partes das stones de cada pokemon) function doRestoreBoostMachine(cid, b_pos, p_pos, s_pos, msg, msg2) doSendAnimatedText(b_pos, "DONE.", 215) if isCreature(cid) then doCreatureSetNoMove(cid, false) doPlayerSendTextMessage(cid, 27, msg) doPlayerSendTextMessage(cid, 27, msg2)end local ball_s = getTileItemById(p_pos, ballslot_run)doTransformItem(ball_s.uid, ballslot) local stne_s = getTileItemById(s_pos, stoneslot_run)doTransformItem(stne_s.uid, stoneslot) local butn_s = getTileItemById(b_pos, button_run)doTransformItem(butn_s.uid, button) end local stones_required = { -- custo base de stones para boostar[heart] = 1,[leaf] = 1,[water] = 1,[venom] = 1,[thunder] = 1,[rock] = 1,[punch] = 1,[fire] = 1,[coccon] = 1,[crystal] = 1,[dark] = 1,[earth] = 1,[enigma] = 1,[ice] = 1,[boostStone] = 1, --alterado v1.9} local stone_increase = { -- a cada quantos boosts irá aumentar o custo de stones[heart] = 3,[leaf] = 3,[water] = 3,[venom] = 4,[thunder] = 4,[rock] = 3,[punch] = 4,[fire] = 3,[coccon] = 2,[crystal] = 15,[dark] = 4,[earth] = 4,[enigma] = 4,[ice] = 4,[boostStone] = 10000, --alterado v1.9} local pbs = {[11826] = 11737, --normal acessa --alterado v1.9 \/[11828] = 11739, --normal morto[11832] = 11740, --great acessa[11834] = 11742, --great morto[11835] = 11743, --super acessa[11837] = 11745, --super morto[11829] = 11746, --ultra acessa[11831] = 11748, --ultra morto[10975] = 12621, --saffari acessa[10977] = 12623, --saffari morto} function onUse(cid, item, topos, item2, frompos) if isRunning(item.itemid) then doPlayerSendCancel(cid, "Wait until boosting finishes.")return trueend if item.itemid == button then local pbpos = topos pbpos.x = pbpos.x + 1 local ball_slot = getTileItemById(pbpos, ballslot) local myball = getContainerItem(ball_slot.uid, 0) if myball.uid <= 0 or getItemWeight(myball.uid) == 0 then doPlayerSendCancel(cid, "You need to put a pokeball in the ball slot.") return true end local pokemon = getItemAttribute(myball.uid, "poke") local boost = getItemAttribute(myball.uid, "boost") or 0 if boost >= 50 then doPlayerSendCancel(cid, "Your pokemon is already at maximum boost.") return true end local stnpos = pbpos stnpos.x = stnpos.x - 2 local stone_slot = getTileItemById(stnpos, stoneslot) local stone = getContainerItem(stone_slot.uid, 0) if stone.uid <= 0 then doPlayerSendCancel(cid, "You need to put a stone in the stone slot.") return true end if not isStone(stone.itemid) then doPlayerSendCancel(cid, "Please, put only stones in the stone slot.") return true end if not isInArray(boost_stones[pokemon], stone.itemid) then local cancelstr = "Sorry, you are not using the correct stone." if #boost_stones[pokemon] > 1 then local stonesused = "" cancelstr = cancelstr.." This pokemon needs " for su = 1, #boost_stones[pokemon] do local n = doCorrectString(getItemNameById(boost_stones[pokemon][su])) if su == #boost_stones[pokemon] then stonesused = stonesused.." or "..getArticle(n).." "..n.."" elseif su == 1 then stonesused = stonesused..""..getArticle(n).." "..n.."" else stonesused = stonesused..", "..n.."" end end cancelstr = cancelstr..""..stonesused.." to be boosted." else cancelstr = cancelstr.." This pokemon needs a "..doCorrectString(getItemNameById(boost_stones[pokemon][1])).." to be boosted." end doPlayerSendCancel(cid, cancelstr) return true end local removeStones = 0 local extraStones = math.floor(boost / stone_increase[stone.itemid]) local required_stones = stones_required[stone.itemid] + extraStones local boosts = 0 for a = 0, getContainerSize(stone_slot.uid) - 1 do local it = getContainerItem(stone_slot.uid, a) if it.uid > 0 then if not isStone(it.itemid) then doPlayerSendCancel(cid, "Please, put only stones in the stone slot.") return true end if it.itemid ~= stone.itemid then doPlayerSendCancel(cid, "Please, put only one type of stone in the stone slot.") return true end if required_stones > 0 then required_stones = required_stones - (it.type ~= 0 and it.type or 1) --alterado v1.7 if required_stones <= 0 then boosts = boosts + 50 removeStones = removeStones + stones_required[stone.itemid] + extraStones if boost + boosts <= 49 then extraStones = math.floor((boost + boosts) / stone_increase[stone.itemid]) required_stones = stones_required[stone.itemid] + extraStones end break end end end end if required_stones > 0 and boosts == 0 then doPlayerSendCancel(cid, "You need more stones to boost this pokemon.") return true end for b = 1, removeStones do local i = getContainerItem(stone_slot.uid, 0) if i.type ~= 0 then doChangeTypeItem(i.uid, i.type - 1) --alterado v1.7 else doRemoveItem(i.uid, 1) end end doSetItemAttribute(myball.uid, "boost", boost + boosts) doSetItemAttribute(myball.uid, "boosting", 1) --alterado v1.9.1 if (boost + boosts) >= 10 then if pbs[myball.itemid] then --alterado v1.9 doTransformItem(myball.uid, pbs[myball.itemid]) end end doItemEraseAttribute(myball.uid, "boosting") --alterado v1.9.1 local msg = "Your "..getPokeballName(myball.uid).." has been boosted!" local msg2 = "• Boost: "..(boost + boosts).." (+"..boosts..")" local downpos = getThingPos(cid) downpos.y = downpos.y + 1 local mypos = getThingPos(cid) doTeleportThing(cid, downpos, false) doTeleportThing(cid, mypos, false) doTransformItem(ball_slot.uid, ballslot_run) doTransformItem(stone_slot.uid, stoneslot_run) doTransformItem(item.uid, button_run) doCreatureSetNoMove(cid, true) doCreatureAddCondition(cid, boostcondition) addEvent(doRestoreBoostMachine, 3000, cid, getThingPos(item.uid), getThingPos(ball_slot.uid), getThingPos(stone_slot.uid), msg, msg2) return trueendend Espero que possam me ajudar '-' Ate mais Link para o comentário Compartilhar em outros sites More sharing options...
MauricioPC 11 Postado Março 27, 2014 Share Postado Março 27, 2014 tenta assim function doRestoreBoostMachine(cid, b_pos, p_pos, s_pos, msg, msg2) doSendAnimatedText(b_pos, "DONE.", 215) if isCreature(cid) then doCreatureSetNoMove(cid, false) doPlayerSendTextMessage(cid, 27, msg) doPlayerSendTextMessage(cid, 27, msg2) end local ball_s = getTileItemById(p_pos, ballslot_run) doTransformItem(ball_s.uid, ballslot) local stne_s = getTileItemById(s_pos, stoneslot_run) doTransformItem(stne_s.uid, stoneslot) local butn_s = getTileItemById(b_pos, button_run) doTransformItem(butn_s.uid, button) end local stones_required = { -- custo base de stones para boostar [heart] = 1, [leaf] = 1, [water] = 1, [venom] = 1, [thunder] = 1, [rock] = 1, [punch] = 1, [fire] = 1, [coccon] = 1, [crystal] = 1, [dark] = 1, [earth] = 1, [enigma] = 1, [ice] = 1, } local stone_increase = { -- a cada quantos boosts irá aumentar o custo de stones [heart] = 3, [leaf] = 3, [water] = 3, [venom] = 4, [thunder] = 4, [rock] = 3, [punch] = 4, [fire] = 3, [coccon] = 2, [crystal] = 15, [dark] = 4, [earth] = 4, [enigma] = 4, [ice] = 4, } function onUse(cid, item, topos, item2, frompos) if isRunning(item.itemid) then doPlayerSendCancel(cid, "Wait until boosting finishes.") return true end if item.itemid == button then local pbpos = topos pbpos.x = pbpos.x + 1 local ball_slot = getTileItemById(pbpos, ballslot) local myball = getContainerItem(ball_slot.uid, 0) if myball.uid <= 0 or getItemWeight(myball.uid) == 0 then doPlayerSendCancel(cid, "You need to put a pokeball in the ball slot.") return true end local pokemon = getItemAttribute(myball.uid, "poke") local boost = getItemAttribute(myball.uid, "boost") or 0 if boost >= 50 then doPlayerSendCancel(cid, "Your pokemon is already at maximum boost.") return true end local stnpos = pbpos stnpos.x = stnpos.x - 2 local stone_slot = getTileItemById(stnpos, stoneslot) local stone = getContainerItem(stone_slot.uid, 0) if stone.uid <= 0 then doPlayerSendCancel(cid, "You need to put a stone in the stone slot.") return true end if not isStone(stone.itemid) then doPlayerSendCancel(cid, "Please, put only stones in the stone slot.") return true end if not isInArray(boost_stones[pokemon], stone.itemid) then local cancelstr = "Sorry, you are not using the correct stone." if #boost_stones[pokemon] > 1 then local stonesused = "" cancelstr = cancelstr.." This pokemon needs " for su = 1, #boost_stones[pokemon] do local n = doCorrectString(getItemNameById(boost_stones[pokemon][su])) if su == #boost_stones[pokemon] then stonesused = stonesused.." or "..getArticle(n).." "..n.."" elseif su == 1 then stonesused = stonesused..""..getArticle(n).." "..n.."" else stonesused = stonesused..", "..n.."" end end cancelstr = cancelstr..""..stonesused.." to be boosted." else cancelstr = cancelstr.." This pokemon needs a "..doCorrectString(getItemNameById(boost_stones[pokemon][1])).." to be boosted." end doPlayerSendCancel(cid, cancelstr) return true end local removeStones = 0 local extraStones = math.floor(boost / stone_need[getItemAttribute(myball.uid, "poke")]) local required_stones = stones_required[stone.itemid] + extraStones local boosts = 0 local availableStones = 0 for a = 0, getContainerSize(stone_slot.uid) - 1 do local it = getContainerItem(stone_slot.uid, a) if it.uid > 0 then if not isStone(it.itemid) then doPlayerSendCancel(cid, "Please, put only stones in the stone slot.") return true end if it.itemid ~= stone.itemid then doPlayerSendCancel(cid, "Please, put only one type of stone in the stone slot.") return true end availableStones = availableStones + it.type end end for a = 1, availableStones do if required_stones > 0 then required_stones = required_stones - 1 if required_stones <= 0 then boosts = boosts + 1 removeStones = removeStones + stones_required[stone.itemid] + extraStones if boost + boosts <= 49 then extraStones = math.floor((boost + boosts) / stone_need[getItemAttribute(myball.uid, "poke")]) required_stones = stones_required[stone.itemid] + extraStones end end end end local qtdstne = stones_required[stone.itemid] + extraStones if required_stones > 0 and boosts == 0 then doPlayerSendCancel(cid, "You need "..qtdstne.." stones to boost this pokemon.") return true end for b = 1, removeStones do local i = getContainerItem(stone_slot.uid, 0) doChangeTypeItem(i.uid, i.type - 1) end doSetItemAttribute(myball.uid, "boost", boost + boosts) local msg = "Your "..getPokeballName(myball.uid).." has been boosted!" local msg2 = "• Boost: "..(boost + boosts).." (+"..boosts..")" local downpos = getThingPos(cid) downpos.y = downpos.y + 1 local mypos = getThingPos(cid) doTeleportThing(cid, downpos, false) doTeleportThing(cid, mypos, false) doTransformItem(ball_slot.uid, ballslot_run) doTransformItem(stone_slot.uid, stoneslot_run) doTransformItem(item.uid, button_run) doCreatureSetNoMove(cid, true) doCreatureAddCondition(cid, boostcondition) addEvent(doRestoreBoostMachine, 3000, cid, getThingPos(item.uid), getThingPos(ball_slot.uid), getThingPos(stone_slot.uid), msg, msg2) return true end end se não for tenta assim: function doRestoreBoostMachine(cid, b_pos, p_pos, s_pos, msg, msg2) doSendAnimatedText(b_pos, "DONE.", 215) if isCreature(cid) then doCreatureSetNoMove(cid, false) doPlayerSendTextMessage(cid, 27, msg) doPlayerSendTextMessage(cid, 27, msg2) end local ball_s = getTileItemById(p_pos, ballslot_run) doTransformItem(ball_s.uid, ballslot) local stne_s = getTileItemById(s_pos, stoneslot_run) doTransformItem(stne_s.uid, stoneslot) local butn_s = getTileItemById(b_pos, button_run) doTransformItem(butn_s.uid, button) end local stones_required = { -- custo base de stones para boostar [heart] = 1, [leaf] = 1, [water] = 1, [venom] = 1, [thunder] = 1, [rock] = 1, [punch] = 1, [fire] = 1, [coccon] = 1, [crystal] = 1, [dark] = 1, [earth] = 1, [enigma] = 1, [ice] = 1, } local stone_increase = { -- a cada quantos boosts irá aumentar o custo de stones [heart] = 3, [leaf] = 3, [water] = 3, [venom] = 4, [thunder] = 4, [rock] = 3, [punch] = 4, [fire] = 3, [coccon] = 2, [crystal] = 15, [dark] = 4, [earth] = 4, [enigma] = 4, [ice] = 4, } function onUse(cid, item, topos, item2, frompos) if isRunning(item.itemid) then doPlayerSendCancel(cid, "Wait until boosting finishes.") return true end if item.itemid == button then local pbpos = topos pbpos.x = pbpos.x + 1 local ball_slot = getTileItemById(pbpos, ballslot) local myball = getContainerItem(ball_slot.uid, 0) if myball.uid <= 0 or getItemWeight(myball.uid) == 0 then doPlayerSendCancel(cid, "You need to put a pokeball in the ball slot.") return true end local pokemon = getItemAttribute(myball.uid, "poke") local boost = getItemAttribute(myball.uid, "boost") or 0 if boost >= 50 then doPlayerSendCancel(cid, "Your pokemon is already at maximum boost.") return true end local stnpos = pbpos stnpos.x = stnpos.x - 2 local stone_slot = getTileItemById(stnpos, stoneslot) local stone = getContainerItem(stone_slot.uid, 0) if stone.uid <= 0 then doPlayerSendCancel(cid, "You need to put a stone in the stone slot.") return true end if not isStone(stone.itemid) then doPlayerSendCancel(cid, "Please, put only stones in the stone slot.") return true end if not isInArray(boost_stones[pokemon], stone.itemid) then local cancelstr = "Sorry, you are not using the correct stone." if #boost_stones[pokemon] > 1 then local stonesused = "" cancelstr = cancelstr.." This pokemon needs " for su = 1, #boost_stones[pokemon] do local n = doCorrectString(getItemNameById(boost_stones[pokemon][su])) if su == #boost_stones[pokemon] then stonesused = stonesused.." or "..getArticle(n).." "..n.."" elseif su == 1 then stonesused = stonesused..""..getArticle(n).." "..n.."" else stonesused = stonesused..", "..n.."" end end cancelstr = cancelstr..""..stonesused.." to be boosted." else cancelstr = cancelstr.." This pokemon needs a "..doCorrectString(getItemNameById(boost_stones[pokemon][1])).." to be boosted." end doPlayerSendCancel(cid, cancelstr) return true end local removeStones = 0 local extraStones = math.floor(boost / stone_increase[stone.itemid]) local required_stones = stones_required[stone.itemid] + extraStones local boosts = 0 local availableStones = 0 for a = 0, getContainerSize(stone_slot.uid) - 1 do local it = getContainerItem(stone_slot.uid, a) if it.uid > 0 then if not isStone(it.itemid) then doPlayerSendCancel(cid, "Please, put only stones in the stone slot.") return true end if it.itemid ~= stone.itemid then doPlayerSendCancel(cid, "Please, put only one type of stone in the stone slot.") return true end availableStones = availableStones + it.type end end for a = 1, availableStones do if required_stones > 0 then required_stones = required_stones - 1 if required_stones <= 0 then boosts = boosts + 1 removeStones = removeStones + stones_required[stone.itemid] + extraStones if boost + boosts <= 49 then extraStones = math.floor((boost + boosts) / stone_increase[stone.itemid]) required_stones = stones_required[stone.itemid] + extraStones end end end end if required_stones > 0 and boosts == 0 then doPlayerSendCancel(cid, "You need more stones to boost this pokemon.") return true end for b = 1, removeStones do local i = getContainerItem(stone_slot.uid, 0) doChangeTypeItem(i.uid, i.type - 1) end doSetItemAttribute(myball.uid, "boost", boost + boosts) local msg = "Your "..getPokeballName(myball.uid).." has been boosted!" local msg2 = "• Boost: "..(boost + boosts).." (+"..boosts..")" local downpos = getThingPos(cid) downpos.y = downpos.y + 1 local mypos = getThingPos(cid) doTeleportThing(cid, downpos, false) doTeleportThing(cid, mypos, false) doTransformItem(ball_slot.uid, ballslot_run) doTransformItem(stone_slot.uid, stoneslot_run) doTransformItem(item.uid, button_run) doCreatureSetNoMove(cid, true) doCreatureAddCondition(cid, boostcondition) addEvent(doRestoreBoostMachine, 3000, cid, getThingPos(item.uid), getThingPos(ball_slot.uid), getThingPos(stone_slot.uid), msg, msg2) return true end end Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados