• 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!

Help with this spell

narko

vertrauenswürdig ~
Joined
Oct 19, 2008
Messages
1,317
Solutions
2
Reaction score
131
Location
Unknown
PHP:
local combat = createCombatObject()


arr = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function spellCallbackLifeDrainArea(param)
	if (isPlayer(param.cid)) == 1 then
		if (param.hitmin == nil or param.hitmax == nil or param.healmin == nil or param.healmax == nil) then
			param.hitmin = math.floor(-getPlayerLevel(param.cid) * 0.3 + -getPlayerMagLevel(param.cid) * 4.8)
			param.hitmax = math.floor(-getPlayerLevel(param.cid) * 0.35 + -getPlayerMagLevel(param.cid) * 5.8)
			param.healmin = -param.hitmin
			param.healmax = -param.hitmax
		end
		local onPos = param.pos
		if param.count > 0 or math.random(0, 1) == 1 then
			local creatureToHit = getThingfromPos({x=onPos.x,y=onPos.y,z=onPos.z,stackpos=STACKPOS_TOP_CREATURE})
			if isCreature(creatureToHit.uid) == 1 and creatureToHit.uid ~= param.cid then
				doPlayerAddMana(param.cid, math.random(param.healmin, param.healmax+1))
				doAreaCombatHealth(param.cid, COMBAT_LIFEDRAIN, param.pos, 0, param.hitmin, param.hitmax, CONST_ME_BUBBLES)
			end
		end

		if(param.count < 30) then
			param.count = param.count + 1
			addEvent(spellCallbackLifeDrainArea, 500, param)
		end
	end
end

function onTargetTileLifeDrainArea(cid, pos)
	local param = {}
	param.cid = cid
	param.pos = pos
	param.count = 0
	spellCallbackLifeDrainArea(param)
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTileLifeDrainArea")

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end


I need to fix this spell for tfs 0.3.6.

This spell works with 0.2.7

please fix to tfs 0.3.6

i gives REP points
 
mmm, does not work do not know if I can repair the spell would be paid to reputation

and i uses 0.3.6


sorry for my bad english

< b . U . M . P >
 
Last edited by a moderator:
The spell No attacks
plx fix
!!!!!!!!!!!

< b . U . M . P>
 
Last edited by a moderator:
Don't post bumps within 24 hours ok?

Simple, but this might be a fix: Instead of doPlayerAddMana, it should be doCreatureAddMana if you want to make it work with TFS 0.3.6
Lua:
local combat = createCombatObject() 


arr = { 
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, 
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, 
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, 
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, 
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, 
} 

local area = createCombatArea(arr) 
setCombatArea(combat, area) 

function spellCallbackLifeDrainArea(param) 
    if (isPlayer(param.cid)) == 1 then 
        if (param.hitmin == nil or param.hitmax == nil or param.healmin == nil or param.healmax == nil) then 
            param.hitmin = math.floor(-getPlayerLevel(param.cid) * 0.3 + -getPlayerMagLevel(param.cid) * 4.8) 
            param.hitmax = math.floor(-getPlayerLevel(param.cid) * 0.35 + -getPlayerMagLevel(param.cid) * 5.8) 
            param.healmin = -param.hitmin 
            param.healmax = -param.hitmax 
        end 
        local onPos = param.pos 
        if param.count > 0 or math.random(0, 1) == 1 then 
            local creatureToHit = getThingfromPos({x=onPos.x,y=onPos.y,z=onPos.z,stackpos=STACKPOS_TOP_CREATURE}) 
            if isCreature(creatureToHit.uid) == 1 and creatureToHit.uid ~= param.cid then 
                doCreatureAddMana(param.cid, math.random(param.healmin, param.healmax+1)) 
                doAreaCombatHealth(param.cid, COMBAT_LIFEDRAIN, param.pos, 0, param.hitmin, param.hitmax, CONST_ME_BUBBLES)
            end 
        end 

        if(param.count < 30) then 
            param.count = param.count + 1 
            addEvent(spellCallbackLifeDrainArea, 500, param) 
        end 
    end 
end 

function onTargetTileLifeDrainArea(cid, pos) 
    local param = {} 
    param.cid = cid 
    param.pos = pos 
    param.count = 0 
    spellCallbackLifeDrainArea(param) 
end 

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTileLifeDrainArea") 

function onCastSpell(cid, var) 
    return doCombat(cid, combat, var) 
end

And if it still does not work, please give me an error message so I know what to work with, instead of studying the whole code.
 
Read znotes post ffs ''And if it still does not work, please give me an error message so I know what to work with, instead of studying the whole code.''
 
Back
Top