• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[MONSTER] i request a monster

4Muki4

HOROHOROHORO
Joined
May 1, 2012
Messages
757
Reaction score
72
Im Requesting a monster who attacks only players who got red , black or white skull

Whats reward? rep+++
 
Last edited:
you have to make 2 monsters with the same name.
first one will be passive with one attack/spell what will check is target skulled, if yes this mob will transform to aggresive mob. Second one aggressive,
will have any number of attacks you want + one, very important what will check is target not skulled, if is not he will transfrom back to passive.

so you, or someone on forum have to make for u two mobs and 2 spells.
This will works very good :)

maybe ill make it for you, but dont wait for me, havent much free time for now.
 
you could try some scripts that are in otland of npc's that atack players with skull, just put to the npc the looktype of the monster that you want, and I don't know if that type of npc are atackable, search
 
you could try some scripts that are in otland of npc's that atack players with skull, just put to the npc the looktype of the monster that you want, and I don't know if that type of npc are atackable, search

npc.h
LUA:
		bool isImmune(CombatType_t) const {return true;}
		bool isImmune(ConditionType_t) const {return true;}
 
Alright, I was sure I had an npc like that somewhere in my old ot folder and I did found it, not sure if it will work as I don't remember the version this was created with.

Credits to Lpz

Create a new file inside data/lib and name it guardsystem.lua, then put this inside:
LUA:
Guard = {
        config = {              
                attackspeed = 1000,
        },
        combat = {type = COMBAT_PHYSICALDAMAGE, min = 100, max = 200}
}

function Guard:new()
        local ret = {}
        setmetatable({}, {__index = self.combat})
        setmetatable(ret, {__index = self})
        return ret
end

function Guard:reset()
        self.config = Guard.config
        self.target = 0
        selfFollow(0)
        doSteerCreature(self.id, self.position)
end
        

function Guard:updateTarget()
        if self.target ~= 0 then
                return
        end
        
        local creatures = getSpectators(getThingPosition(self.id), self.range, self.range, false)
        for i = 1, #creatures do
                local target = creatures[i]
                if isCreature(target) and not isNpc(target) and getCreatureSkull(target) >= 3 then
                        if not getTilePzInfo(getThingPosition(target)) then
                                if selfFollow(target) then
                                        selfSay("I don't tolerate people like you, ".. getCreatureName(target))
                                        self.target = target
                                        self:attack()
                                        break
                                end
                        end
                else
                        self:reset()
                end
        end
end

function Guard:attack()
        if self.target == 0 then
                self:reset()
                return
        end
        
        self.time = self.time or os.clock()
        if self.time < os.clock() then
                if getDistanceBetween(getThingPosition(self.id), getThingPosition(self.target)) == 1 then
                        doTargetCombatHealth(self.id, self.target, self.combat.type, -self.combat.min, -self.combat.max, CONST_ME_DRAWBLOOD)
                end
                self.time = self.time + (self.config.attackspeed/1000)
        end
end

Now, create a file in data/npc and name it guard.xml, then putthis inside:
LUA:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Guard" script="guard.lua" walkinterval="0" speed="200" floorchange="0">
        <health now="100" max="100"/>
        <look type="134" head="57" body="59" legs="40" feet="76" addons="0"/>
        <parameters/>
</npc>

Now in data/npc/scripts create a file named guard.lua and put this inside:
LUA:
local guard = Guard:new()

function onCreatureAppear(cid)
        if cid == getNpcId() then
                guard.id = getNpcId()
                guard.target = 0
                guard.position = getNpcPos()
        end
end

function onCreatureDisappear(cid)
        if cid == guard.target then
                guard:reset()
        end
end

function onCreatureSay(cid, type, msg)
        return false
end

function onThink()
        guard:updateTarget()
        if guard.target ~= 0 then
                if isCreature(guard.target) then
                        guard:attack()
                else
                        guard:reset()
                end
        else
                guard:reset()
        end
end

I think it was made for 0.3.6pl1... not sure.

Hope it helps.

Credits to Lpz.
 
Thanks all is working only 1 thing
its dont attack here screens:

First no bugs
6f1820.jpg


But after the "Guard" see a pker starts bug like this
335gm12.jpg


Please help
 
I thought it was functional, I'm not at home now so I can't do anything, when I get home I'll try to see what's wrong, gonna have to wait till night :/ sorry

Might be the version... doSteerCreature i think was added only on 0.4 not sure tho, again that was in my old ot folder and I did not create it, now I try to create my own things so I don't have those problems, but it's hard.
I can't do a deep research about it now, but try to find in wich distro the doSteerCreature was created... and if it is possible to implement it on older versions.
 
Last edited:
Back
Top