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

onPrepareDeath ?

d4rkbl0od

Member
Joined
Mar 21, 2008
Messages
160
Reaction score
7
Hello, I was trying to make a creaturescript that looks like this:

When you are killed by X monster,
* this monster is removed
* stopEvent(xxx)
* setGlobalStorageValue(3275,0)

but I isnt working :X

Anyone have an idea??

LUA:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)


   if lastHitKiller == "Mooh'Tha Master" then
   setGlobalStorageValue(3275,0)
   doRemoveCreature(lastHitKiller.uid)
   doCreatureSay(cid, "ASDASDASDAS.", TALKTYPE_ORANGE_1, false, 0, getPlayerPosition(cid))
	
   end
    return true
end
 
Well, many of the onKill functions could be done into 1 script, but I did them separately,
An example:
LUA:
if lastHit and isMonster(target) and getCreatureName(target) == 'Diseased Fred'  then
It's very strange for them beeing in conflict, but I will test it later then, disabling the other creaturescripts...
 
Bumppp!
There is no creatureevents in conflict ;x

It shows in my console Mooh'Tah Master...
LUA:
 for _, pid in ipairs(deathList) do
                if isCreature(pid) == true then
				return doBroadcastMessage("" .. getCreatureName(pid) .. "")
 
Something like this?
LUA:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if lastHitKiller.name == "Mooh'Tah Master" then
	doBroadcastMessage("AAAAA")
	end
	return true
end
 
Bumppp!
There is no creatureevents in conflict ;x

It shows in my console Mooh'Tah Master...
LUA:
 for _, pid in ipairs(deathList) do
                if isCreature(pid) == true then
				return doBroadcastMessage("" .. getCreatureName(pid) .. "")

did that code broadcasted the correct name?
 
Yes, I it broadcasted Mooh'Tah Master
As this shit isn't working, i'm thinking of making an ondeath function that checks if the player position is in the arena (fromx, from y... etc,of the Mooh'Tah Master) and if it is, then do the action.. What you think? Too bad? =/


Ediit- Look what I did... It worked... but its a little.. huum.. uggly?

LUA:
function onDeath(cid, deathList)
	if (getPlayerPosition(cid).x >= 33149 or getPlayerPosition(cid).x <= 33159) and (getPlayerPosition(cid).y >= 31412 or getPlayerPosition(cid).y <= 31420) and getPlayerPosition(cid).z == 7 then
	return doRemoveCreature(getCreatureByName("Mooh'Tah Master")) and setGlobalStorageValue(3275,0) and stopEvent(Moohtha) and doBroadcastMessage("okay!")
end
end
 
Last edited:
LUA:
function onPrepareDeath(cid, deathList)
	for _, pid in ipairs(deathList) do
		if isCreature(pid) and (getCreaturename(pid):lower() == 'mooh\'tah master') then
			setGlobalStorageValue(3275, 0)
			doRemoveCreature(pid)
			doCreatureSay(cid, "ASDASDASDAS.", TALKTYPE_ORANGE_1, false, 0, getPlayerPosition(cid))
		end
	end
	return true
end

This?
 
Well, I used the onDeath function,
LUA:
 function onDeath(cid,deathList)
Then I got that message in console using

LUA:
  for _, pid in ipairs(deathList) do
                if isCreature(pid) == true then
				return doBroadcastMessage("" .. getCreatureName(pid) .. "")
But the problem was that I couldn't remove the creature :(
 
Back
Top