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

Target Square

RigBy

Member
Joined
Jun 9, 2015
Messages
44
Solutions
1
Reaction score
6
#edit
I managed to get it to work :), but now the problem is that I can't remove the red square when the player stops attacking :(

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)

function sendTarget(cid, target)
    local msg = NetworkMessage()
    msg:addByte(0x93)
    msg:addU32(target)
    msg:addByte(0x02)
    msg:addByte(180)
    msg:sendToPlayer(cid)
end

function onCastSpell(creature, var)

    
    local playerPos = creature:getPosition()
    local target = creature:getTarget()
    local targetPos = target:getPosition()


    
    local path = target:getPathTo(playerPos, 0, 1, true, true, 100)
    target:say("TAUNT", TALKTYPE_MONSTER_SAY)
    target:setTarget(creature)
    sendTarget(target:getId(), creature:getId())
    for i = 1, #path do
        addEvent(function()
        if path ~= nil then
            doMoveCreature(target, path[i])
        end
        end, 250 * i)   
    end
    
    print(#path)
    return combat:execute(creature, var)
end
Post automatically merged:

I have the sendCreatureSquare function in my server's source, but I don't know how to make just whoever is attacking see and mark who is being targeted.
 
Last edited:
Up
Post automatically merged:

Lua:
int LuaScriptInterface::luaCreatureSetTarget(lua_State* L)
{
    // creature:setTarget(target)
    Creature* creature = getUserdata<Creature>(L, 1);
    if (creature) {
        Creature* target = getCreature(L, 2);
        pushBoolean(L, creature->setAttackedCreature(target));
    } else {
        lua_pushnil(L);
    }
    return 1;
}[/CÓDIGO]

is there any way I can change this so that I created the red square.
 
Last edited:
I can do remove the red square through the script, but I wanted the player, if he wants, to remove it manually by pressing on another target or by pressing ESC.
 
is there any way to make this function create the target?

Lua:
local function sendCancelTarget(player)
    local msg = NetworkMessage()
    msg:addByte(0xA3)
    msg:addU32(0x00)
    msg:sendToPlayer(player)
    msg:delete()
end

I thought I would change the 0x00 to end 1 or 2 to see if it worked but nothing :/
 
Back
Top