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

help with the creature

cabrera2608

New Member
Joined
Dec 21, 2018
Messages
110
Solutions
1
Reaction score
4
hello friends I have a problem related to monsters I have noticed that on my server the creatures stay in one direction and when they attack you change the address where I can edit that please help.
i use otx
I leave you some examples
creature from my server

creatures on other servers

an apology for the video quality: /
 
data/events/scripts/creature.lua
Lua:
function Creature:onTargetCombat(target)
    local mons = Monster(self)
   
    if mons and target then
        local DIR = Position(mons:getPosition()):getDirectionTo(target:getPosition())
       
        if mons:getDirection() ~= DIR then
            mons:setDirection(DIR)
        end
    end


    return RETURNVALUE_NOERROR
end

Make sure you enable it if its not in events.xml
 
data/events/scripts/creature.lua
Lua:
function Creature:onTargetCombat(target)
    local mons = Monster(self)
  
    if mons and target then
        local DIR = Position(mons:getPosition()):getDirectionTo(target:getPosition())
      
        if mons:getDirection() ~= DIR then
            mons:setDirection(DIR)
        end
    end


    return RETURNVALUE_NOERROR
end

Make sure you enable it if its not in events.xml

thank you very much for answering friend
but I'm using version 2.12 otx could you help me
 
Back
Top