Modificar Talk Que Muda De Vocaçao

nbb147
Por nbb147
em Scripts

nbb147

My sweet sadness, my favorite feeling. ♪♫
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 06/04/11Posts: 350Char no Tibia: Mulekepirado

galera to com uma talk que muda vocation do player e transform ele por certo tempo, eu queria saber se tem como fazer pra ela ficar gastando a mana do player e quando chega-se a certa quantidade ele voltava a vocaçao normal e o addon saia, caso nao de certo fazer isso, façam so para tirar mana msm, que da certo, script:

 

 

 

-- Script by LuckOake

local function endTransform(cid)

if isCreature(cid) and getPlayerStorageValue(cid, 8152) > 0 then

doPlayerSetVocation(cid, getPlayerStorageValue(cid, 8152))

setPlayerStorageValue(cid, 8152, -1)

doRemoveCondition(cid, CONDITION_OUTFIT)

end

end

 

function onSay(cid, words)

local waittime = 2 -- Tempo de exhaustion

local storage = 6811

local tempo = 1000000000000000 -- Tempo em milesegundos (1seg = 1000) até a vocation sumir

local vocation = 61 -- Vocation ID

local mana = 100 -- Mana necessária

local outfit = {lookType = 118, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0} -- Outfit

local useable_vocs = {"Knight"} -- Vocations que podem usar a talk

local level = 40

local levelMax = 150

 

if not isInArray(useable_vocs, getPlayerVocationName(cid)) then

doPlayerSendCancel(cid, "Essa vocaçao nao possui o selo.") return true

elseif exhaustion.check(cid, storage) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar esse selo novamente.") return true

elseif getPlayerMana(cid) < mana then

doPlayerSendCancel(cid, "Voce nao tem chakra suficiente.") return true

elseif getPlayerLevel(cid) < level then

doPlayerSendCancel(cid, "Voce prescisa estar level "..level..".") return true

elseif getPlayerLevel(cid) >= levelMax then

doPlayerSendCancel(cid, "O level maximo para usar esse selo é ("..levelMax..").") return true

end

 

exhaustion.set(cid, storage, waittime)

doPlayerAddMana(cid, -mana)

setPlayerStorageValue(cid, 8152, getPlayerVocation(cid))

doSetCreatureOutfit(cid, outfit, -1)

doPlayerSetVocation(cid, vocation)

addEvent(endTransform, tempo, cid)

return true

end

 
 

 

sfmlarl

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 04/09/07Posts: 42Gênero: Masculino

Veja ae se está conforme você pediu...se sim, da up ae, se não, tenta explicar novamente!

 

 

local function endTransform(cid)

if isCreature(cid) and getPlayerStorageValue(cid, 8152) > 0 then

doPlayerSetVocation(cid, getPlayerStorageValue(cid, 8152))

setPlayerStorageValue(cid, 8152, -1)

doRemoveCondition(cid, CONDITION_OUTFIT)

end

end

 

function onSay(cid, words)

local waittime = 2 -- Tempo de exhaustion

local storage = 6811

local tempo = math.abs(1000*getCreatureMaxMana(cid)*0.3) -- Tempo em milesegundos (1seg = 1000) até a vocation sumir

local vocation = 61 -- Vocation ID

local mana = 1 -- Quando de mana se tira por segundo

local manamin = getCreatureMaxMana(cid)*0.3 -- Mana mínima necessária e que determina o tempo

local outfit = {lookType = 118, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0} -- Outfit

local useable_vocs = {"Knight"} -- Vocations que podem usar a talk

local level = 40

local levelMax = 150

 

if not isInArray(useable_vocs, getPlayerVocationName(cid)) then

doPlayerSendCancel(cid, "Essa vocaçao nao possui o selo.") return true

elseif exhaustion.check(cid, storage) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar esse selo novamente.") return true

elseif getPlayerMana(cid) < manamin then

doPlayerSendCancel(cid, "Voce nao tem chakra suficiente.") return true

elseif getPlayerLevel(cid) < level then

doPlayerSendCancel(cid, "Voce prescisa estar level "..level..".") return true

elseif getPlayerLevel(cid) >= levelMax then

doPlayerSendCancel(cid, "O level maximo para usar esse selo é ("..levelMax..").") return true

end

 

exhaustion.set(cid, storage, waittime)

