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

Solved exhaust in certain area

Going to need more information then that to help you.
however in spells.xml you can change/add
Lua:
exhaustion="5000"
that's for newer version's 0.3.7
I believe 0.3.6 is
Lua:
exhaust="5000"
 
Going to need more information then that to help you.
however in spells.xml you can change/add
Lua:
exhaustion="5000"
that's for newer version's 0.3.7
I believe 0.3.6 is
Lua:
exhaust="5000"

this makes an exhaustion for a spell in the whole server....
i was wondering if it is possible to set an exhaustion on a spell for x area , when you leave that area the spell exhaustion will be set back to normal again
 
To give the vague knowledge I have on this, it would most likely have to be a movement script.

Something like, if move on tile in "this area" if cid says "this spell" cancel/add exhaust 9999
when step out of "this area" set exhaust "this spell" 0

However I have no clue how to script it. :p
 
If it's just for a few spells you could add exhaustion to the lua file of the spell.
Depense on how long you want the exhaustion, but you can use an exhaustion condition like potions have or exhaustion.check/set.
Then you can use inInRange, like this
Lua:
if isInRange(getPlayerPosition(cid), {x = 94, y = 111, z = 7}, {x = 96, y = 113, z = 7}) then
	-- exhaustion for that certain area
else
	-- exhaustion for the rest of your server
end
 
If it's just for a few spells you could add exhaustion to the lua file of the spell.
Depense on how long you want the exhaustion, but you can use an exhaustion condition like potions have or exhaustion.check/set.
Then you can use inInRange, like this
Lua:
if isInRange(getPlayerPosition(cid), {x = 94, y = 111, z = 7}, {x = 96, y = 113, z = 7}) then
	-- exhaustion for that certain area
else
	-- exhaustion for the rest of your server
end

thanks so lets say we try this with eternal winter:

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 6, 12)

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

function onCastSpell(cid, var)
local time = 15
local time2 = 2
if isInRange(getPlayerPosition(cid), {x = 94, y = 111, z = 7}, {x = 96, y = 113, z = 7}) then
make.exhaustion(cid, storage, time) == true) then
else
make.exhaustion(cid, storage, time2) == true) then
return doCombat(cid, combat, var)
end

hmmm nvm im really bad at scripting hahaha anyways here is the clean eternal winter spell:
could you add when players are inside the wanted area they will get an exhaustion of 15 seconds, and when outside 1 second? :)

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 6, 12)

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

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


thanks!
 
Last edited:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 6, 12)

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

local storage = 2278 -- storage for exhaustion

function onCastSpell(cid, var)

	if(exhaustion.check(cid, storage)) then
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
		doPlayerSendCancel(cid, "You are exhausted for "..exhaustion.get(cid, storage).." "..(exhaustion.get(cid, storage) == 1 and "second" or "seconds")..".")
		return false
	end
	if(isInRange(getPlayerPosition(cid), {x = 94, y = 111, z = 7}, {x = 96, y = 113, z = 7})) then
		exhaustion.set(cid, storage, 15)
	end
	return doCombat(cid, combat, var)
end
 
Last edited:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 6, 12)

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

local storage = 2278 -- storage for exhaustion

function onCastSpell(cid, var)

	if exhaustion.check(cid, storage) then
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
		doPlayerSendCancel(cid, "You are exhausted for "..exhaustion.get(cid, storage).." "..(exhaustion.get(cid, storage) == 1 and "second" or "seconds")..".")
		return true
	end
	if isInRange(getPlayerPosition(cid), {x = 94, y = 111, z = 7}, {x = 96, y = 113, z = 7}) then
		exhaustion.set(cid, storage, 15)
	end
	return doCombat(cid, combat, var)
end

thanks, working found just 2 small bugs :)

when spamming exevo gran mas frigo it will be like :

second 1: exevo gran mas frigo normal
second 3: you see message of exevo gran mas frigo, mana will be gone but there is no spell

and when going up on stairs the exhaustion is gone so how to add the exhaustion for floors 0-15 for the same x,y?
 
Should have been false instead of true, edited my post.
And about the range, you can make it as big as you want, also with different floors, so if you want for all floors, instead of 7, 0 and 15.
 
Last edited:
Should have been false instead of true, edited my post.
And about the range, you can make it as big as you want, also with different floors, so if you want for all floors, instead of 7, 0 and 15.

thanks! working perfect. repped u

