Jump to content

Search the Community

Showing results for tags 'advanced vocation changer'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • xTibia - Notícias e Suporte
    • Regras
    • Noticias
    • Soluções
    • Projetos Patrocinados
    • Tutoriais para Iniciantes
    • Imprensa
  • OTServ
    • Notícias e Debates
    • OTServlist
    • Downloads
    • Recursos
    • Suporte
    • Pedidos
    • Show-Off
    • Tutoriais
  • OFF-Topic
    • Barzinho do Éks
    • Design
    • Informática

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Sou

Found 1 result

  1. Nome: Advanced Vocation Changer Autor: JoseJunior23 Server: TFS 3.6 Como functiona? Você é Knight e quer ser Sorcerer, basta você digitar /acv 1 e sua vocação será mudada para sorcerer. OBS: O melhor de tudo é você não irá perder seus SKILLS/ML, pois eles serão guardados, cada vocação fica com seus ml/skills guardados em diferentes storages. enquanto ao HP/MANA será igual ao seu vocations.xml porem fiz a minha maneira, oque quer dizer que você irá ter que configurar essa parte. Comandos /acv 1 = sorcerer /acv 2 = druid /acv 3 = paladin /acv 4 = knight Instalação 1º na pasta server/mods cria um arquivo XML chamado Advanced Change Vocation e coloque isso dentro: <?xml version="1.0" encoding="UTF-8"?> <mod name="ADVANCED CHANGE VOCATION" version="1.0" author="josejunior23" contact="[email protected]<script cf-hash='f9e31' type="text/javascript"> /* */</script>" enabled="yes"> <talkaction words="/acv" case-sensitive="yes" event="script" value="ACV.lua"/> <event type="logout" name="acv_logout" event="script" value="ACV_logout.lua"/> <event type="login" name="acv_login" event="script" value="ACV_login.lua"/> <event type="death" name="acv_death" event="script" value="ACV_death.lua"/> </mod> 2º na pasta server/mods/scripts cria um arquivo LUA chamado ACV e coloque isso dentro: -- Advanced Vocation Changer! -- scripted by josejunior23 function onSay(cid, words, param, channel) if(acv_exhaustion.enable == true) and (isExhausted(cid)) then doPlayerSendTextMessage(cid, acv_msg_color, "You can't change your vocation now! You still need to wait: " .. fixTimer(getPlayerStorageValue(cid, acv_exhaustion.storage))) return true end if not (param) or not (isNumber(param)) or (tonumber(param) > 4) or (tonumber(param) < 1) then doPlayerSendTextMessage(cid, acv_msg_color, "You can change your vocation up to 1 till 4 vocations (/acv VOCATIONID)!\n 1 = sorcerer, 2 = druid, 3 = paladin and 4 = knight.") return true end if(tonumber(param) == getVocationCfg(getPlayerVocation(cid))) then doPlayerSendTextMessage(cid, acv_msg_color, "You are already " .. getArticle(getPlayerVocationName(cid)) .. " " .. getPlayerVocationName(cid) .. ".") return true end if(getCreatureCondition(cid, CONDITION_INFIGHT)) then doPlayerSendTextMessage(cid, acv_msg_color, "You may not change your vocation while in battle.") return true end local newvoc = acv_config[tonumber(param)] if(newvoc) then savePlayerVocation(cid) local vocID = getPlayerVocation(cid) local vocStorage = getVocationStorage(vocID) if(acv_fun_cfg.text.doCreatureSay == true) then doCreatureSay(cid, acv_fun_cfg.text.text, acv_fun_cfg.text.talkType) end if(acv_fun_cfg.effect.doSendMagicEffect == true) then doSendMagicEffect(getCreaturePosition(cid), acv_fun_cfg.effect.effect) end if(acv_exhaustion.enable == true) then addExhausted(cid, acv_exhaustion.time) end changePlayerVocation(cid, tonumber(param)) end return true end 3º na pasta server/mods/scripts cria um arquivo LUA chamado acv_login e coloque isso dentro: -- Advanced Vocation Changer! -- scripted by josejunior23 function onLogin(cid) if(getPlayerPromotionLevel(cid) == 1) and (getPlayerVocation(cid) <= 4) then doPlayerSetVocation(cid, getPlayerVocation(cid) + 4) end if(acv_enable_msg_on_login == true) then doPlayerSendTextMessage(cid, acv_msg_color, "Your vocation is: " .. getPlayerVocationName(cid) .. ".") end local events = {"acv_logout", "acv_death"} for i = 1, #events do registerCreatureEvent(cid, events[i]) end return true end 4º na pasta server/mods/scripts cria um arquivo LUA chamado acv_logout e coloque isso dentro: -- Advanced Vocation Changer! -- scripted by josejunior23 function onLogout(cid) savePlayerVocation(cid) return true end 5º na pasta server/mods/scripts cria um arquivo LUA chamado acv_death e coloque isso dentro: -- Advanced Vocation Changer! -- scripted by josejunior23 function onDeath(cid, corpse, deathList) savePlayerVocation(cid) return true end 6º na pasta server/data/lib cria um arquivo LUA chamado ACV_lib e coloque isso dentro: LEMBRE-SE DE CONFIGURAR O CODIGO ESSA PARTE! -- Advanced Vocation Changer! -- scripted by josejunior23 acv_enable_msg_on_login = true; acv_msg_color = MESSAGE_STATUS_CONSOLE_ORANGE; -- message colour send in default channel acv_exhaustion = {enable = true, storage = "acv_exh", time = 5}; -- time in seconds 60 x 60 = 3600 = 1 hour acv_first_storage = "firstvoc"; -- saves players first vocation acv_fun_cfg = { text = {doCreatureSay = true, text = "#CHANGING VOCATION#", talkType = TALKTYPE_ORANGE_1}, effect = {doSendMagicEffect = true, effect = 10} -- effect 10 = teleport } acv_config = { -- make sure none of those storages are already in use! [1] = 73974, -- sorcerer UNIQUE STORAGE!!! [2] = 73983, -- druid UNIQUE STORAGE!!! [3] = 73992, -- paladin UNIQUE STORAGE!!! [4] = 73991 -- knight UNIQUE STORAGE!!! } getFormula = function(cid) -- how to config -> change the numbers below to the same as vocations.xml (gainhp, gainmana) return { health = { -- Sorcerer [1] = 5, -- sorcerer gains X HEALTH each level (gainhp) [5] = 5, -- master sorcerer gains X HEALTH each level (gainhp) -- Druid [2] = 5, -- druid gains X HEALTH each level (gainhp) [6] = 5, -- elder druid gains X HEALTH each level (gainhp) -- Paladin [3] = 10, -- paladin gains X HEALTH each level (gainhp) [7] = 10, -- royal paladin gains X HEALTH each level (gainhp) -- Knight [4] = 22, -- knight gains X HEALTH each level (gainhp) [8] = 22 -- elite knight gains X HEALTH each level (gainhp) }, mana = { -- Sorcerer [1] = 30, -- sorcerer gains X MANA each level (gainmana) [5] = 30, -- master sorcerer gains X MANA each level (gainmana) -- Druid [2] = 30, -- druid gains X MANA each level (gainmana) [6] = 30, -- elder druid gains X MANA each level (gainmana) -- Paladin [3] = 15, -- paladin gains X MANA each level (gainmana) [7] = 15, -- royal paladin gains X MANA each level (gainmana) -- Knight [4] = 5, -- knight gains X MANA each level (gainmana) [8] = 5 -- elite knight gains X MANA each level (gainmana) } } end function fixTimer(v) local seconds, minutes, hours = v - os.time(), 0, 0 while seconds >= 60 do minutes = minutes + 1 seconds = seconds - 60 end while minutes >= 60 do hours = hours + 1 minutes = minutes - 60 end local str1, str2, str3 = hours > 1 and hours .. " hours, " or "" .. "", minutes > 1 and minutes .. " minutes and " or "" .. "", seconds .. " seconds." or "" .. "" return str1 .. str2 .. str3 end function isExhausted(cid) return getPlayerStorageValue(cid, acv_exhaustion.storage) > os.time() and true or false end function addExhausted(cid, time) -- time in seconds return setPlayerStorageValue(cid, acv_exhaustion.storage, os.time() +time) end function setStorageString(cid, storage, string) return setPlayerStorageValue(cid, storage, "S" .. string) end function getStorageString(cid, storage) return string.sub(getPlayerStorageValue(cid, storage), 2) end function getVocationStorage(id) return acv_config[getVocationCfg(id)] end function getPlayerFirstVocation(cid) return getPlayerStorageValue(cid, acv_first_storage) end function getVocationCfg(id) if(id > 4) then id = id - 4 end return id end function savePlayerVocation(cid) local maglevel, fist, club, sword, axe, dist, shield, fish = getPlayerMagLevel(cid), getPlayerSkillLevel(cid, 0), getPlayerSkillLevel(cid, 1), getPlayerSkillLevel(cid, 2), getPlayerSkillLevel(cid, 3), getPlayerSkillLevel(cid, 4), getPlayerSkillLevel(cid, 5), getPlayerSkillLevel(cid, 6) local vocID = getPlayerVocation(cid) local vocStorage = getVocationStorage(vocID) if(getPlayerPromotionLevel(cid) == 1) and (getPlayerVocation(cid) <= 4) then vocID = getPlayerVocation(cid) + 4 doPlayerSetVocation(cid, vocID) end return setStorageString(cid, vocStorage, maglevel .. "-" .. fist .. "-" .. club .. "-" .. sword .. "-" .. axe .. "-" .. dist .. "-" .. shield .. "-" .. fish .. "-" .. vocID) end function setupPlayerVocation(cid, arg) local pid = getPlayerGUID(cid) doRemoveCreature(cid, true) db.executeQuery("UPDATE `players` SET `maglevel` = " .. arg.maglevel .. " WHERE `id` = ".. pid .. ";") db.executeQuery("UPDATE `player_skills` SET `value` = " .. arg.fist .. " WHERE `player_id` = ".. pid .. " and `skillid` = ".. 0 ..";") db.executeQuery("UPDATE `player_skills` SET `value` = " .. arg.club .. " WHERE `player_id` = ".. pid .. " and `skillid` = ".. 1 ..";") db.executeQuery("UPDATE `player_skills` SET `value` = " .. arg.sword .. " WHERE `player_id` = ".. pid .. " and `skillid` = ".. 2 ..";") db.executeQuery("UPDATE `player_skills` SET `value` = " .. arg.axe .. " WHERE `player_id` = ".. pid .. " and `skillid` = ".. 3 ..";") db.executeQuery("UPDATE `player_skills` SET `value` = " .. arg.dist .. " WHERE `player_id` = ".. pid .. " and `skillid` = ".. 4 ..";") db.executeQuery("UPDATE `player_skills` SET `value` = " .. arg.shield .. " WHERE `player_id` = ".. pid .. " and `skillid` = ".. 5 ..";") db.executeQuery("UPDATE `player_skills` SET `value` = " .. arg.fish .. " WHERE `player_id` = ".. pid .. " and `skillid` = ".. 6 ..";") return true end function changePlayerVocation(cid, id) savePlayerVocation(cid) local newVoc = getVocationStorage(id) if(getPlayerStorageValue(cid, newVoc) == -1) or (getPlayerStorageValue(cid, newVoc) == 0) then local level = getPlayerLevel(cid) local vocationsset = { [1] = 1 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 1, -- default Sorcerer [2] = 1 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 2, -- default Druid [3] = 1 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 3, -- default Paladin [4] = 1 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 10 .. "-" .. 4 -- default Knight } setStorageString(cid, newVoc, vocationsset[getVocationCfg(id)]) end if(getPlayerFirstVocation(cid) == -1) or (getPlayerFirstVocation(cid) == 0) then setPlayerStorageValue(cid, acv_first_storage, getPlayerVocationName(cid)) end local get = string.explode(getStorageString(cid, newVoc), "-") local maglevel, fist, club, sword, axe, dist, shield, fish, voc = get[1], get[2], get[3], get[4], get[5], get[6], get[7], get[8], get[9] voc = tonumber(voc) if(getPlayerPromotionLevel(cid) == 1) and (voc <= 4) then voc = voc + 4 end doPlayerSetVocation(cid, voc) setCreatureMaxHealth(cid, getPlayerLevel(cid) * getFormula(cid).health[voc]) doCreatureAddHealth(cid, getPlayerLevel(cid) * getFormula(cid).health[voc]) setCreatureMaxMana(cid, getPlayerLevel(cid) * getFormula(cid).mana[voc]) doCreatureAddMana(cid, getPlayerLevel(cid) * getFormula(cid).mana[voc]) setupPlayerVocation(cid, {maglevel = maglevel, fist = fist, club = club, sword = sword, axe = axe, dist = dist, shield = shield, fish = fish}) return true end The end. <3
×
×
  • Create New...