for i = 1, math.abs(getCreatureMaxMana(cid)*0.3) do

addEvent(doPlayerAddMana, i*1000, cid, -mana) -- A cada 1 segundo sairá a mana pré-determinada

end

setPlayerStorageValue(cid, 8152, getPlayerVocation(cid))

doSetCreatureOutfit(cid, outfit, -1)

doPlayerSetVocation(cid, vocation)

addEvent(endTransform, tempo, cid)

return true

end

 

Em azul significa onde mudei ou adicionei algo.

nbb147

My sweet sadness, my favorite feeling. ♪♫
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 06/04/11Posts: 350Char no Tibia: Mulekepirado

quase certo so faltou pra quando a mana acabar o addon sair, e o player voltar a vocaçao que era antes..

 
 

 

sfmlarl

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 04/09/07Posts: 42Gênero: Masculino

É mesmo, nem tinha me atentado a isso, só imaginei sem gastar mana de outra forma...

 

Bem, da forma que você falou não sei fazer, pelo menos de mente não veio nada. E ali em cima não é math.abs, é math.floor!

 

Com o script a seguir que eu modifiquei e juntei agora, você irá tirar mana até acabar, tente ver se a partir dele você consegue algo, se eu poder, depois eu tento também!

 

local interval = 1

local heals = {

['hp'] = 4,

['mana'] = 1,

}

----

interval = interval*1000

local function rot(cid,n,old) --- Função do MOCK

local tb_rot = {{0,2},{6,5},{1,3},{7,4},false}

if isPlayer(cid) == FALSE or tb_rot[n] == nil or getPlayerMana(cid) < heals['mana'] then

return false

end

if tb_rot[n] == false then

doCreatureAddMana(cid, -heals['mana'])

addEvent(rot, interval,cid,2,old)

return false

end

n = n+1

addEvent(rot, interval,cid,n,old)

end

 

local function endTransform(cid)

if isCreature(cid) and getPlayerStorageValue(cid, 8152) > 0 then

doPlayerSetVocation(cid, getPlayerStorageValue(cid, 8152))

setPlayerStorageValue(cid, 8152, -1)

doRemoveCondition(cid, CONDITION_OUTFIT)

end

end

 

function onSay(cid, words, param)

local waittime = 2 -- Tempo de exhaustion

local storage = 6811

local tempo = math.floor(1000*getCreatureMaxMana(cid)*0.3) -- Tempo em milesegundos (1seg = 1000) até a vocation sumir

local mana = 1 -- Quando de mana se tira por segundo

local manamin = getCreatureMaxMana(cid)*0.3 -- Mana mínima necessária e que determina o tempo

local useable_vocs = {"Druid"} -- Vocations que podem usar a talk

local vocation = 8 -- Vocation ID

local outfit = {lookType = 118, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0} -- Outfit

local level = 1

local levelMax = 1000

 

if not isInArray(useable_vocs, getPlayerVocationName(cid)) then

doPlayerSendCancel(cid, "Essa vocaçao nao possui o selo.")

return false

elseif getPlayerMana(cid) < math.floor(getCreatureMaxMana(cid)*0.3) then

doPlayerSendCancel(cid,"Você precisa de ao menos ".. math.floor(getCreatureMaxMana(cid)*0.3) .." pontos de mana.")

return FALSE

elseif exhaustion.check(cid, storage) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar esse selo novamente.")

return FALSE

elseif getPlayerLevel(cid) < level then

doPlayerSendCancel(cid, "Voce prescisa estar level "..level..".")

return false

elseif getPlayerLevel(cid) >= levelMax then

doPlayerSendCancel(cid, "O level maximo para usar esse selo é ("..levelMax..").")

return false

end

 

doCreatureAddMana(cid, -heals['mana'])

addEvent(rot, interval,cid,1,getCreaturePosition(cid))

exhaustion.set(cid, storage, waittime)

setPlayerStorageValue(cid, 8152, getPlayerVocation(cid))

doSetCreatureOutfit(cid, outfit, -1)

doPlayerSetVocation(cid, vocation)

addEvent(endTransform, tempo, cid)

return FALSE

end

nbb147

My sweet sadness, my favorite feeling. ♪♫
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 06/04/11Posts: 350Char no Tibia: Mulekepirado

blz, valeu por tentar ajudar..

ainda to esperando ajuda...