Secure mode to use UE

dewral

Intermediate OT User
Joined
Dec 4, 2019
Messages
211
Solutions
9
Reaction score
108
Hello im using something like this in events to stop players geting skull from AOE damage:

Lua:
function Creature:onTargetCombat(target)
    if hasEventCallback(EVENT_CALLBACK_ONTARGETCOMBAT) then
        return EventCallback(EVENT_CALLBACK_ONTARGETCOMBAT, self, target)
    elseif self:isPlayer() and target:isPlayer() and self:hasSecureMode() then
    return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
    else
target:registerEvent("Vocations")
        return RETURNVALUE_NOERROR
    end
end

It's working as it supposed to be but when im using this my fire fields don't working after stepping im getting this

OTLLAND.png


Lua:
    elseif attacker and self:isPlayer() and target:isPlayer() and self:hasSecureMode() then

    return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
Tried just like that and fields working but now the secure mode isn't working properly and i can damage players from UE.
Any help? :D
 

Roddet

life.rbegin()
Joined
May 1, 2013
Messages
622
Solutions
57
Reaction score
342
Location
MX
Just verify if self exists, on stepping a field 'self' becomes nil if there is no owner/self casted
 
OP
OP
dewral

dewral

Intermediate OT User
Joined
Dec 4, 2019
Messages
211
Solutions
9
Reaction score
108
Just verify if self exists, on stepping a field 'self' becomes nil if there is no owner/self casted
I'm sorry for being dumb but how to do that xD

Lua:
    elseif not self then
    return false
    elseif self:isPlayer() and target:isPlayer() and self:hasSecureMode() then
        return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
I did it like this, seems to work but i have to check everything xD
 

Roddet

life.rbegin()
Joined
May 1, 2013
Messages
622
Solutions
57
Reaction score
342
Location
MX
Lua:
elseif self and self:isPlayer() and target:isPlayer() and self:hasSecureMode() then
;P
 
Solution
Top