• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Request] How to make "Conditions" hit in intervals and exact damages

Narzerus

Full-stack developer and old OT Developer
Joined
Oct 29, 2007
Messages
202
Reaction score
11
This is what I want to do:
I want monsters to be able to cast conditions, (such as FireCondition, EneergyCondition etc...) that hit in exact damage ticks, for example: a monster casts a FireCondition on a player, wich deals -300 damage every 5 seconds for 20 seconds in total.
I was wondering how can I do this?
This is the example of a condition that greendjinns cast:
--------------
<attack name="energycondition" interval="1000" chance="34" range="7" min="-50" max="-90">
<attribute key="shootEffect" value="energy"/>
</attack>
--------------
If you change the min/max damage, and change it to min="-300" max="-300" the spell won't hit -300 in ticks. instead it will hit around -60, and then -59, -58, -57, -56..... and SO on untill it reaches 0. similar to the poison efect.
the same happens to me with all conditions, instead of dealing exact damage, it deals a periodically-reducing damage.
What I want to do is to make them hit in exact periodcial damages, just like fire fields do
 
spells.xml:
Code:
	<instant name="Green Djinn Electrify" words="green djinn electrify" enabled="0" needtarget="1" event="script" value="monster/green djinn electrify.lua"/>
the script:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

local condition = createConditionObject(CONDITION_ENERGY)
setConditionParam(condition, CONDITION_PARAM_DELAYED, true)
setConditionParam(condition, CONDITION_PARAM_FORCEUPDATE, true)
addDamageCondition(condition, 3, 10000, -25)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
usage in monster file:
Code:
	<attack name="Green Djinn Electrify" interval="2000" chance="17" range="7" target="1"/>
 
Thanks a lot Cyko!
But.. theres a little problem, umm the monster casts the spell on himself, and it deals no damage nor any Dot.
I'm using TFS 0.36, does it have anything to do with it?
 
I know this is an old post, veeery old...

But I couldn't find any direct topic to give an answer by this kind of question. Here is the solution!

In data/spells/scripts ---> 'poison serpent.lua'
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 20)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 14)

local poison = createConditionObject(CONDITION_POISON)
addDamageCondition(poison, 10, 2000, -6)
setCombatCondition(combat, poison)

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

In data/spells ---> 'spells.xml'
LUA:
<instant name="Poison Serpent" words="blablabla" casterTargetOrDirection="1" range="1" exhaustion="2000" event="script" value="poison serpent.lua">
</instant>

Finally, in data/monster --->'Serpent.xml'
LUA:
    <attacks>
        <attack name="Poison Serpent" target="1" range="1"/>
    </attacks>

Now this post can die in peace.
 
Back
Top