• 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 Help] How do instants decide direction?

Drakkhan

Illuria Project Lead
Joined
Oct 3, 2013
Messages
141
Reaction score
22
In "fire wave.lua" the code is:

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.8, 0, -1.3, 0)

local area = createCombatArea(AREA_WAVE4, AREADIAGONAL_WAVE4)
setCombatArea(combat, area)

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

Somewhere in there, the direction the player is facing is determined so the wave goes in the direction. Is it in the combat area? or in the line "return doCombat(cid, combat, var)"? How does the code decide to check the direction the player is facing as opposed to just firing north all the time?

Regards,

Drakkhan
 
Looks like the assumption is that any instant spell with an area without a target will shoot in the direction that the player is facing. You would need additional functions to make it do something else, rather than the other way around.
I'm not 100% sure on that though!
 
Turns out I didn't give you the full story pal. My solution to this question:

items.xml has:
Code:
<instant group="attack" spellid="19" name="Fire Wave" words="exevo flam hur" lvl="18" mana="25" direction="1" cooldown="4000" groupcooldown="2000" needlearn="0" script="attack/fire wave.lua">

Note the "direction="1" tag! :D.
 
Have you tried changing the direction number?
My theory is that the direction="1" is actually just letting us know that yes, direction does matter (1 = true) and that if direction matters, we are always talking about the direction the player is facing.
I'd be interested to know what happens if you change that number to 2, 3, 4 etc.
 
It's a boolean tag. 1 is direction player is facing, 0 is always in the direction indicated by the area.

I tested it and 2, 3, 4, etc. fix the area. Important note. The standard area format in spells is flipped vertically from how it will show if you don't have directional on.

This:

{
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 3, 0, 0, 0}
}

will produce a cone facing south without directional on.
 
Last edited:
Back
Top