Solutions
-
Gantz's post in (Resolvido)[Ajuda] Velocidade da bike was marked as the answerlocal condition = createConditionObject(CONDITION_HASTE) setConditionParam(condition, CONDITION_PARAM_TICKS, 20000) setConditionFormula(condition, 1.7, -36, 1.7, -36) function onSay(cid, words, param) doRemoveCondition(cid, CONDITION_HASTE) local pos = getThingPos(cid) if(param == '') then doSendMagicEffect(pos, 12) doAddCondition(cid, condition) return true end local t = string.explode(param, '"') if(t[2]) then doCreatureSay(cid, "Correr: ".. t[2], 20, false, 0, pos) doSendMagicEffect(pos, 12) doAddCondition(cid, condition) end return true end
-
Gantz's post in (Resolvido)[Duvida] Script de recompensa pro server was marked as the answerfunction onSay(cid, words, param, channel) local t = string.explode(param, ",") local gm = getCreatureName(cid) local ips = {} for _, pid in ipairs(getPlayersOnline()) do if not isInArray(ips, getPlayerIp(pid)) then local accId = getPlayerAccount(pid) if(getNotationsCount(accId) < 1) then doPlayerAddItem(pid, t[1], 1) doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "Everyone have been rewarded a "..getItemNameById(t[1]).." by "..gm.." for the reason: "..tostring(t[2])..".") doSendMagicEffect(getCreaturePosition(pid), CONST_ME_GIFT_WRAPS) table.insert(ips, getPlayerIp(pid)) end end end return true end
-
Gantz's post in (Resolvido)[DUVIDA] Como fazer spell que gasta % de vida ao invés de mana was marked as the answerlocal combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1) setCombatParam(combat, COMBAT_PARAM_EFFECT, 31) setCombatParam(combat, COMBAT_PARAM_USECHARGES, 1) function onGetPlayerMinMaxValues(cid, skill, attack, factor) local min = skill * attack / 17 + getPlayerLevel(cid) / 5 + 1 local max = skill * attack / 9 + getPlayerLevel(cid) / 5 + 6 return -min, -max end setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetPlayerMinMaxValues") function onCastSpell(cid, var) if getCreatureHealth(cid) > (0.3 * getCreatureMaxHealth(cid)) then doCombat(cid, combat, var) doCreatureAddHealth(cid, -(0.3 * getCreatureMaxHealth(cid))) else doPlayerSendCancel(cid, "Not enough health to perform this spell.") end return true end
-
Gantz's post in (Resolvido)Sistema de shiny no tibia normal was marked as the answerhttp://otland.net/threads/creatureevent-onspawn-cid.134039/
-
Gantz's post in (Resolvido)(PEDIDO DE SCRIPT) Item que fornece uma chance do personagem realizar um ataque duplo. was marked as the answertags no creaturescripts.xml:
<event type="combat" name="DoubleAttackRegister" event="script" value="doubleattack.lua"/> <event type="statschange" name="DoubleAttack" event="script" value="doubleattack.lua"/> crie um arquivo .lua na pasta creaturescripts/scripts com nome de doubleattack.lua e cole o código:
local config = { itemid = 2142, -- id do item slot = CONST_SLOT_HEAD, -- slot q precisa estar equipado chance = 10, -- chance de acontecer effect = 11, -- efeito ao acontecer message = "DOUBLE", -- e mensagem color = 120, -- cor da mensagem } function onCombat(cid, target) registerCreatureEvent(target, "DoubleAttack") return true end function onStatsChange(cid, attacker, type, combat, value) if type == STATSCHANGE_HEALTHLOSS and isPlayer(attacker) then if getPlayerSlotItem(attacker, config.slot) then if getPlayerSlotItem(attacker, config.slot).itemid == config.itemid then if math.random(100) <= config.chance then addEvent(doTargetCombatHealth, 100, attacker, cid, type, -value, -value, config.effect) addEvent(doSendAnimatedText, 100, getThingPos(cid), config.message, config.color) end end end end return true end depois abra o arquivo creaturescripts/scripts/login.lua e antes do return true adicione a seguinte linha:
registerCreatureEvent(cid, "DoubleAttackRegister") as configurações esta no inicio do código
-
Gantz's post in (Resolvido)[AJUDA] Configurar quantidade alavanca. was marked as the answercoloquei no script para você definir a quantidade, deixei tudo 1 item.
local coin = 2157 -- sua moeda vip local lever = { [6001] = {10,7424,1}, [6002] = {10,2138,1}, [6003] = {10,2165,1}, [6004] = {10,5949,1}, [6005] = {10,8903,1}, [6006] = {10,7902,1}, [6007] = {10,7897,1}, [6008] = {10,7896,1}, [6009] = {10,7892,1}, [6010] = {10,2410,1}, [6011] = {10,7857,1}, [6012] = {10,7887,1}, [6013] = {10,6300,1}, [6014] = {10,3940,1}, [6015] = {10,2518,1}, [6016] = {10,7903,1}, [6017] = {10,7884,1}, [6018] = {10,7885,1}, [6019] = {10,7886,1}, } local arrows = {5907,7432,7735,7959,10943} -- coloque o ID das arrows function onUse(cid,item,fromPosition,itemEx,toPosition) if doPlayerRemoveItem(cid,coin,lever[item.actionid][1]) == FALSE then return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "você precisa de "..lever[item.actionid][1].." " ..getItemNameById(coin)) end doPlayerAddItem(cid, lever[item.actionid][2], lever[item.actionid][3]) doPlayerSendTextMessage(cid,22,"você comprou um " .. getItemNameById(lever[item.actionid][2])) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) doTransformItem(item.uid, item.itemid == 9825 and 9826 or 9825) return true end caso um dia você for editar lembre de colocar a quantidade:
[6001] = {10,7424,1}, sendo o ultimo 1 a quantidade
-
Gantz's post in (Resolvido)[Pedido] Exiva Normal & Exiva Aguçado was marked as the answertesta ae amigo:
bool InstantSpell::SearchPlayer(const InstantSpell* spell, Creature* creature, const std::string& param) { Player* player = creature->getPlayer(); if(!player || player->isRemoved()) return false; Player* targetPlayer = NULL; ReturnValue ret = g_game.getPlayerByNameWildcard(param, targetPlayer); if(ret != RET_NOERROR || !targetPlayer || targetPlayer->isRemoved()) { player->sendCancelMessage(ret); g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF); return false; } if(targetPlayer->hasCustomFlag(PlayerCustomFlag_NotSearchable) && !player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges)) { player->sendCancelMessage(RET_PLAYERWITHTHISNAMEISNOTONLINE); g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF); return false; } std::stringstream ss; const Position& pos = player->getPosition(); const Position& targetPos = targetPlayer->getPosition(); uint32_t distance = std::max(std::abs(pos.x - targetPos.x), std::abs(pos.y - targetPos.y)); if(pos.z != targetPos.z) distance = distance + 9 + 6; ss << targetPlayer->getName() << " " << g_game.getSearchString(player->getPosition(), targetPlayer->getPosition(), true, true) << " [" << distance << " sqm]"; player->sendTextMessage(MSG_INFO_DESCR, ss.str().c_str()); g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_WRAPS_BLUE); return true; }