Postado Fevereiro 22, 2021 4 anos Autor 9 minutos atrás, 139 disse: Testa, Ocultar conteúdo local tempo = 30 local effect = {80} local effect1 = {80} local outfit = {lookType = 3} local points = 20 local combat = createCombatObject() local health = 0.05 setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000) setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points) setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points) setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points) setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points) setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE) setCombatCondition(combat, condition) function doHealthSecond(cid, amount, delay) -- function by vodka if not isCreature(cid) then return LUA_ERROR end doCreatureAddHealth(cid, amount) if delay ~= 1 then addEvent(doHealthSecond, 1000, cid, amount, delay -1) end end local function Magica(tempo2,tempo3,cid) if isCreature(cid) then for i=1, #effect do local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} local position1 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} doSendMagicEffect(position, effect[i]) doSendMagicEffect(position1, effect1[i]) end end end local function Outfitzinha(cid) doRemoveCondition(cid, CONDITION_OUTFIT) end function onCastSpell(cid, var) registerCreatureEvent(cid, "stordeath") registerCreatureEvent(cid, "stordeath_off") setPlayerStorageValue(cid, voc_stor, getPlayerVocation(cid)) addEvent(doPlayerSetVocation,tempo,cid,getPlayerStorageValue(cid, voc_stor)) addEvent(setPlayerStorageValue,tempo,cid,voc_stor,0) doPlayerSetVocation(cid, 11) if exhaustion.check(cid, 102053) == FALSE then doCombat(cid, combat, var) tempo2 = 0 while (tempo2 ~= (tempo*1000)) do addEvent(Magica, tempo2, tempo2, tempo*1000, cid) addEvent(Outfitzinha, tempo*1000, cid) tempo2 = tempo2 + 1000 end local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} exhaustion.set(cid, 102053, tempo) doCreatureSay(cid, "KAIOKEEEEEEEN", TALKTYPE_MONSTER) doSendMagicEffect(position, 80) doHealthSecond(cid, -getCreatureMaxHealth(cid) * health, tempo) doSetCreatureOutfit(cid, outfit) else doPlayerSendCancel(cid, "Desculpe, voce ja esta Transformado.") end end Ta da mesma maneira, ele esta com a vocação Goku que é a voc 1, funcionas todas as funções menos a de trocar a vocation 3 minutos atrás, Nother disse: Ta da mesma maneira, ele esta com a vocação Goku que é a voc 1, funcionas todas as funções menos a de trocar a vocation Daquela vez que eu fiz o teste sem nada ele alterou para a vocation Gogeta mas claro, sem o cooldown e sem a sprite Será que esta dando conflito com a função de tempo? Até pq caso ele mude de vocation, quando o tempo acabar ele vai voltar para a vocation anterior? Editado Fevereiro 22, 2021 4 anos por Nother (veja o histórico de edições)
Postado Fevereiro 22, 2021 4 anos Agora que eu parei pra ler o script inteiro. Tava cheio de problemas, esse do tempo era um deles, a vocação de fato mudava pra 11, mas 0.030 segundos depois o char voltava pra voc original Essa variável tempo tava setada em 30, mas era pra ser 30 minutos, só que você não multiplicava esse 30 por 60 (segundos), pra dar 30 minutos em lugar nenhum. E a escala de tempo dos eventos é em milisegundos. Então o que for ser acionado em segundos você tem que multiplicar por 1000, como você vai ver varias vezes ao longo do código. Acho que refiz tudo que precisava, agora deve rodar. Spoiler local tempo = 30 * 60 local effect = {80} local effect1 = {80} local outfit = {lookType = 3} local points = 20 local health = 0.05 local new_voc = 11 -- id da voc local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, tempo * 1000) setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points) setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points) setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points) setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points) setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE) setCombatCondition(combat, condition) function doHealthSecond(cid, amount, delay) -- function by vodka if not isCreature(cid) then return LUA_ERROR end doCreatureAddHealth(cid, amount) if delay ~= 1 then addEvent(doHealthSecond, 1000, cid, amount, delay-1) end end local function doMagica(cid, times) if times > 0 and isCreature(cid) then for i=1, #effect do local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} local position1 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} doSendMagicEffect(position, effect[i]) doSendMagicEffect(position1, effect1[i]) end addEvent(doMagica, 1000, cid, times-1) end end local function doOutfitzinha(cid, times) if times > 0 and isCreature(cid) then doRemoveCondition(cid, CONDITION_OUTFIT) addEvent(doOutfitzinha, 1000, cid, times-1) end end function onCastSpell(cid, var) registerCreatureEvent(cid, "stordeath") registerCreatureEvent(cid, "stordeath_off") setPlayerStorageValue(cid, voc_stor, getPlayerVocation(cid)) addEvent(doPlayerSetVocation, tempo * 1000, cid, getPlayerStorageValue(cid, voc_stor)) addEvent(setPlayerStorageValue, tempo * 1000, cid, voc_stor, 0) doPlayerSetVocation(cid, new_voc) if exhaustion.check(cid, 102053) == FALSE then doCombat(cid, combat, var) doMagica(cid, tempo) doOutfitzinha(cid, tempo) local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} exhaustion.set(cid, 102053, tempo) doCreatureSay(cid, "KAIOKEEEEEEEN", TALKTYPE_MONSTER) doSendMagicEffect(position, 80) doHealthSecond(cid, -getCreatureMaxHealth(cid) * health, tempo) doSetCreatureOutfit(cid, outfit) else doPlayerSendCancel(cid, "Desculpe, voce ja esta Transformado.") end end
Postado Fevereiro 22, 2021 4 anos Autor 6 minutos atrás, 139 disse: Agora que eu parei pra ler o script inteiro. Tava cheio de problemas, esse do tempo era um deles, a vocação de fato mudava pra 11, mas 0.030 segundos depois o char voltava pra voc original Essa variável tempo tava setada em 30, mas era pra ser 30 minutos, só que você não multiplicava esse 30 por 60 (segundos), pra dar 30 minutos em lugar nenhum. E a escala de tempo dos eventos é em milisegundos. Então o que for ser acionado em segundos você tem que multiplicar por 1000, como você vai ver varias vezes ao longo do código. Acho que refiz tudo que precisava, agora deve rodar. Ocultar conteúdo local tempo = 30 * 60 local effect = {80} local effect1 = {80} local outfit = {lookType = 3} local points = 20 local health = 0.05 local new_voc = 11 -- id da voc local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, tempo * 1000) setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points) setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points) setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points) setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points) setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE) setCombatCondition(combat, condition) function doHealthSecond(cid, amount, delay) -- function by vodka if not isCreature(cid) then return LUA_ERROR end doCreatureAddHealth(cid, amount) if delay ~= 1 then addEvent(doHealthSecond, 1000, cid, amount, delay-1) end end local function doMagica(cid, times) if times > 0 and isCreature(cid) then for i=1, #effect do local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} local position1 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} doSendMagicEffect(position, effect[i]) doSendMagicEffect(position1, effect1[i]) end addEvent(doMagica, 1000, cid, times-1) end end local function doOutfitzinha(cid, times) if times > 0 and isCreature(cid) then doRemoveCondition(cid, CONDITION_OUTFIT) addEvent(doOutfitzinha, 1000, cid, times-1) end end function onCastSpell(cid, var) registerCreatureEvent(cid, "stordeath") registerCreatureEvent(cid, "stordeath_off") setPlayerStorageValue(cid, voc_stor, getPlayerVocation(cid)) addEvent(doPlayerSetVocation, tempo * 1000, cid, getPlayerStorageValue(cid, voc_stor)) addEvent(setPlayerStorageValue, tempo * 1000, cid, voc_stor, 0) doPlayerSetVocation(cid, new_voc) if exhaustion.check(cid, 102053) == FALSE then doCombat(cid, combat, var) doMagica(cid, tempo) doOutfitzinha(cid, tempo) local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} exhaustion.set(cid, 102053, tempo) doCreatureSay(cid, "KAIOKEEEEEEEN", TALKTYPE_MONSTER) doSendMagicEffect(position, 80) doHealthSecond(cid, -getCreatureMaxHealth(cid) * health, tempo) doSetCreatureOutfit(cid, outfit) else doPlayerSendCancel(cid, "Desculpe, voce ja esta Transformado.") end end Agora funcionou, so tive um problema que quando o char morre o buff acaba e se ele usar o buff denovo ele muda de vocation mas o buff não ativa novamente, tem como colocar um cooldown para so usar novamente o buff depois de 1 hora? que ai mesmo que acabe os 30 min ele não vai conseguir usar denovo
Postado Fevereiro 22, 2021 4 anos Spoiler local tempo = 30 * 60 local storage_time = 102053 local storage_voc = 102054 local msg = "Voce precisa aguardar %d segundos.", local effect = {80} local effect1 = {80} local outfit = {lookType = 3} local points = 20 local health = 0.05 local new_voc = 11 -- id da voc local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, tempo * 1000) setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points) setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points) setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points) setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points) setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE) setCombatCondition(combat, condition) function doHealthSecond(cid, amount, delay) -- function by vodka if not isCreature(cid) then return LUA_ERROR end doCreatureAddHealth(cid, amount) if delay ~= 1 then addEvent(doHealthSecond, 1000, cid, amount, delay-1) end end local function doMagica(cid, times) if times > 0 and isCreature(cid) then for i=1, #effect do local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} local position1 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} doSendMagicEffect(position, effect[i]) doSendMagicEffect(position1, effect1[i]) end addEvent(doMagica, 1000, cid, times-1) end end local function doOutfitzinha(cid, times) if times > 0 and isCreature(cid) then doRemoveCondition(cid, CONDITION_OUTFIT) addEvent(doOutfitzinha, 1000, cid, times-1) end end local function deTransform(cid) if isCreature(cid) then doPlayerSetVocation(cid, getPlayerStorageValue(cid, storage_voc)) end end function onCastSpell(cid, var) if tempo-(os.time()-getPlayerStorageValue(cid, storage_time)) > 0 then doPlayerSendCancel(cid, string.format(msg, tempo-(os.time()-getPlayerStorageValue(cid, storage_time)))) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return false end setPlayerStorageValue(cid, storage_time, os.time()) setPlayerStorageValue(cid, storage_voc, getPlayerVocation(cid)) registerCreatureEvent(cid, "stordeath") registerCreatureEvent(cid, "stordeath_off") addEvent(deTransform, tempo * 1000, cid) doPlayerSetVocation(cid, new_voc) doMagica(cid, tempo) doOutfitzinha(cid, tempo) local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} doCreatureSay(cid, "KAIOKEEEEEEEN", TALKTYPE_MONSTER) doSendMagicEffect(position, 80) doHealthSecond(cid, -getCreatureMaxHealth(cid) * health, tempo) doSetCreatureOutfit(cid, outfit) return doCombat(cid, combat, var) end Spoiler local tempo = 30 * 60 local storage_time = 102053 local storage_voc = 102054 function onLogout(cid) if tempo-(os.time()-getPlayerStorageValue(cid, storage_time)) > 0 then doPlayerSetVocation(cid, getPlayerStorageValue(cid, storage_voc)) end return true end function onDeath(cid, corpse, deathList) if tempo-(os.time()-getPlayerStorageValue(cid, storage_time)) > 0 then doPlayerSetVocation(cid, getPlayerStorageValue(cid, storage_voc)) end return true end Se deslogar, morrer, ou passar 30 min, perde a transformação. O cooldown é 30 min e continua contando mesmo se o player morrer.
Postado Fevereiro 22, 2021 4 anos Autor 9 minutos atrás, 139 disse: Ocultar conteúdo local tempo = 30 * 60 local storage_time = 102053 local storage_voc = 102054 local msg = "Voce precisa aguardar %d segundos.", local effect = {80} local effect1 = {80} local outfit = {lookType = 3} local points = 20 local health = 0.05 local new_voc = 11 -- id da voc local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, tempo * 1000) setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points) setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points) setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points) setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points) setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE) setCombatCondition(combat, condition) function doHealthSecond(cid, amount, delay) -- function by vodka if not isCreature(cid) then return LUA_ERROR end doCreatureAddHealth(cid, amount) if delay ~= 1 then addEvent(doHealthSecond, 1000, cid, amount, delay-1) end end local function doMagica(cid, times) if times > 0 and isCreature(cid) then for i=1, #effect do local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} local position1 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} doSendMagicEffect(position, effect[i]) doSendMagicEffect(position1, effect1[i]) end addEvent(doMagica, 1000, cid, times-1) end end local function doOutfitzinha(cid, times) if times > 0 and isCreature(cid) then doRemoveCondition(cid, CONDITION_OUTFIT) addEvent(doOutfitzinha, 1000, cid, times-1) end end local function deTransform(cid) if isCreature(cid) then doPlayerSetVocation(cid, getPlayerStorageValue(cid, storage_voc)) end end function onCastSpell(cid, var) if tempo-(os.time()-getPlayerStorageValue(cid, storage_time)) > 0 then doPlayerSendCancel(cid, string.format(msg, tempo-(os.time()-getPlayerStorageValue(cid, storage_time)))) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return false end setPlayerStorageValue(cid, storage_time, os.time()) setPlayerStorageValue(cid, storage_voc, getPlayerVocation(cid)) registerCreatureEvent(cid, "stordeath") registerCreatureEvent(cid, "stordeath_off") addEvent(deTransform, tempo * 1000, cid) doPlayerSetVocation(cid, new_voc) doMagica(cid, tempo) doOutfitzinha(cid, tempo) local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z} doCreatureSay(cid, "KAIOKEEEEEEEN", TALKTYPE_MONSTER) doSendMagicEffect(position, 80) doHealthSecond(cid, -getCreatureMaxHealth(cid) * health, tempo) doSetCreatureOutfit(cid, outfit) return doCombat(cid, combat, var) end Ocultar conteúdo local tempo = 30 * 60 local storage_time = 102053 local storage_voc = 102054 function onLogout(cid) if tempo-(os.time()-getPlayerStorageValue(cid, storage_time)) > 0 then doPlayerSetVocation(cid, getPlayerStorageValue(cid, storage_voc)) end return true end function onDeath(cid, corpse, deathList) if tempo-(os.time()-getPlayerStorageValue(cid, storage_time)) > 0 then doPlayerSetVocation(cid, getPlayerStorageValue(cid, storage_voc)) end return true end Se deslogar, morrer, ou passar 30 min, perde a transformação. O cooldown é 30 min e continua contando mesmo se o player morrer. [Error - LuaInterface::loadFile] data/spells/scripts/Goku/gogeta.lua:5: unexpected symbol near 'local' [23:12:50.060] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/Goku/gogeta.lua) [23:12:50.061] data/spells/scripts/Goku/gogeta.lua:5: unexpected symbol near 'local' dessa vez deu esse errinho na distro
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.