• 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 Life steal / Life drain (for X seconds)

PhoOwned

^_^
Joined
Nov 11, 2010
Messages
375
Reaction score
66
(It's part of my talents system)

in ../data/creaturescripts/creaturescripts.xml add:
XML:
<event type="login" name="TalentsLogin" event="script" value="talents/login.lua"/>
<event type="statschange" name="TalentsStatsChange" event="script" value="talents/statschange.lua"/>
in ../data/creaturescripts/scripts/talents/login.lua add:
Lua:
function onLogin(cid)
	registerCreatureEvent(cid, "TalentsStatsChange")
	return true
end
in ../data/creaturescripts/scripts/talents/statschange.lua add:
Lua:
local drainStorage = 34527
local drainPercent = 30

function onStatsChange(cid, attacker, type, combat, value)
	if(isPlayer(attacker) and getCreatureStorage(attacker, drainStorage) >= os.time() and (type == STATSCHANGE_MANALOSS or type == STATSCHANGE_HEALTHLOSS)) then
		doCreatureAddHealth(attacker, value * drainPercent / 100)
	end
	return true
end

and new spell:
Lua:
local drainStorage = 34527
local drainTime = 30
local drainExhaust = 60

function onCastSpell(cid, var)
	if(getCreatureStorage(cid, drainStorage) - drainTime + drainExhaust <= os.time()) then
		doCreatureSetStorage(cid, drainStorage, os.time() + drainTime)
		return true
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can not cast life drain. Wait " .. getCreatureStorage(cid, drainStorage) - drainTime + drainExhaust - os.time() .. " seconds.")
		return false
	end
end
 
Last edited:
PhoOwned, help ? ;/

Code:
[26/04/2011 15:28:47] [Error - LuaScriptInterface::loadFile] data/spells/scripts/attack/lifesteal.lua:6: ')' expected near '='
[26/04/2011 15:28:47] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/lifesteal.lua)
[26/04/2011 15:28:47] data/spells/scripts/attack/lifesteal.lua:6: ')' expected near '='

havent change anything, just CTRL + C and CTRL + V...
 
Back
Top