• 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] Spells aren't being casted in the corret direction.

darkshin

New old member
Joined
Dec 14, 2010
Messages
231
Reaction score
21
Hey Guys!

As title says, It always calls south, even if it area was declared north.
I am using the tag direction="1" at spells.xml. This is the spell file, like a exori min.
Code:
AREA_FRONT3 = {
{1, 1, 1},
{0, 3, 0}
}

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_USECHARGES, 1)
combat:setArea(createCombatArea(AREA_FRONT3))

function onGetFormulaValues(player, skill, attack, factor)
    local skillTotal = skill * attack
    local levelTotal = player:getLevel() / 5
    return -(((skillTotal * 0.04) + 31) + (levelTotal)), -(((skillTotal * 0.08) + 45) + (levelTotal))
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)

    return combat:execute(creature, var)
end

This is my create combat area function
Code:
int LuaScriptInterface::luaCreateCombatArea(lua_State* L)
{
    //createCombatArea( {area}, <optional> {extArea} )
    ScriptEnvironment* env = getScriptEnv();
    if (env->getScriptId() != EVENT_ID_LOADING) {
        reportErrorFunc("This function can only be used while loading the script.");
        pushBoolean(L, false);
        return 1;
    }

    uint32_t areaId = g_luaEnvironment.createAreaObject(env->getScriptInterface());
    AreaCombat* area = g_luaEnvironment.getAreaObject(areaId);

    int parameters = lua_gettop(L);
    if (parameters >= 2) {
        uint32_t rowsExtArea;
        std::list<uint32_t> listExtArea;
        if (!getArea(L, listExtArea, rowsExtArea)) {
            reportErrorFunc("Invalid extended area table.");
            pushBoolean(L, false);
            return 1;
        }
        area->setupExtArea(listExtArea, rowsExtArea);
    }

    uint32_t rowsArea = 0;
    std::list<uint32_t> listArea;
    if (!getArea(L, listArea, rowsArea)) {
        reportErrorFunc("Invalid area table.");
        pushBoolean(L, false);
        return 1;
    }

    area->setupArea(listArea, rowsArea);
    lua_pushnumber(L, areaId);
    return 1;
}

By the way I am using TFS 1.2

Does anyone knows why its not casting at the correct direction?
 
try changing
AREA_FRONT3 = {
{1, 1, 1},
{0, 3, 0}
}

to
AREA_FRONT3 = {
{1, 1, 1},
{0, 2, 0}
}

idk m8
 
Back
Top