edit: did it already before to u couldnt do it again :(
 
This is what I changed.
Code:
if exhaustion.check(cid, storage) then
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
	doPlayerSendCancel(cid, "You are exhausted for "..exhaustion.get(cid, storage).." "..(exhaustion.get(cid, storage) == 1 and "second" or "seconds")..".")
	return [COLOR="#FF0000"]false[/COLOR]
end
By using return false in a spell, it won't do the exhaustion and mana cost in the spells.xml line.
 
This is what I changed.
Code:
if exhaustion.check(cid, storage) then
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
	doPlayerSendCancel(cid, "You are exhausted for "..exhaustion.get(cid, storage).." "..(exhaustion.get(cid, storage) == 1 and "second" or "seconds")..".")
	return [COLOR="#FF0000"]false[/COLOR]
end
By using return false in a spell, it won't do the exhaustion and mana cost in the spells.xml line.

just my last question, how to add the delay to spells like :

Lua:
local repeatAmount = 1
 
 
local deathFlamesArea = {
    createCombatArea({
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    }),
    createCombatArea({
        {0, 1, 1, 1, 0},
        {1, 1, 0, 1, 1},
        {1, 0, 2, 0, 1},
        {1, 1, 0, 1, 1},
        {0, 1, 1, 1, 0}
    }),
    createCombatArea({
        {0, 0, 1, 1, 1, 0, 0},
        {0, 1, 0, 0, 0, 1, 0},
        {1, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 2, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 1},
        {0, 1, 0, 0, 0, 1, 0},
        {0, 0, 1, 1, 1, 0, 0}
    })
 
}
 
local bigFlamesArea = createCombatArea({
    {0, 0, 1, 1, 1, 1, 1, 0, 0},
    {0, 1, 1, 0, 0, 0, 1, 1, 0},
    {1, 1, 0, 0, 0, 0, 0, 1, 1},
    {1, 0, 0, 0, 0, 0, 0, 0, 1},
    {1, 0, 0, 0, 2, 0, 0, 0, 1},
    {1, 0, 0, 0, 0, 0, 0, 0, 1},
    {1, 1, 0, 0, 0, 0, 0, 1, 1},
    {0, 1, 1, 0, 0, 0, 1, 1, 0},
    {0, 0, 1, 1, 1, 1, 1, 0, 0}
})
 
local deathFlames = {}
for k, area in ipairs(deathFlamesArea) do
    deathFlames[k] = createCombatObject()
    setCombatParam(deathFlames[k], COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
    setCombatParam(deathFlames[k], COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    setCombatFormula(deathFlames[k], COMBAT_FORMULA_LEVELMAGIC, -0.493, -40, -0.729, -100)
 
    setCombatArea(deathFlames[k], area)
end
 
local bigFlames = createCombatObject()
setCombatParam(bigFlames, COMBAT_PARAM_TYPE, COMBAT_ENERGYLDAMAGE)
setCombatParam(bigFlames, COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS)
setCombatFormula(bigFlames, COMBAT_FORMULA_LEVELMAGIC, -0.766, -50, -0.741, -100)
 
setCombatArea(bigFlames, bigFlamesArea)
 
function onTargetTile(cid, pos)
    doSendDistanceShoot(getCreaturePosition(cid), pos, CONST_ANI_DEATH)
end
setCombatCallback(bigFlames, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
 
local function castSpellDelay(p)
    if(isCreature(p[1]) == TRUE) then
        doCombat(unpack(p))
    end
end


function onCastSpell(cid, var)
    for i = 0, repeatAmount - 1 do
        for k, combat in ipairs(deathFlames) do
            addEvent(castSpellDelay, (150 * k) + #deathFlames * 150 * i + 700 * i, {cid, combat, var})
        end
        addEvent(castSpellDelay, (150 * #deathFlames) + #deathFlames * 150 * i + 700 * i, {cid, bigFlames, var})
    end
 
    return LUA_NO_ERROR
end
 
Last edited by a moderator:
The same way as the other spell.
You only have to add the exhaustion check and the isInRange.
Lua:
	-- so add this the same way, under function onCastSpell, also don't forget local storage
        if(exhaustion.check(cid, storage)) then
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
		doPlayerSendCancel(cid, "You are exhausted for "..exhaustion.get(cid, storage).." "..(exhaustion.get(cid, storage) == 1 and "second" or "seconds")..".")
		return false
	end
	if(isInRange(getPlayerPosition(cid), {x = 94, y = 111, z = 7}, {x = 96, y = 113, z = 7})) then
		exhaustion.set(cid, storage, 15)
	end

Also if you post scripts, use the right tags.
http://otland.net/f16/proper-tagging-168098/
 
Last edited:
Back
Top