Ciamciaj Bigos
ก้้้้้้&
- Joined
- Jun 6, 2013
- Messages
- 2,081
- Reaction score
- 192
Opis; Autor nieznany. Udoskonalilem i poprawilem, bo byly bugi z powrotem hp. Krotki i latwy do edycji, po zerknieciu z grubsza juz wiadomo jak dziala.
Skrypt;
data/talkactions/scripts/transform.lua
[lua]local TRANSFORM = {
[1] = {bonusHP = 50, bonusMana = 50, newVoc = 2, level = 10},
[2] = {bonusHP = 50, bonusMana = 50, newVoc = 3, level = 20},
[3] = {bonusHP = 50, bonusMana = 50, 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
bonusHP = bonusHP + getCreatureMaxHealth(cid)
bonusMana = bonusMana + getCreatureMaxMana(cid)
return doPlayerSetVocation(cid, newVoc) and Outfit(cid) and setCreatureMaxHealth(cid, bonusHP) and doCreatureAddHealth(cid, bonusHP) and setCreatureMaxMana(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]
data/lib/050-function.lua/
[lua]CHECK = {
[2] = {manapersec = 10, toVoc = 1, effect = 1},
[3] = {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(getPlayerMana(cid) >= x.manapersec)then
return doPlayerAddMana(cid, -x.manapersec, false) and addEvent(manaLoss, 1000, cid) and true
else
return doSendMagicEffect(getCreaturePosition(cid), x.effect) and doPlayerSetVocation(cid, x.toVoc) and Outfit(cid) and ChangeHealthAndMana(cid) and true
end
end
end
return true
end
local TABELA = {
[1] = {bonusHP = 50, bonusMana = 50},
[2] = {bonusHP = 50, bonusMana = 50},
[3] = {bonusHP = 50, bonusMana = 50},
}
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 doPlayerAddMana(cid, -tabela.bonusMana) and true
end
end
local OUTFIT = {
[1] = {lookType=2},
[2] = {lookType=6},
[3] = {lookType=5},
}
function Outfit(cid)
if(OUTFIT[getPlayerVocation(cid)])then
return doSetCreatureOutfit(cid, OUTFIT[getPlayerVocation(cid)], -1)
end
return true
end[/lua]
data/creaturescripts/scripts/login.lua/
[lua]manaLoss(cid)
Outfit(cid)[/lua]
Skrypt;
data/talkactions/scripts/transform.lua
[lua]local TRANSFORM = {
[1] = {bonusHP = 50, bonusMana = 50, newVoc = 2, level = 10},
[2] = {bonusHP = 50, bonusMana = 50, newVoc = 3, level = 20},
[3] = {bonusHP = 50, bonusMana = 50, 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
bonusHP = bonusHP + getCreatureMaxHealth(cid)
bonusMana = bonusMana + getCreatureMaxMana(cid)
return doPlayerSetVocation(cid, newVoc) and Outfit(cid) and setCreatureMaxHealth(cid, bonusHP) and doCreatureAddHealth(cid, bonusHP) and setCreatureMaxMana(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]
data/lib/050-function.lua/
[lua]CHECK = {
[2] = {manapersec = 10, toVoc = 1, effect = 1},
[3] = {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(getPlayerMana(cid) >= x.manapersec)then
return doPlayerAddMana(cid, -x.manapersec, false) and addEvent(manaLoss, 1000, cid) and true
else
return doSendMagicEffect(getCreaturePosition(cid), x.effect) and doPlayerSetVocation(cid, x.toVoc) and Outfit(cid) and ChangeHealthAndMana(cid) and true
end
end
end
return true
end
local TABELA = {
[1] = {bonusHP = 50, bonusMana = 50},
[2] = {bonusHP = 50, bonusMana = 50},
[3] = {bonusHP = 50, bonusMana = 50},
}
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 doPlayerAddMana(cid, -tabela.bonusMana) and true
end
end
local OUTFIT = {
[1] = {lookType=2},
[2] = {lookType=6},
[3] = {lookType=5},
}
function Outfit(cid)
if(OUTFIT[getPlayerVocation(cid)])then
return doSetCreatureOutfit(cid, OUTFIT[getPlayerVocation(cid)], -1)
end
return true
end[/lua]
data/creaturescripts/scripts/login.lua/
[lua]manaLoss(cid)
Outfit(cid)[/lua]