• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Spell +[Creaturescript] Vampiric touch(Lifesteal atk)

Serginov

Onkonkoronkonk
Joined
Jun 28, 2008
Messages
1,321
Reaction score
18
Location
Sweden - Dalarna
I've been making some spells/skills for my team battle ot but it will never go online cause of my internet and lack of money.
This is my newest skill, Vampiric touch.
Tested on TFS 0.3.6. I'm not sure, but I think it will work for 0.4 too.

When you cast this spell you will get health on each physical attack as long as the spell lasts. This mean you can use exori gran, hur, mas, everything that use physical damage.
It have a cooldown on 240 seconds. you can change this in the config
The skill lasts for 180 seconds which you also can change in the config

Spells/scripts/attack/vampiric touch.lua
Code:
local combat = createCombatObject()

local config = {
    spellName = "Vampiric Touch", -- The spells name. Not the words you say to cast it.
    storage = 1401,
    timeStorage = 1402,
    cooldown = 240, -- Cooldown on the spell in seconds
    skillTime = 180, -- For this long the skill will be activated.
    }

function onCastSpell(cid, var)

    if not exhaustion.get(cid, config.storage) then
        exhaustion.set(cid, config.storage, config.cooldown)
        exhaustion.set(cid, config.timeStorage, config.skillTime)
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
        doCreatureSay(cid, "VAMPIRIC TOUCH!", TALKTYPE_ORANGE_1)
    else
        doPlayerSendCancel(cid, config.spellName .. " is still on " .. exhaustion.get(cid, config.storage) .. " seconds cooldown!")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return false
    end

    doCombat(cid, combat, var)
return true
end
Spells/spells.xml
Code:
<instant name="Vampiric touch" words="utori con" lvl="75" mana="320" prem="1" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="attack/vampiric touch.lua">
        <vocation id="3"/>
        <vocation id="4"/>
        <vocation id="7"/>
        <vocation id="8"/>
    </instant>
Creaturescripts/scripts/vampiric touch.lua
Code:
local config = {
    spellName = "Vampiric Touch",
    storage = 1401,
    timeStorage = 1402,
    lifeStealPercent = 50, -- Percent of the damage you deal you will get in health.
    }

function onStatsChange(cid, attacker, type, combat, value)
    if type == COMBAT_PHYSICALDAMAGE then
        if exhaustion.get(attacker, config.storage) then
            doCreatureAddHealth(attacker, math.ceil(value * (config.lifeStealPercent / 100)))
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
            doSendMagicEffect(getPlayerPosition(attacker), CONST_ME_MAGIC_RED)
            doSendAnimatedText(getPlayerPosition(attacker), "+" .. math.ceil(value * (config.lifeStealPercent / 100)) .. " HP", TEXTCOLOR_RED)
            doPlayerSendTextMessage(attacker, MESSAGE_STATUS_DEFAULT, "You stole " .. math.ceil(value * (config.lifeStealPercent / 100)) .. " health from " .. getPlayerName(cid) .. "\n" .. config.spellName .. " will last for " .. exhaustion.get(attacker, config.timeStorage) .. " seconds more.")
        end
    end
    return true    
end
Creaturescripts/creaturescripts.xml
Code:
<event type="statschange" name="vampiricTouch" event="script" value="vampiric touch.lua"/>
in Creaturescripts/scripts/login.lua add this inside the function
Code:
registerCreatureEvent(cid, "vampiricTouch")
Enjoy.
 
Last edited:
Code:
[COLOR="red"]l[/COLOR]local config = {
    spellName = "Vampiric Touch",
    storage = 1401,
    timeStorage = 1402,
    lifeStealPercent = 50, -- Percent of the damage you deal you will get in health.
    }

I think that you should delete it :p.

Btw. Nice release :D :thumbup:
 
Hey, I'm looking over all of your spells right now, and interested in all of the ones i've seen so far for my new vocation, Could you possible tell me how to make the healing recieved through doing magic damage isntead of dealing physical?
 
Change
Code:
COMBAT_PHYSICALDAMAGE
to one of those, or all:
Code:
COMBAT_ENERGYDAMAGE
COMBAT_EARTHDAMAGE
COMBAT_POISONDAMAGE
COMBAT_FIREDAMAGE
COMBAT_UNDEFINEDDAMAGE
COMBAT_LIFEDRAIN
COMBAT_MANADRAIN
COMBAT_HEALING
COMBAT_DROWNDAMAGE
COMBAT_ICEDAMAGE
COMBAT_HOLYDAMAGE
COMBAT_DEATHDAMAGE
 
Can someone help me, im using tfs 0.3.6. The spell part works fine, but it doesnt heal me or send another message. No errors in console either.
 
