rohfagundes 78 Postado Fevereiro 27, 2013 Share Postado Fevereiro 27, 2013 é sobre um script de rest ja coloquei pra n conseguir ativar se estiver com battle porem n to conseguindo colocar pra se ele estiver com o rest ativo e pegar battle n da pra desativar queria algo assim se ele estiver com o rest ativa e pegar battle desativa sozinho o rest events = {} config = { sit = {hp = 5, mana = 5}, battle = true, storage = 21211 } function onUse(cid, item, fromPosition, item2, toPosition) if config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You can not rest in battle.") return false end setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) == -1 and 1 or -1) doCreatureSetNoMove(cid, getPlayerStorageValue(cid, config.storage) == 1 and true or false) if getPlayerStorageValue(cid, config.storage) == 1 then doPlayerSendCancel(cid, "You are resting.") doSendMagicEffect(getCreaturePosition(cid), 14) doTransformItem(item.uid, 11443) -- item q vai virar depois de usar doSitRelax(cid, config.sit) else doPlayerSendCancel(cid, "You stopped to rest.") doTransformItem(item.uid, 11442) -- item antes de usar stopEvent(events[getPlayerGUID(cid)]) end return true end function doSitRelax(cid, formula) if not isCreature(cid) then return LUA_ERROR end doCreatureAddHealth(cid, formula.hp) doCreatureAddMana(cid, formula.mana) doSendMagicEffect(getCreaturePosition(cid), 14) events[getPlayerGUID(cid)] = addEvent(doSitRelax, 5000, cid, formula) end Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/ Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 27, 2013 Share Postado Fevereiro 27, 2013 Poderia ser kikar o player? Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1477741 Compartilhar em outros sites More sharing options...
0 rohfagundes 78 Postado Fevereiro 27, 2013 Autor Share Postado Fevereiro 27, 2013 kikar n =/ só cancelar o effect =X Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1477764 Compartilhar em outros sites More sharing options...
0 Slicer 1070 Postado Fevereiro 27, 2013 Share Postado Fevereiro 27, 2013 tenta assim.. events = {} config = { sit = {hp = 5, mana = 5}, battle = true, storage = 21211 } function onUse(cid, item, fromPosition, item2, toPosition) if config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You can not rest in battle.") return false end setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) == -1 and 1 or -1) doCreatureSetNoMove(cid, getPlayerStorageValue(cid, config.storage) == 1 and true or false) if getPlayerStorageValue(cid, config.storage) == 1 then doPlayerSendCancel(cid, "You are resting.") doSendMagicEffect(getCreaturePosition(cid), 14) doTransformItem(item.uid, 11443) -- item q vai virar depois de usar doSitRelax(cid, config.sit) else doPlayerSendCancel(cid, "You stopped to rest.") doTransformItem(item.uid, 11442) -- item antes de usar stopEvent(events[getPlayerGUID(cid)]) end return true end function doSitRelax(cid, formula) if not isCreature(cid) then return LUA_ERROR end if getCreatureCondition(cid, CONDITION_INFIGHT) and events[getPlayerGUID(cid)] then stopEvent(events[getPlayerGUID(cid)]) events[getPlayerGUID(cid)] = nil end doCreatureAddHealth(cid, formula.hp) doCreatureAddMana(cid, formula.mana) doSendMagicEffect(getCreaturePosition(cid), 14) events[getPlayerGUID(cid)] = addEvent(doSitRelax, 5000, cid, formula) end Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1477793 Compartilhar em outros sites More sharing options...
0 rohfagundes 78 Postado Fevereiro 28, 2013 Autor Share Postado Fevereiro 28, 2013 n funciono e n deu nenhum erro =X Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1477850 Compartilhar em outros sites More sharing options...
0 Slicer 1070 Postado Fevereiro 28, 2013 Share Postado Fevereiro 28, 2013 (editado) if getCreatureCondition(cid, CONDITION_INFIGHT) and events[getPlayerGUID(cid)] then stopEvent(events[getPlayerGUID(cid)]) events[getPlayerGUID(cid)] = nil end troca para.. if getCreatureCondition(cid, CONDITION_INFIGHT) and events[getPlayerGUID(cid)] then stopEvent(events[getPlayerGUID(cid)]) events[getPlayerGUID(cid)] = nil return true end vo nem comenta o erro bobo ;x Editado Fevereiro 28, 2013 por Slicer Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1477869 Compartilhar em outros sites More sharing options...
0 rohfagundes 78 Postado Fevereiro 28, 2013 Autor Share Postado Fevereiro 28, 2013 bom quando ele entra em battle o efeito de cura para porem o item n volta a ser o q era e vc continua sem poder se mover Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1477879 Compartilhar em outros sites More sharing options...
0 Slicer 1070 Postado Fevereiro 28, 2013 Share Postado Fevereiro 28, 2013 (editado) nem tinha reparado nisso... tive q mudar os parametros e n garanto q o item va voltar ao q era ;x -mexer com uid eh uma droga...- events = {} config = { sit = {hp = 5, mana = 5}, battle = true, storage = 21211 } function onUse(cid, item, fromPosition, item2, toPosition) if config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You can not rest in battle.") return false end setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) == -1 and 1 or -1) doCreatureSetNoMove(cid, getPlayerStorageValue(cid, config.storage) == 1 and true or false) if getPlayerStorageValue(cid, config.storage) == 1 then doPlayerSendCancel(cid, "You are resting.") doSendMagicEffect(getCreaturePosition(cid), 14) doTransformItem(item.uid, 11443) -- item q vai virar depois de usar doSitRelax(cid, config.sit, item) else doPlayerSendCancel(cid, "You stopped to rest.") doTransformItem(item.uid, 11442) -- item antes de usar stopEvent(events[getPlayerGUID(cid)]) end return true end function doSitRelax(cid, formula, item) if not isCreature(cid) then return LUA_ERROR end if getCreatureCondition(cid, CONDITION_INFIGHT) and events[getPlayerGUID(cid)] then stopEvent(events[getPlayerGUID(cid)]) events[getPlayerGUID(cid)] = nil setPlayerStorageValue(cid, config.storage, -1) doCreatureSetNoMove(cid, false) doTransformItem(item.uid, 11442) return true end doCreatureAddHealth(cid, formula.hp) doCreatureAddMana(cid, formula.mana) doSendMagicEffect(getCreaturePosition(cid), 14) events[getPlayerGUID(cid)] = addEvent(doSitRelax, 5000, cid, formula, item) end -se o item n voltar ao id 11442 dai vo ter q complicar teu script kkk- Editado Fevereiro 28, 2013 por Slicer Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1477956 Compartilhar em outros sites More sharing options...
0 rohfagundes 78 Postado Fevereiro 28, 2013 Autor Share Postado Fevereiro 28, 2013 agora ta dando erro no serv ate fecha [Error - Action Interface]In a timer event called from: data/actions/scripts/rest.lua:onUse Description: (luaDoTransformItem) Item not found Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1478018 Compartilhar em outros sites More sharing options...
0 Slicer 1070 Postado Fevereiro 28, 2013 Share Postado Fevereiro 28, 2013 eh foi oq eu pensei... eu n sei se o item ae fica na bag ou nos slots do set... qlqr coisa se n funcionar avisa.. local function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end local function doSitRelax(cid, formula, itemID) if not isCreature(cid) then return LUA_ERROR end if getCreatureCondition(cid, CONDITION_INFIGHT) and events[getPlayerGUID(cid)] then stopEvent(events[getPlayerGUID(cid)]) events[getPlayerGUID(cid)] = nil setPlayerStorageValue(cid, config.storage, -1) doCreatureSetNoMove(cid, false) -- local itens = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemID) if #itens >= 1 then for _, item in ipairs(itens) do doTransformItem(item, 11442) end end return true end doCreatureAddHealth(cid, formula.hp) doCreatureAddMana(cid, formula.mana) doSendMagicEffect(getCreaturePosition(cid), 14) events[getPlayerGUID(cid)] = addEvent(doSitRelax, 5000, cid, formula, itemID) end events = {} config = { sit = {hp = 5, mana = 5}, battle = true, storage = 21211 } function onUse(cid, item, fromPosition, item2, toPosition) if config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You can not rest in battle.") return false end setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) == -1 and 1 or -1) doCreatureSetNoMove(cid, getPlayerStorageValue(cid, config.storage) == 1 and true or false) if getPlayerStorageValue(cid, config.storage) == 1 then doPlayerSendCancel(cid, "You are resting.") doSendMagicEffect(getCreaturePosition(cid), 14) doTransformItem(item.uid, 11443) -- item q vai virar depois de usar doSitRelax(cid, config.sit, 11443) else doPlayerSendCancel(cid, "You stopped to rest.") doTransformItem(item.uid, 11442) -- item antes de usar stopEvent(events[getPlayerGUID(cid)]) end return true end Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1478068 Compartilhar em outros sites More sharing options...
0 rohfagundes 78 Postado Fevereiro 28, 2013 Autor Share Postado Fevereiro 28, 2013 bom agora ta quase certo =) o unico problema é q o item n muda ele esta no slot ring só q ele slot ring é tipo uma bag essa bag tem 4 espaços o item esta no 3 Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1478080 Compartilhar em outros sites More sharing options...
0 Slicer 1070 Postado Fevereiro 28, 2013 Share Postado Fevereiro 28, 2013 ah blz, entao achu q agora vai.. local function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end local function doSitRelax(cid, formula, itemID) if not isCreature(cid) then return LUA_ERROR end if getCreatureCondition(cid, CONDITION_INFIGHT) and events[getPlayerGUID(cid)] then stopEvent(events[getPlayerGUID(cid)]) events[getPlayerGUID(cid)] = nil setPlayerStorageValue(cid, config.storage, -1) doCreatureSetNoMove(cid, false) -- local itens = getItemsInContainerById(getPlayerSlotItem(cid, CONST_SLOT_RING).uid, itemID) if #itens >= 1 then for _, item in ipairs(itens) do doTransformItem(item, 11442) end end return true end doCreatureAddHealth(cid, formula.hp) doCreatureAddMana(cid, formula.mana) doSendMagicEffect(getCreaturePosition(cid), 14) events[getPlayerGUID(cid)] = addEvent(doSitRelax, 5000, cid, formula, itemID) end events = {} config = { sit = {hp = 5, mana = 5}, battle = true, storage = 21211 } function onUse(cid, item, fromPosition, item2, toPosition) if config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You can not rest in battle.") return false end setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) == -1 and 1 or -1) doCreatureSetNoMove(cid, getPlayerStorageValue(cid, config.storage) == 1 and true or false) if getPlayerStorageValue(cid, config.storage) == 1 then doPlayerSendCancel(cid, "You are resting.") doSendMagicEffect(getCreaturePosition(cid), 14) doTransformItem(item.uid, 11443) -- item q vai virar depois de usar doSitRelax(cid, config.sit, 11443) else doPlayerSendCancel(cid, "You stopped to rest.") doTransformItem(item.uid, 11442) -- item antes de usar stopEvent(events[getPlayerGUID(cid)]) end return true end Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1478082 Compartilhar em outros sites More sharing options...
0 rohfagundes 78 Postado Fevereiro 28, 2013 Autor Share Postado Fevereiro 28, 2013 agora foi =D vlw + rep mto obg mesmo =) podem mover Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1478085 Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 28, 2013 Share Postado Fevereiro 28, 2013 Dúvida sanada, reported. Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1478097 Compartilhar em outros sites More sharing options...
0 Erimyth 73 Postado Fevereiro 28, 2013 Share Postado Fevereiro 28, 2013 Tópico movido para a seção de dúvidas e pedidos resolvidos. Link para o comentário https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/#findComment-1478169 Compartilhar em outros sites More sharing options...
Pergunta
rohfagundes 78
é sobre um script de rest
ja coloquei pra n conseguir ativar se estiver com battle
porem n to conseguindo colocar pra se ele estiver com o rest ativo
e pegar battle n da pra desativar
queria algo assim se ele estiver com o rest ativa
e pegar battle desativa sozinho o rest
events = {}
config = {
sit = {hp = 5, mana = 5},
battle = true,
storage = 21211
}
function onUse(cid, item, fromPosition, item2, toPosition)
if config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You can not rest in battle.")
return false
end
setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) == -1 and 1 or -1)
doCreatureSetNoMove(cid, getPlayerStorageValue(cid, config.storage) == 1 and true or false)
if getPlayerStorageValue(cid, config.storage) == 1 then
doPlayerSendCancel(cid, "You are resting.")
doSendMagicEffect(getCreaturePosition(cid), 14)
doTransformItem(item.uid, 11443) -- item q vai virar depois de usar
doSitRelax(cid, config.sit)
else
doPlayerSendCancel(cid, "You stopped to rest.")
doTransformItem(item.uid, 11442) -- item antes de usar
stopEvent(events[getPlayerGUID(cid)])
end
return true
end
function doSitRelax(cid, formula)
if not isCreature(cid) then return LUA_ERROR end
doCreatureAddHealth(cid, formula.hp)
doCreatureAddMana(cid, formula.mana)
doSendMagicEffect(getCreaturePosition(cid), 14)
events[getPlayerGUID(cid)] = addEvent(doSitRelax, 5000, cid, formula)
end
Link para o comentário
https://xtibia.com/forum/topic/208699-cancelar-effect-assim-q-pegar-battle/Compartilhar em outros sites
14 respostass a esta questão
Posts Recomendados