Ir para conteúdo

Líderes

Conteúdo Popular

Exibindo conteúdo com a maior reputação em 09/18/17 em todas áreas

  1. Refe

    creature:soltaMagia("name") PARA TFS 1.x

    Olá, hoje eu vim postar a função creature:soltaMagia("nomedamagia") Para o TFS 1.X. Bom, eu estou fazendo um Poketibia com base no TFS 1.3 e vou postar essa função para quem quiser seguir o mesmo. Segue um exemplo de uso: Em LUASCRIPT.CPP Abaixo de registerMethod("Player", "addExperience", LuaScriptInterface::luaPlayerAddExperience); Adicione: registerMethod("Creature", "soltaMagia", LuaScriptInterface::luaSoltaMagia); Logo abaixo da função: int LuaScriptInterface::luaCreatureGetEvents(lua_State* L) Adicione: int LuaScriptInterface::luaSoltaMagia(lua_State* L) { //creature:soltaMagia("name") const std::string& spellName = getString(L, 2); if(Creature* creature = getUserdata<Creature>(L, 1)) { InstantSpell* spell = g_spells->getInstantSpellByName(spellName); if(!spell) { lua_pushboolean(L, false); return 1; } Creature* target = creature->getAttackedCreature(); if(target) spell->castSpell(creature, target); else spell->castSpell(creature, creature); lua_pushboolean(L, true); } else { lua_pushboolean(L, false); } return 1; } Em luascript.h registre: static int luaSoltaMagia(lua_State* L); static int luaSoltaMagia(lua_State* L); Agora é só compilar a proveitar
    2 pontos
  2. Pelo que vi na função tem que retornar um Id doPlayerFollowCreature(cid,getCreatureTarget(cid))
    1 ponto
  3. function onUse(cid, item, frompos, item2, topos) level = getPlayerLevel(cid)-8 pid = getPlayerGUID(cid) magehealth = level*5 -- Quantidade de vida que o Sorcerer e Druid ganha a cada level(mude apenas os numeros) magemana = level*30 -- Quantidade de mana que o Sorcerer e Druid ganha a cada level(mude apenas os numeros) paladinhealth = level*10 -- Quantidade de vida que o Paladin ganha a cada level(mude apenas os numeros) paladinmana = level*15 -- Quantidade de mana que o Paladin ganha a cada level(mude apenas os numeros) knighthealth = level*15 -- Quantidade de vida que o Knight ganha a cada level(mude apenas os numeros) knightmana = level*5 -- Quantidade de mana que o Knight ganha a cada level(mude apenas os numeros) if item.uid == 37001 then doSendMagicEffect(topos, 14) doPlayerPopupFYI(cid, 'You changed your vocation to sorcerer.') doPlayerSetVocation(cid, 1) setCreatureMaxHealth(cid, magehealth) setCreatureMaxMana(cid, magemana) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `maglevel` = " .. 0 .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";") db.executeQuery("UPDATE `player_skills` SET ` value` = " .. 0 .. " WHERE `player_id` = " .. getPlayerGUID(cid) .. ";") end if item.uid == 37011 then doPlayerSetVocation(cid, 2) setCreatureMaxHealth(cid, magehealth) setCreatureMaxMana(cid, magemana) doSendMagicEffect(topos, 14) doPlayerPopupFYI(cid, 'You changed your vocation to druid.') doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `maglevel` = " .. 0 .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";") db.executeQuery("UPDATE `player_skills` SET ` value` = " .. 0 .. " WHERE `player_id` = " .. getPlayerGUID(cid) .. ";") end if item.uid == 37012 then doPlayerSetVocation(cid, 3) setCreatureMaxHealth(cid, paladinhealth) setCreatureMaxMana(cid, paladinmana) doSendMagicEffect(topos, 14) doPlayerPopupFYI(cid, 'You changed your vocation to paladin.') doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `maglevel` = " .. 0 .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";") db.executeQuery("UPDATE `player_skills` SET ` value` = " .. 0 .. " WHERE `player_id` = " .. getPlayerGUID(cid) .. ";") end if item.uid == 37013 then doPlayerSetVocation(cid, 4) setCreatureMaxHealth(cid, knighthealth) setCreatureMaxMana(cid, knightmana) doSendMagicEffect(topos, 14) doPlayerPopupFYI(cid, 'You changed your vocation to knight.') doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `maglevel` = " .. 0 .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";") db.executeQuery("UPDATE `player_skills` SET ` value` = " .. 0 .. " WHERE `player_id` = " .. getPlayerGUID(cid) .. ";") end end
    1 ponto
  4. local vocation_table = { [37001] = 1, [37011] = 2, [37012] = 3, [37013] = 4, } function onUse(cid, item, frompos, item2, topos) local voc = vocation_table[item.uid] if voc then if getPlayerVocation(cid) == voc then return doPlayerSendCancel(cid, "Você não pode trocar para a mesma vocação.") elseif getPlayerVocation(cid) == 0 then return doPlayerSendCancel(cid, "Você precisa ter uma vocação para ser outra.") elseif getCreatureCondition(cid, CONDITION_INFIGHT) then return doPlayerSendCancel(cid, "Você não pode trocar de vocação em combate.") end local pid = getPlayerGUID(cid) local level = math.max(1, getPlayerLevel(cid) - 8) local vocationInfo = getVocationInfo(voc) local hpLevel = vocationInfo.healthGain * level local manaLevel = vocationInfo.manaGain * level local baseInfo = getVocationInfo(0) local baseHp = baseInfo.healthGain * 8 local baseMana = baseInfo.manaGain * 8 doSendMagicEffect(topos, 14) setCreatureMaxHealth(cid, baseHp + hpLevel) setCreatureMaxMana(cid, baseMana + manaLevel) doPlayerSetVocation(cid, voc) doRemoveCreature(cid) local executeQuery = db.executeQuery or db.query executeQuery("UPDATE `player_skills` SET `value` = '10', count = '0' WHERE `player_id` = '".. pid .."';") executeQuery("UPDATE `players` SET `maglevel` = '0', `manaspent` = '0' WHERE `id` = '".. pid .."';") end return true end Eu refiz o seu script, não sei se vai ajudar no seu caso. O que imagino que possa ser é: você ter criado uma variável chamada db e ter dado conflito com a tabela de funções db, sei lá. E também, se possível, envia seu luascript.cpp pra eu dar uma olhada aí.
    1 ponto
Líderes está configurado para São Paulo/GMT-03:00
×
×
  • Criar Novo...