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

Need move lever only when monster is dead

Zakhran

Pace
Joined
May 7, 2012
Messages
252
Reaction score
6
Location
Detroit, Michigan
Hi all, i've been using a creatureevent that when you kill x boss or monster, you can pass to the rewards room through a switch, but i have too many issues with that script, i need a script that:
-When you kill a monster, you can pass through a lever, but ALL players that kills the monster can pass (not only the corpse owner), or when the monster isn't the room.

I really need it, thanks.
 
You could use the onKill event and check if target is a monster and in a certain area -- and then set a global storage value that you use to check if the lever can be pulled in another action.

Example:
Lua:
local monster = "" -- name of the monster
local storage = 1475 -- global storage value used to know that lever is available
local area = { -- frompos: upper left corner -- topos: right bottom corner
	[1] = {frompos={x=1000,y=1000,z=7}, topos={x=1001,y=1001,z=7}}--,
	-- can add more positions where this applies to our condition
	-- [2] = {frompos={x=1000,y=1000,z=7}, topos={x=1001,y=1001,z=7}},
	-- [3] = {frompos={x=1000,y=1000,z=7}, topos={x=1001,y=1001,z=7}}
}

function onKill(cid, target, lastHit)
	if isMonster(target) and string.lower(getCreatureName(target)) == string.lower(monster) then
		for i, pos in pairs(area) do
			if isInRange(getThingPos(target), pos.frompos, pos.topos) then
				setGlobalStorageValue(storage, 1) -- set global to 1
				addEvent(setGlobalStorageValue, 60000, storage, 0) -- reset in 60 secs
			end
		end
	end
	
	return true
end
 
Back
Top