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

Lua Challenge on certain monsters?

sestorme

Member
Joined
Dec 9, 2011
Messages
272
Reaction score
6
Location
Birmingham, UK
Is there any chance to set a challenge spell to work on certain monsters only? And is there a chance to put SPELL on Item function? : function onUse(cid, item, frompos, item2, topos)

Any help greatly appreciated +rep
 
dudeim's script might work if you change all the thing's to thing.uid like this:

Lua:
local challengeMonsters = {
"Demon",
"Rat",
"Bear"
}

function onUse(cid, item, frompos, item2, topos)
local cpos = getCreaturePosition(cid)
local pos = {
[1] = {x=cpos.x-1,    y=cpos.y,    z=cpos.z,    stackpos=253},
[2] = {x=cpos.x-1,    y=cpos.y-1,    z=cpos.z,    stackpos=253},
[3] = {x=cpos.x,    y=cpos.y-1,    z=cpos.z,    stackpos=253},
[4] = {x=cpos.x+1,    y=cpos.y,    z=cpos.z,    stackpos=253},
[5] = {x=cpos.x+1,    y=cpos.y+1,    z=cpos.z,    stackpos=253},
[6] = {x=cpos.x,    y=cpos.y+1,    z=cpos.z,    stackpos=253},
[7] = {x=cpos.x-1,    y=cpos.y+1,    z=cpos.z,    stackpos=253},
[8] = {x=cpos.x+1,    y=cpos.y-1,    z=cpos.z,    stackpos=253}
}
local thing = 0
for i = 1,#pos do
    doSendMagicEffect(pos[i], CONST_ME_MAGIC_RED)
    local thing = getThingFromPos(pos[i])
    if isCreature(thing.uid) then
        if isInArray(challengeMonsters,getCreatureName(thing.uid)) then
            doChallengeCreature(cid, thing.uid)
        end
    end
end
return true
end
I also added a magic effect so you can see where the challenge checks
 
Back
Top