PHP:
[24/06/2012 13:54:00] [Error - CreatureScript Interface] 
[24/06/2012 13:54:00] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[24/06/2012 13:54:00] Description: 
[24/06/2012 13:54:00] (luaGetPlayerFlagValue) Player not found
 
Code:
[01/07/2012 06:41:41] Cero has logged in.

[01/07/2012 06:41:59] [Error - CreatureScript Interface] 
[01/07/2012 06:41:59] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:41:59] Description: 
[01/07/2012 06:41:59] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:00] [Error - CreatureScript Interface] 
[01/07/2012 06:42:00] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:00] Description: 
[01/07/2012 06:42:00] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:01] [Error - CreatureScript Interface] 
[01/07/2012 06:42:01] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:01] Description: 
[01/07/2012 06:42:01] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:02] [Error - CreatureScript Interface] 
[01/07/2012 06:42:02] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:02] Description: 
[01/07/2012 06:42:02] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:06] [Error - CreatureScript Interface] 
[01/07/2012 06:42:06] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:06] Description: 
[01/07/2012 06:42:06] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:06] [Error - CreatureScript Interface] 
[01/07/2012 06:42:06] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:06] Description: 
[01/07/2012 06:42:06] (luaGetCreatureStorage) Creature not found

[01/07/2012 06:42:06] [Error - CreatureScript Interface] 
[01/07/2012 06:42:06] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:06] Description: 
[01/07/2012 06:42:06] data/lib/034-exhaustion.lua:17: attempt to compare number with boolean
[01/07/2012 06:42:06] stack traceback:
[01/07/2012 06:42:06] 	data/lib/034-exhaustion.lua:17: in function 'get'
[01/07/2012 06:42:06] 	data/creaturescripts/scripts/vampiric touch.lua:10: in function <data/creaturescripts/scripts/vampiric touch.lua:8>

[01/07/2012 06:42:06] [Error - CreatureScript Interface] 
[01/07/2012 06:42:06] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:06] Description: 
[01/07/2012 06:42:06] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:08] [Error - CreatureScript Interface] 
[01/07/2012 06:42:08] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:08] Description: 
[01/07/2012 06:42:08] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:10] [Error - CreatureScript Interface] 
[01/07/2012 06:42:10] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:10] Description: 
[01/07/2012 06:42:10] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:11] [Error - CreatureScript Interface] 
[01/07/2012 06:42:11] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:11] Description: 
[01/07/2012 06:42:11] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:11] [Error - CreatureScript Interface] 
[01/07/2012 06:42:11] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:11] Description: 
[01/07/2012 06:42:11] (luaGetCreatureStorage) Creature not found

[01/07/2012 06:42:11] [Error - CreatureScript Interface] 
[01/07/2012 06:42:11] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:11] Description: 
[01/07/2012 06:42:11] data/lib/034-exhaustion.lua:17: attempt to compare number with boolean
[01/07/2012 06:42:11] stack traceback:
[01/07/2012 06:42:11] 	data/lib/034-exhaustion.lua:17: in function 'get'
[01/07/2012 06:42:11] 	data/creaturescripts/scripts/vampiric touch.lua:10: in function <data/creaturescripts/scripts/vampiric touch.lua:8>

[01/07/2012 06:42:12] [Error - CreatureScript Interface] 
[01/07/2012 06:42:12] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:12] Description: 
[01/07/2012 06:42:12] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:14] [Error - CreatureScript Interface] 
[01/07/2012 06:42:14] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:14] Description: 
[01/07/2012 06:42:14] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:16] [Error - CreatureScript Interface] 
[01/07/2012 06:42:16] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:16] Description: 
[01/07/2012 06:42:16] (luaGetPlayerFlagValue) Player not found

[01/07/2012 06:42:16] [Error - CreatureScript Interface] 
[01/07/2012 06:42:16] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:16] Description: 
[01/07/2012 06:42:16] (luaGetCreatureStorage) Creature not found

[01/07/2012 06:42:16] [Error - CreatureScript Interface] 
[01/07/2012 06:42:16] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:16] Description: 
[01/07/2012 06:42:16] data/lib/034-exhaustion.lua:17: attempt to compare number with boolean
[01/07/2012 06:42:16] stack traceback:
[01/07/2012 06:42:16] 	data/lib/034-exhaustion.lua:17: in function 'get'
[01/07/2012 06:42:16] 	data/creaturescripts/scripts/vampiric touch.lua:10: in function <data/creaturescripts/scripts/vampiric touch.lua:8>

[01/07/2012 06:42:16] [Error - CreatureScript Interface] 
[01/07/2012 06:42:16] data/creaturescripts/scripts/vampiric touch.lua:onStatsChange
[01/07/2012 06:42:16] Description: 
[01/07/2012 06:42:16] (luaGetPlayerFlagValue) Player not found
[01/07/2012 06:42:17] Cero has logged out.

0.3.6 v5 8.6
 
Back
Top