Odp: Transform ktory zabiera soula
talkactions
[lua]local TRANSFORM = {
[1] = {bonusHP = 50, bonusMana = 50, newVoc = 2, level = 10},
[2] = {bonusHP = 70, bonusMana = 75, newVoc = 3, level = 20},
[3] = {bonusHP = 90, bonusMana = 110, newVoc = 4, level = 30}
}
function onSay(cid, words, param, channel , interval)
if(not isPlayer(cid))then
return true
end
local voc = getPlayerVocation(cid)
local transform = TRANSFORM[voc]
local lvl = getPlayerLevel(cid)
local mana = getPlayerMana(cid)
local pos = getCreaturePosition(cid)
if(transform)then
if(transform.level <= lvl)then
if(mana > 100)then
local bonusHP, bonusMana, newVoc, effect = transform.bonusHP, transform.bonusMana, transform.newVoc, transform.effect
bonusHPP = bonusHP + getCreatureMaxHealth(cid)
bonusManaa = bonusMana + getCreatureMaxMana(cid)
return doPlayerSetVocation(cid, newVoc) and Outfit(cid) and setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+bonusHP) and doCreatureAddHealth(cid, bonusHP) and setCreatureMaxMana(cid, getCreatureMaxMana(cid)+bonusMana) and doCreatureAddMana(cid, bonusMana) and manaLoss(cid) and true
else
return doPlayerSendCancel(cid, "You need more chakra to transform") and doSendMagicEffect(pos, CONST_ME_POFF) and true
end
else
return doPlayerSendCancel(cid, "You need " .. transform.level .. " level to transform") and doSendMagicEffect(pos, CONST_ME_POFF) and true
end
else
return doPlayerSendCancel(cid, "You cannot transform.") and doSendMagicEffect(pos, CONST_ME_POFF) and true
end
return true
end[/lua]
lib
[lua]CHECK = {
[2] = {manapersec = 10, toVoc = 1, effect = 1},
[3] = {manapersec = 10, toVoc = 1, effect = 1},
[4] = {manapersec = 10, toVoc = 1, effect = 1}
}
function manaLoss(cid)
if(not isPlayer(cid))then
return true
end
local voc = getPlayerVocation(cid)
for voc,x in pairs (CHECK) do
if(CHECK[getPlayerVocation(cid)])then
if(getPlayerSoul(cid) >= x.manapersec)then
return doPlayerAddSoul(cid, -x.manapersec, false) and addEvent(manaLoss, 1500, cid) and true
else
return doSendMagicEffect(getCreaturePosition(cid), x.effect) and ChangeHealthAndMana(cid) and doPlayerSetVocation(cid, x.toVoc) and Outfit(cid) and true
end
end
end
return true
end
function revert(cid)
if(not isPlayer(cid))then
return true
end
local voc = getPlayerVocation(cid)
for voc,x in pairs (CHECK) do
if(CHECK[getPlayerVocation(cid)])then
return ChangeHealthAndMana(cid) and doPlayerSetVocation(cid, x.toVoc) and true
end
end
return true
end
--HP/MP
local TABELA = {
[2] = {bonusHP = 50, bonusMana = 50}, -- odejmie 50hp/mp
[3] = {bonusHP = 120, bonusMana = 125}, -- odejmie 120hp/125mp bo dwa transy w sumie daly mu 120hp
[4] = {bonusHP = 210, bonusMana = 235} -- odejmie 210/235, trzy transy 50+70+90hp, 50+75+110mp=235mp.
}
function ChangeHealthAndMana(cid)
local voc, healthmax, manamax = getPlayerVocation(cid), getCreatureMaxHealth(cid), getCreatureMaxMana(cid)
local tabela = TABELA[voc]
if (isPlayer(cid) and tabela)then
healthmax = healthmax - tabela.bonusHP
manamax = manamax - tabela.bonusMana
return setCreatureMaxHealth(cid, healthmax) and setCreatureMaxMana(cid, manamax) and doCreatureAddHealth(cid, -tabela.bonusHP) and doCreatureAddMana(cid, -tabela.bonusMana) and true
end
end
--Outfity
local OUTFIT = {
[1] = {lookType=2},
[2] = {lookType=3},
[3] = {lookType=7},
[4] = {lookType=9}
}
function Outfit(cid)
if(OUTFIT[getPlayerVocation(cid)])then
return doSetCreatureOutfit(cid, OUTFIT[getPlayerVocation(cid)], -1)
end
return true
end[/lua]
login lua
[lua]manaLoss(cid)
Outfit(cid)[/lua]
transform z internetu. zmienilem tylko, aby nie bralo many, a soul.