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

Monster script..

Believer

Aashora.net
Joined
Aug 26, 2010
Messages
423
Reaction score
7
Location
Far away from home.
Hello,

I've been trying to script a monster remove script at specific time but didnt go so well so i will request it & hope you can help me out!:)

The script is supposed to remove monstername that are configured in the script at 06:00.

<globalevent name="removemonster" time="06:00" event="script" value="removemonster.lua"/>

Now to the script include:

It will check if etc "demodras", "orshabaal" or "ferumbras" are spawned at 06.00.. (though i'm supposed to add several monster names in this script) & if they are spawned it will remove them like "/r" command by gm but instead in a script. & if there arent any monsters spawned then it will do nothing.

Thanks!, hope you can help me. rep++ for help!
 
Lua:
function onTimer()
	if doRemoveCreature("Demodras") or doRemoveCreature("Orshabaal") or doRemoveCreature("Ferumbras") == true then
		doBroadcastMessage("The land has been rid of the foul monsters that have been hunting you")
	end
	return true
end
Definetly not tested.
 
Yeah it works IF it removes creature it will broadcast.. but i can't see where in this code it does remove the boss?

also i got this error:
[22:1:00.234] [Error - GlobalEvent Interface]
[22:1:00.234] data/globalevents/scripts/raidremove.lua:eek:nTime
[22:1:00.234] Description:
[22:1:00.234] (luaDoRemoveCreature) Creature not found

i edited onTimer to onTime though.

Here is an example on how i want the script to work :p

Lua:
function onTime()
	if doDetectCreature("Demodras") or doDetectCreature("Orshabaal") or doDetectCreature("ferumbras") == true then
	doRemoveDetectedCreatures
	doBroadcastMessage("The land has been rid of the foul monsters that have been hunting you")
	end
	return true
end
 
Last edited:
You would have to check all map, each tile, and if there are monsters found with these names then remove those monsters.
Something like this probably:
Lua:
local monsters = {"Demodras", "Orshabaal", "Ferumbras"}
function onThink(cid, interval)
for x = fromX, toX do
    for y = fromY, toY do
        for z = fromZ, toZ do
            v = getTopCreature({x=x,y=y,z=z})
            if isMonster(v) then
               if isInArray(monsters,getCreatureName(v)) then
                  doRemoveCreature(v)
               end
            end
        end
    end
end
 
You would have to check all map, each tile, and if there are monsters found with these names then remove those monsters.
Something like this probably:
Lua:
local monsters = {"Demodras", "Orshabaal", "Ferumbras"}
function onThink(cid, interval)
for x = fromX, toX do
    for y = fromY, toY do
        for z = fromZ, toZ do
            v = getTopCreature({x=x,y=y,z=z})
            if isMonster(v) then
               if isInArray(monsters,getCreatureName(v)) then
                  doRemoveCreature(v)
               end
            end
        end
    end
end

SHouldnt it be function onTime() instead of function onThink(cid, interval) since i will add specific time in .xml?

EDIT:

error:
[11:34:54.561] [Error - GlobalEvent Interface]
[11:34:54.561] data/globalevents/scripts/raidremove.lua:eek:nThink
[11:34:54.561] Description:
[11:34:54.561] data/globalevents/scripts/raidremove.lua:3: 'for' initial value must be a number
[11:34:54.561] stack traceback:
[11:34:54.561] data/globalevents/scripts/raidremove.lua:3: in function <data/globalevents/scripts/raidremove.lua:2>
[11:34:54.561] [Error - GlobalEvents::think] Couldn't execute event: raidsclean
 
Last edited:
You would have to check all map, each tile, and if there are monsters found with these names then remove those monsters.
Something like this probably:
Lua:
local monsters = {"Demodras", "Orshabaal", "Ferumbras"}
function onThink(cid, interval)
for x = fromX, toX do
    for y = fromY, toY do
        for z = fromZ, toZ do
            v = getTopCreature({x=x,y=y,z=z})
            if isMonster(v) then
               if isInArray(monsters,getCreatureName(v)) then
                  doRemoveCreature(v)
               end
            end
        end
    end
end
you never heard of getCreatureByName?
 
you never heard of getCreatureByName?

So...

Lua:
local monsters = {"Demodras", "Orshabaal", "Ferumbras"}
function onThink(cid, interval)
for x = fromX, toX do
    for y = fromY, toY do
        for z = fromZ, toZ do
            v = getTopCreature({x=x,y=y,z=z})
            if isMonster(v) then
               if isInArray(monsters,getCreatureByName(v)) then
                  doRemoveCreature(v)
               end
            end
        end
    end
end

Will this work?

EDIT:

tested it and it didnt work gaved me same error..
 
Last edited:
don't know what happens if there's a player called like that, who has the priority:p
Lua:
local monsters = {'Demodras', 'Orshabaal', 'Ferumbras'}

function onThink(interval)
	for i = 1, #monsters do
		local m = getCreatureByName(monsters[i])
		if m then
			doRemoveCreature(m)
		end
	end

	return true
end
 
Back
Top Bottom