
Solutions
-
Fabi Marzan's post in (Resolvido)Training Spell - Spell usada X vezes vira outra spell was marked as the answeralgo assim?
local config = { effects_per_level = { [1] = 25, -- efeito no [level 1] [2] = 177 -- efeito no [level 2] }, casts_to_up = 300, -- quantas vezes tem que soltar para alcançar o level 2 storages = {level = 46890, cast = 46891} -- só modifique se necessário } local function getPlayerRasenganLevel(cid) return getPlayerStorageValue(cid, config.storages.level) end local function getPlayerRasenganCasts(cid) return getPlayerStorageValue(cid, config.storages.cast) > 0 and getPlayerStorageValue(cid, config.storages.cast) or 0 end local function doPlayerRasenganUp(cid, round) return setPlayerStorageValue(cid, config.storages.cast, getPlayerRasenganCasts(cid) + round) end local combat = {} for i = 1, 2 do combat[i] = createCombatObject() setCombatParam(combat[i] , COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat[i] , COMBAT_PARAM_EFFECT, config.effects_per_level[i]) function onGetFormulaValues(cid, level, maglevel) min = -(level * 0.28 + maglevel * 1.48) * 1.0 * getPlayerRasenganLevel(cid) max = -(level * 0.34 + maglevel * 2.34) * 1.0 * getPlayerRasenganLevel(cid) return min, max end setCombatCallback(combat[i], CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") end function onCastSpell(cid, var) if getPlayerRasenganLevel(cid) == -1 then setPlayerStorageValue(cid, config.storages.level, 1) end if getPlayerRasenganLevel(cid) ~= 2 then doPlayerRasenganUp(cid, 1) local casts, str = getPlayerRasenganCasts(cid), '' if casts == 1 then str = "First time casting Rasengan! You need "..config.casts_to_up.." casts to advance to level 2 and improve its power!" elseif casts == (config.casts_to_up / 2) then str = "You reached 50% on Rasengan level 1. Now you need "..(config.casts_to_up/2).. " casts to advance to level 2." elseif casts == config.casts_to_up then str = "Congratulations! You advanced the Rasengan jutsu from level 1 to level 2." setPlayerStorageValue(cid, config.storages.level, 2) end if str ~= '' then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, str) end end return doCombat(cid, combat[getPlayerRasenganLevel(cid)], var) end
-
Fabi Marzan's post in (Resolvido)SPELL DE TRAP (SEM SER TRAVALYZE) was marked as the answeresse e primeiro
local remove_time = 8 -- tempo em segundos para remover as magic wall local item_id = 12870 -- id da magic wall function removeItem(posAll) for i=1, #posAll do for j=0, 255 do pos_stack = {x=posAll[i].x,y=posAll[i].y,z=posAll[i].z,stackpos=j} removeTile = getThingfromPos(pos_stack) if removeTile.itemid == item_id then doRemoveItem(removeTile.uid) end end end end function onCastSpell(cid, var) local waittime = 30 -- Tempo de exhaustion em segundos local storage = 5853 -- Storage de Spell, nunca usar a mesma em outra spell, a menos que não queira usar duas spell juntas! if exhaustion.check(cid, storage) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Espera "..exhaustion.get(cid, storage).." segundos para usar nuevamente.") return false end local pos = getThingPos(getCreatureTarget(cid)) posTile1 = {x=pos.x+1,y=pos.y+1,z=pos.z,stackpos=1} posTile2 = {x=pos.x+1,y=pos.y,z=pos.z,stackpos=1} posTile3 = {x=pos.x+1,y=pos.y-1,z=pos.z,stackpos=1} posTile4 = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=1} posTile5 = {x=pos.x-1,y=pos.y-1,z=pos.z,stackpos=1} posTile6 = {x=pos.x-1,y=pos.y,z=pos.z,stackpos=1} posTile7 = {x=pos.x-1,y=pos.y+1,z=pos.z,stackpos=1} posTile8 = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=1} posAll = {posTile1,posTile2,posTile3,posTile4,posTile5,posTile6,posTile7,posTile8} for i=1, #posAll do if isWalkable(posAll[i]) then doCreateItem(item_id, 1, posAll[i]) end end function dotonprision(cid) if isCreature(cid) and isCreature(getCreatureTarget(cid)) then local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z} doSendMagicEffect(position, 690) local position = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z} doSendMagicEffect(position, 690) end end local parameters = {cid = cid, var = var, combat1 = combat1 , combat2 = combat2} for i = 1, 2 do addEvent(function() if isCreature(cid) then addEvent(dotonprision,100,cid) end end, 1 + ((i-1) * 8000)) end for i = 1, 1 do addEvent(function() if isCreature(cid) then addEvent(removeItem, remove_time*1000, posAll) end end, 1 + ((i-1) * 8000)) end exhaustion.set(cid, storage, waittime) return true end
SEGUNDO
local config = { wallArea = { {1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 2, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1}, }, effect = 3, --Efeito. wallId = 2718, --ID da parede. time = 15, --Duração da parede. cooldown = {5, 5}, --{sucessCooldown, failCooldown}, chance = 100, --Chance da spell funcionar. storage = 9571, } function isWalkable(pos, creature, proj, pz)-- by Nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and pz then return false, true end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function getPosfromArea(cid, area) --by Dokmos icenter = math.floor(table.getn(area)/2)+1 jcenter = math.floor(table.getn(area[1])/2)+1 center = area[icenter] ivar = table.getn(area) jvar = table.getn(area[1]) i = table.getn(area)^2 j = table.getn(area[1])^2 local mydir = isCreature(getCreatureTarget(cid)) and getCreatureDirectionToTarget(cid, getCreatureTarget(cid)) or getCreatureLookDir(cid) setPlayerStorageValue(cid, 21101, -1) if center[jcenter] == 3 then if mydir == 0 then signal = {-1,1,1,2} elseif mydir == 1 then signal = {1,-1,2,1} elseif mydir == 2 then signal = {1,-1,1,2} elseif mydir == 3 then signal = {-1,1,2,1} end else signal = {-1,1,1,2} end POSITIONS = {} P = 0 repeat pvar = {0,0} I = area[ivar] J = I[jvar] i = i-1 j = j-1 if J == 1 then if jvar < jcenter then pvar[signal[3]] = signal[1]*math.abs((jcenter-jvar)) elseif jvar > jcenter then pvar[signal[3]] = signal[2]*math.abs((jcenter-jvar)) end if ivar < icenter then pvar[signal[4]] = signal[1]*math.abs((icenter-ivar)) elseif ivar > icenter then pvar[signal[4]] = signal[2]*math.abs((icenter-ivar)) end end if jvar > 1 then jvar = (jvar-1) elseif ivar > 1 then jvar = table.getn(area[1]) ivar = (ivar-1) end local pos = getThingPos(cid) local areapos = {x=pos.x+(pvar[1]),y=pos.y+(pvar[2]),z=pos.z} if pos.x ~= areapos.x or pos.y ~= areapos.y then P = P+1 POSITIONS[P] = areapos end until i <= 0 and j <= 0 return POSITIONS end function onCastSpell(cid) if getPlayerStorageValue(cid, config.storage) > os.time() then doPlayerSendCancel(cid, "Wait "..getPlayerStorageValue(cid, config.storage) - os.time().." second(s).") doCreatureSay(cid, "Voce precisa aguardar para usar novamente!!.", TALKTYPE_MONSTER) else if math.random(1, 100) > config.chance then doPlayerSendCancel(cid, "Your spell failed.") doSendAnimatedText(getThingPos(cid), "FAIL!", 215) setPlayerStorageValue(cid, config.storage, os.time() + config.cooldown[2]) else local positions = {} setPlayerStorageValue(cid, config.storage, os.time() + config.cooldown[1]) for _, pos in pairs(getPosfromArea(cid, config.wallArea)) do if isWalkable(pos) and not getTileInfo(pos).protection then doCreateItem(config.wallId, 1, pos) doSendMagicEffect(pos, config.effect) table.insert(positions, pos) end end if #positions > 0 then addEvent(function() for i = 1, #positions do local item = getTileItemById(positions[i], config.wallId).uid if item > 0 then doRemoveItem(item) end end end, config.time * 1000) end end end return true end
-
Fabi Marzan's post in (Resolvido)Script Buff was marked as the answer@Kevin Araujo
Ussa melhor esse:
--By:Fabi:-- local tempo = 300 -- tempo em segundos. local EffPerma = {130} -- effect no player, caso queira apenas 1, basta remover os outros numeros. local EffOnUse = 130 local ml = 15 -- quantos ira aumentar o skill de ML local skillfist = 10 -- quantos ira aumentar o skill de Fist local skillsword = 10 -- quantos ira aumentar o skill de Sword local skillshield = 10 -- quantos ira aumentar o skill de Shield local health = 250-- A cada 1 segundo quantos aumentar de vida 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, ml) setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield) setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit) setCombatCondition(combat, condition) local condition = createConditionObject(CONDITION_REGENERATION) setConditionParam(condition, CONDITION_PARAM_SUBID, 1) setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE) setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000) setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health) setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000) setCombatCondition(combat, condition) function Susanookakashi(tempo2,tempo3,cid) -- Altera aqui o nome da funçao pelo nome do personagem if (isCreature(cid)) then for i=1, #EffPerma do local position = {x=getPlayerPosition(cid).x+2, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z} doSendMagicEffect(position, EffPerma[i]) end end end function Susanoo(cid, text) if not isPlayer(cid) then return end doSendAnimatedText(getCreaturePosition(cid), "Ninj+10", 215) end function Susanoo2(cid, text) if not isPlayer(cid) then return end doSendAnimatedText(getCreaturePosition(cid), "Taij+10", 215) end function Susanoo3(cid, text) if not isPlayer(cid) then return end doSendAnimatedText(getCreaturePosition(cid), "Def+10", 215) end function onCastSpell(cid, var) if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then doCombat(cid, combat, var) tempo2 = 0 while (tempo2 ~= (tempo*1000)) do addEvent(Susanookakashi, tempo2, tempo2, tempo*1000, cid) -- Altere aqui pelo nome da função criada acima tempo2 = tempo2 + 300 end setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado. doCreatureSay(cid, "Susanoo!", TALKTYPE_ORANGE_1) addEvent(Susanoo, 100, cid, "Ninj") addEvent(Susanoo2, 600, cid, "Taij") addEvent(Susanoo3, 1200, cid, "Def") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Buff activado por "..tempo.." segundos!") local PosOnUse = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z} doSendMagicEffect(PosOnUse, EffOnUse) else doPlayerSendCancel(cid, "Sorry, you are transformed.") end end
-
Fabi Marzan's post in (Resolvido)spell com varios hits (attempt to index a boolean value) was marked as the answermano isso e pq ta usando addevent.
Tenta -->
local combat1 = createCombatObject() setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, 162) setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -1.0, -14500, -1.0, -16500) local function onCastSpell1(parameters) doCombat(parameters.cid, parameters.combat1, parameters.var) end function Daichiwari(cid) if isCreature(cid) and isCreature(getCreatureTarget(cid)) then local position = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z} doSendMagicEffect(position, 52) end end function onCastSpell(cid, var) local waittime = 1.0 -- Tempo de exhaustion local storage = 2 -- não mecha if exhaustion.check(cid, storage) then doPlayerSendCancel(cid, "Usted esta cansado.") doSendMagicEffect(getCreaturePosition(cid), 2) return false end local parameters = {cid = cid, var = var, combat1 = combat1} for i = 1, 3 do addEvent(function() if isCreature(cid) then addEvent(onCastSpell1, 300, parameters) addEvent(Daichiwari,100,cid) end end, 1 + ((i-1) * 300)) end exhaustion.set(cid, storage, waittime) return true end