Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <mod name="Vampire System" version="1.0" author="LuckOake" contact="none" enabled="yes">
- ------------------------------------------------------------------------------------
- <config name="vamp"><![CDATA[
- vampwait = 13277
- vampstor = 13278
- vamplevel = 13279
- vamptime = 13280
- exha = 10 -- Segundos de exhaustion até poder morder alguém novamente
- chance = 10 -- Porcentagem de chance de alguém virar vampiro ao ser mordido
- hp = 100 -- Quanto de HP a criatura perderá ao ser mordida
- vamphours = 24 -- De quantas em quantas horas a criatura evoluirá de nível de vampirismo caso não se alimente
- vampmax = 4 -- Level máximo de vampirismo e level necessário para se transformar num Vampire Lord
- vamplordout = 287 -- Outfit do Vampire Lord
- weak = 90 -- Porcentagem extra de dano de holy que um vampiro receberá
- strenght = 50 -- Porcentagem de resistência do elemento death que um vampiro possui
- function isSummon(sid)
- for i, pid in ipairs(getPlayersOnline()) do
- for c, cid in pairs(getCreatureSummons(pid)) do
- if (cid == sid) then
- return true
- end
- end
- end
- return false
- end
- function turnIntoVampire(cid)
- return setPlayerStorageValue(cid, vampstor, 1) and setVampireLevel(cid, 1)
- end
- function turnIntoVampireLord(cid)
- setPlayerStorageValue(cid, vampstor, 2)
- doSetCreatureOutfit(cid, {lookType = vamplordout}, -1)
- end
- function cureVampirism(cid)
- if hasCondition(cid, CONDITION_OUTFIT) then
- doRemoveCondition(cid, CONDITION_OUTFIT)
- end
- return setPlayerStorageValue(cid, vampstor, -1) and setVampireLevel(cid, 0)
- end
- function isVampire(cid)
- return getPlayerStorageValue(cid, vampstor) == 1 and true or false
- end
- function isVampireLord(cid)
- return getPlayerStorageValue(cid, vampstor) == 2 and true or false
- end
- function setVampireLevel(cid, level)
- return setPlayerStorageValue(cid, vamplevel, level)
- end
- function getVampireLevel(cid)
- return getPlayerStorageValue(cid, vamplevel)
- end
- ]]></config>
- ------------------------------------------------------------------------------------
- <event type="look" name="VampLook" event="script"><![CDATA[
- function onLook(cid, thing, position, lookDistance)
- domodlib('vamp')
- if not isCreature(thing.uid) then return true
- elseif isPlayer(thing.uid) and thing.uid ~= cid and isVampire(thing.uid) or isVampireLord(thing.uid) then
- doPlayerSetSpecialDescription(thing.uid, ". Vampire Level "..getVampireLevel(thing.uid).."") return true
- elseif thing.uid == cid and isVampire(cid) or isVampireLord(thing.uid) then
- doPlayerSetSpecialDescription(cid, ". Vampire Level "..getVampireLevel(cid).."") return true
- end
- return true
- end
- ]]></event>
- ------------------------------------------------------------------------------------
- <event type="login" name="VampRegister" event="script"><![CDATA[
- function onLogin(cid)
- domodlib('vamp')
- registerCreatureEvent(cid, "VampLook")
- registerCreatureEvent(cid, "VampThink")
- registerCreatureEvent(cid, "VampDmg")
- if isVampireLord(cid) then
- doSetCreatureOutfit(cid, {lookType = vamplordout}, -1)
- end
- return true
- end
- ]]></event>
- ------------------------------------------------------------------------------------
- <event type="combat" name="VampAttack" event="script"><![CDATA[
- function onCombat(cid, target)
- domodlib('vamp')
- if isPlayer(target) and not isVampire(target) and not isVampireLord(target) and math.random(1, 100) <= chance then
- turnIntoVampire(target)
- doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_ORANGE, "You contracted vampirism.")
- exhaustion.set(target, vamptime, vamphours*3600)
- doCreatureAddHealth(target, -hp)
- doCreatureAddHealth(cid, hp)
- doSendMagicEffect(getCreaturePos(target), 13)
- doSendMagicEffect(getCreaturePos(cid), 2)
- end
- return true
- end
- ]]></event>
- ------------------------------------------------------------------------------------
- <talkaction words="bite" event="buffer"><![CDATA[
- domodlib('vamp')
- local r = math.random(1, 100)
- local target = getCreatureTarget(cid)
- if not isVampire(cid) and not isVampireLord(cid) then
- doPlayerSendCancel(cid, "You are not a vampire.") return true
- elseif getCreatureTarget(cid) < 1 then
- doPlayerSendCancel(cid, "You must have a target.") return true
- elseif exhaustion.check(cid, vampwait) then
- doPlayerSendCancel(cid, "Wait "..exhaustion.get(cid, vampwait).." seconds to bite someone again.") return true
- elseif getDistanceBetween(getCreaturePos(cid), getCreaturePos(target)) > 1 then
- doPlayerSendCancel(cid, "Get close to your target.") return true
- elseif isSummon(target) then
- doPlayerSendCancel(cid, "Sorry, but you can't bite a summon.") return true
- elseif isVampire(target) or isVampireLord(target) then
- doPlayerSendCancel(cid, "Sorry, but this creature is already a vampire.") return true
- end
- if isPlayer(target) and r <= chance then
- turnIntoVampire(target)
- doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_ORANGE, ""..getCreatureName(cid).." turned you into a vampire.")
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You turned "..getCreatureName(target).." into a vampire.")
- exhaustion.set(target, vamptime, vamphours*3600)
- elseif isMonster(target) and r <= chance and (getMonsterInfo(getCreatureName(target)).convinceable) then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You turned "..getCreatureName(target).." into a vampire and now it's your thrall.")
- doConvinceCreature(cid, target)
- end
- doSendAnimatedText(getCreaturePos(target), "-"..hp, TEXTCOLOR_RED)
- doCreatureAddHealth(target, -hp)
- doCreatureAddHealth(cid, hp)
- if not isVampireLord(cid) then
- setVampireLevel(cid, 1)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your vampirism level regressed to 1.")
- exhaustion.set(cid, vamptime, vamphours*3600)
- end
- doSendMagicEffect(getCreaturePos(target), 13)
- doSendMagicEffect(getCreaturePos(cid), 2)
- exhaustion.set(cid, vampwait, exha)
- return true
- ]]></talkaction>
- ------------------------------------------------------------------------------------
- <event type="think" name="VampThink" event="script"><![CDATA[
- function onThink(cid)
- domodlib('vamp')
- if isVampire(cid) and not exhaustion.check(cid, vamptime) and getVampireLevel(cid) < 4 then
- exhaustion.set(cid, vamptime, vamphours*3600)
- setVampireLevel(cid, getVampireLevel(cid)+1)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vampirism evolved to level "..getVampireLevel(cid).." because you didn't feed.")
- end
- return true
- end
- ]]></event>
- ------------------------------------------------------------------------------------
- <talkaction words="vampire lord" filter="word-spaced" event="buffer"><![CDATA[
- domodlib('vamp')
- if not isVampire(cid) then
- doPlayerSendCancel(cid, "You are not a vampire.") return true
- elseif getVampireLevel(cid) < vampmax then
- doPlayerSendCancel(cid, "You must be a vampire level "..vampmax.." to transform into a Vampire Lord.") return true
- elseif isVampireLord(cid) then
- doPlayerSendCancel(cid, "You are already a Vampire Lord.") return true
- end
- doSendMagicEffect(getCreaturePos(cid), 40)
- turnIntoVampireLord(cid)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You are now a Vampire Lord!")
- return true
- ]]></talkaction>
- ------------------------------------------------------------------------------------
- <action itemid="6311" event="script"><![CDATA[
- domodlib('vamp')
- if itemEx.uid ~= cid then
- doPlayerSendCancel(cid, "You may only use this potion on yourself.") return true
- elseif not isVampire(cid) and not isVampireLord(cid) then
- doPlayerSendCancel(cid, "You aren't a vampire.") return true
- end
- doSendMagicEffect(getCreaturePos(cid), 12)
- cureVampirism(cid)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your vampirism was cured.")
- doCreatureSay(cid, "Aaaah...", TALKTYPE_MONSTER)
- doRemoveItem(item.uid, 1)
- return true
- ]]></action>
- ------------------------------------------------------------------------------------
- <event type="statschange" name="VampDmg" event="script"><![CDATA[
- function onStatsChange(cid, attacker, type, combat, value)
- domodlib('vamp')
- ndmg = math.ceil(value*(weak/100)+(getVampireLevel(cid)*20))
- pdmg = math.ceil(value*(strenght/100)+(getVampireLevel(cid)*20))
- if type == STATSCHANGE_HEALTHLOSS and isVampire(cid) or isVampireLord(cid) then
- if combat == COMBAT_HOLYDAMAGE then
- doCreatureAddHealth(cid, -ndmg)
- doSendAnimatedText(getCreaturePos(cid), "-"..ndmg, TEXTCOLOR_YELLOW)
- elseif combat == COMBAT_DEATHDAMAGE then
- doCreatureAddHealth(cid, pdmg)
- end
- end
- return true
- end
- ]]></event>
- ------------------------------------------------------------------------------------
- <action itemid="6312" event="script"><![CDATA[
- domodlib('vamp')
- if itemEx.uid ~= cid then
- doPlayerSendCancel(cid, "You may only use this potion on yourself.") return true
- elseif not isVampire(cid) and not isVampireLord(cid) then
- doPlayerSendCancel(cid, "You aren't a vampire.") return true
- end
- setVampireLevel(cid, 1)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your vampirism level regressed to 1.")
- doSendMagicEffect(getCreaturePos(cid), 13)
- exhaustion.set(cid, vamptime, vamphours*3600)
- doCreatureSay(cid, "Aaaah...", TALKTYPE_MONSTER)
- doRemoveItem(item.uid, 1)
- return true
- ]]></action>
- </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement