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

finalize event (kill all monster of some type)

lamartides

New Member
Joined
Oct 29, 2009
Messages
3
Reaction score
0
Hello everybody,

I have event with some singlespawn, but some times i need finalize event premature . So, i need kill all monsters of some type, ex: slime.

i am very newbie in Lua script, but i think need get array of monsters, for search by name, and execute doCreatureAddHealth.

can somebody please give me tip how make it ?
 
i try make loop with "while" and "getCreatureByName"

Code:
local name = MOSTER NAME
while (getCreatureByName(name) ~= nil) do
  doCreatureAddHealth(getCreatureByName(name),-100000)
end

but not work, because, when monster died, getCreatureByName always return nil.

i have sure about these, because simples test

Code:
local monsterid1 = getCreatureByName(name)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "->" .. monsterid1)
doCreatureAddHealth(getCreatureByName(name),-100000)
local monsterid2 = getCreatureByName(name)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "->" .. monsterid2)

after kill, i dont have new cid from getCreatureByName, and i no ideia why. Anybody can help me ?



<sorry my bad english>
 
i solved problem change doCreatureAddHealth for doRemoveCreature, but i need corpse stay on ground after kill, using doRemoveCreature, creature vanished for all

any ideias ?
 
Back
Top