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

[TFS 1.2] Repeating spell changes direction when player moves

Homeslice

-anoyn/Rage the Mage
Joined
May 9, 2010
Messages
112
Solutions
2
Reaction score
65
Location
Canada
explosivereaction.gif


I'm trying to make the spell not change directions when the player moves left. The spell does not move along with the caster, it just changes directions.

Here is what I'm using:

This is the area in use
Code:
    {
        {0, 0, 0, 1, 0, 0, 0},
        {0, 0, 0, 1, 0, 0, 0},
        {0, 0, 0, 1, 0, 0, 0},
        {0, 0, 0, 2, 0, 0, 0},
        {0, 0, 0, 1, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
    },

Combat:
Lua:
    combatEffects_explosiveReaction[i] = Combat()
    combatEffects_explosiveReaction[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    combatEffects_explosiveReaction[i]:setArea(createCombatArea(AREA_SQUARE3X3_EXPLOSIVE_REACTIONS[i]))
    combatEffects_explosiveReaction[i]:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)

Spells.xml
Lua:
    <instant group="attack" spellid="172" name="Explosive Reaction" words="explosive reaction" lvl="1" mana="10" prem="1" selftarget="0" direction="0" cooldown="1000" groupcooldown="4000" needlearn="0" script="custom/explosive_reaction.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>

Is there a way to fix this while still using Combat()?

I'd prefer not to use position:sendMagicEffect(), since I don't know a efficient way to check if there is a wall blocking between the effect and caster.
 
Well, locking their position would stop it from changing directions. But I don't want the spell to lock players for ~5 seconds.



All my combat areas look like this:
Lua:
    {
        {0, 0, 0, 1, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 2, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
    },
Where there is only 1 square effected.

Even though the 1 is at the top, the combat area is always below the player.

This is how I'm using it:
aiVm8Ju.gif
 
Are you using addEvent to cast effects multiple times? Make sure the variant is uppdated correctly or it will use your origional position.
 
This fire "Explosive reaction" spell looks awesome, mind to share the code? :O

Not sharing soon but
Made an array small combats, made array of indexes for combats. Every event executes X (1 in above gif) combats and removes ran combat indexes from the array of indexes. Once the array of indexes is empty, check how many times I want to repeat spell. if still repeating refill the array of indexes

Are you using addEvent to cast effects multiple times? Make sure the variant is uppdated correctly or it will use your origional position.
Editing the variant position will break functionality of not letting spells go through walls between player and effect

set self target in spells.xml to 1
selfTarget of 1 just makes the spell follow the player, the direction issue still exists.
 
The issue with the spell always being below me was just me forgetting to add more areas.

Spell changing direction seems to just be a bug with Combat()

Afaik the only solution is not use Combat() at all.

Checking if spell can reach area (not past walls):
pos:isSightClear(pos2) and (is walkable tile or tile top player~= nil)

Creating effect with:
sendMagicEffect(

Damaging target with:
doTargetCombatHealth(

Which seems pretty inefficient
 
i know this wont solve the issue but maybe just use an area in which you cant notice the spell direction like instead of a tringle use a diamond shape, but still is a nice looking spell
 
Back
Top