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

boss kill creaturescript

kilirt

New Member
Joined
May 11, 2009
Messages
223
Reaction score
2
hello, i come here because i've a problem with my script, my creaturescript. i hate them

normaly when i kill a boss it must said a message and other but nothing happen and no error in console, i hope you can help me


boss.lua

Lua:
 local config = {
	respawnSecs = 20, -- how many seconds until next boss spawns
	storage = 70200,
	bosspos = {x=17168,y=16606,z=8},
	bossspawnstorage = 70300
}

local t = {'Morgaroth','Ghazbaran','Ferumbras','Orshabaal','Countess Sorrow','Massacre','Fluffy','Dracola','the plasmother','Mr. Punish','The Handmaiden'}

local function f()
	doCreateMonster(t[math.random(#t)], config.bosspos, false, true, true)
	doBroadcastMessage('A new boss has spawned in the boss arena!', MESSAGE_STATUS_CONSOLE_ORANGE)
	doSetStorage(config.bossspawnstorage, 0)
end

function onKill(cid, target, damage, flags)
	if bit.band(flags, 1) == 1 and isMonster(target) and getCreatureMaster(target) == target and getPlayerStorageValue(cid,config.storage) == 1 then
		local s = getCreatureName(target)
		if isInArray(t, s:lower()) and getStorage(config.bossspawnstorage) == 0 then
			doBroadcastMessage(getCreatureName(cid)..' has just killed the boss "'..s..'", a new boss will spawn in '..config.respawnSecs..' seconds!', MESSAGE_STATUS_CONSOLE_ORANGE)
			doSetStorage(config.bossspawnstorage,1)
			addEvent(f, config.respawnSecs*1000)
		end
	end
	return true
end

login.lua:
Lua:
 local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	local a = 0
	local limitAM = 20
	if getCreatureName(cid):lower() == "account manager" then
		for _, pid in ipairs(getPlayersOnline()) do
			if getCreatureName(pid):lower() == "account manager" and pid ~= cid then
				a = a + 1
			end
		end

		if a >= limitAM then
			return false
		end

		return true
	end

	if (getCreatureName(cid) == "Account Manager") then
		return doRemoveCreature(cid, true)
	end

	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

    registerCreatureEvent(cid, "VipCheck")
	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "BossKill")
    registerCreatureEvent(cid, "BossKillvip")
    -- registerCreatureEvent(cid, "pacmanhandle")

	registerCreatureEvent(cid, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end

	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
    registerCreatureEvent(cid, "fatality")
    
	return true
end

creaturescript.xml:
XML:
    <event type="kill" name="BossKill" event="script" value="bosskill.lua"/>
 
I assume this is the script from Masiyah.se?
I think it needs a movement script too, (a teleport, onStepIn() function) that adds a storage to a player.
Here try this:

Step 1: Make a teleport on your map editor and rightclick it, then click properties, then set in the positions the position of your boss arena, and another one inside the boss arena to make you go back.
Step 2: Right click the first teleport (The one that teleports you to boss arena), click properties, then type in actionid "19832", and in the other teleport (The one that teleports you outside of boss arena) do the same and in actionid "19833".
Step 3: Go to "datapack/movements/" and open movements.xml, then add these two lines before the last line:
XML:
	<movevent type="StepIn" actionid="19832" event="script" value="bossarenatp.lua"/>
	<movevent type="StepIn" actionid="19833" event="script" value="bossarenatpout.lua"/>
Step 4: Go to "datapack/movements/scripts", create two new files, name one "bossarenatp.lua" and the other "bossarenatpout.lua".
Step 5: Open "bossarenatp.lua" that you just created, and add in it this:
Lua:
local config = {
tppos = {x=1832,y=489,z=15}, -- WHERE TO TELEPORT TO.
monsterpos = {x=1838,y=499,z=15}, -- WHERE MONSTER TELEPORTS.
maxplayers = 10, -- HOW MANY PLAYERS CAN ENTER.
globalstorage = 50290,
monsterstorage = 50310,
enteredArea = 50300, -- EMPTY PLAYER STORAGE.
exhauststorage = 50340 -- EMPTY PLAYER STORAGE.
}

local monsters = {'Morgaroth','Ghazbaran','Ferumbras','Apocalypse','Madareth','Annihilon','Ferumbras','Bazir','Devovorga','Magic Wizard','Orshabaal','Countess Sorrow','Hellgorak','Latrivan','Massacre','Ushuriel','Zugurosh'}
function onStepIn(cid,item,pos,fromPos)
	if isPlayer(cid) then
		if getPlayerLevel(cid) < 250 then
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'You need to be of Level 250 or higher to enter.')
		else
			local g = math.max(0, getStorage(config.globalstorage)) + 1
			if g > config.maxplayers then
				doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'Too many players are participating already.')
			elseif exhaustion.check(cid,config.exhauststorage) then
				doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'You can\'t enter yet, you\'ll have to wait '..exhaustion.get(cid,config.exhauststorage)..' more seconds.')
			else
				doSetStorage(config.globalstorage, g)
				doCreatureSetStorage(cid,config.enteredArea,1)
				doTeleportThing(cid,config.tppos)
				doSendMagicEffect(config.tppos, CONST_ME_TELEPORT)
				doSendMagicEffect(pos,CONST_ME_POFF)
				if getStorage(config.monsterstorage) < 1 then
					doCreateMonster(monsters[math.random(#monsters)],config.monsterpos)
					doSendMagicEffect(config.monsterpos,CONST_ME_TELEPORT)
					doSetStorage(config.monsterstorage,1)
				end
				return
			end
		end
		doTeleportThing(cid, {x=32199, y=30733, z=7})
		doSendMagicEffect({x=32199, y=30733, z=7}, CONST_ME_TELEPORT)
	end
end

function onAddItem(moveitem, tileitem, pos)
	pos.x = pos.x + 3
	doTeleportThing(moveitem.uid, pos)
	doSendMagicEffect(pos, 12)
end
Step 6: Open "bossarenatpout.lua" that you just created, and add in it this:
Lua:
local config = {
tppos = {x=32199,y=30733,z=7}, -- WHERE TO TELEPORT TO. (SHOULD BE CENTER OF THE ROOM)
maxplayers = 10, -- HOW MANY PLAYERS CAN ENTER.
globalstorage = 50290,
monsterstorage = 50310,
enteredArea = 50300,
from = {x=1826, y=484, z=15}, -- AREA UPPERLEFT CORNER.
to = {x=1850, y=512, z=15}, -- AREA LOWERRIGHT CORNER.
bossspawnstorage = 50320,
exhausttimer = 5, -- EXHAUSTION IN MINUTES.
exhauststorage = 50340
}

local from, to = config.from, config.to

function onStepIn(cid,item,pos,fromPos)
	local v = getThingPos(cid)
	if isPlayer(cid) then
		if getStorage(config.bossspawnstorage) > 0 then
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'Please wait until the next boss is spawned before leaving.')
			doTeleportThing(cid, fromPos, true)
			return true
		end
		exhaustion.set(cid,config.exhauststorage,config.exhausttimer*60)
		local s = math.max(0, getStorage(config.globalstorage) - 1)
		doSetStorage(config.globalstorage, s)
		doBroadcastMessage('['..s..'/'..config.maxplayers..'] people are in boss event now!', MESSAGE_STATUS_CONSOLE_RED)
		doTeleportThing(cid,config.tppos)
		doSendMagicEffect(pos,CONST_ME_POFF)
		doSendMagicEffect(config.tppos,CONST_ME_TELEPORT)
		doCreatureSetStorage(cid,config.enteredArea)
		if s == 0 then
			doSetStorage(config.monsterstorage,0)
			for x = from.x, to.x do
				for y = from.y, to.y do
					local v = getTopCreature({x=x, y=y, z=from.z})
					if v.type == 2 then
						doRemoveCreature(v.uid)
					end
				end
			end
		end
	end
	return true
end
Step 7: Now I want you to read the stuff that is in the script after "--", it's a "tutorial" that will help you setup this script.
Step 8: Give me reputation :p.
 
thank for your attention but i've arealdy configure this other :(
all work the message bossarenatpout and all but only the creaturescript don't work
 
Okay I will try to explain:
The creaturescript is attempting to get the value of a storage in order to broadcast (you changed it to 70200).
This means that you must also do the edits to the movement scripts.
 
it's arealdy done :(

bosskill.lua:

Lua:
local config = {
	respawnSecs = 20, -- how many seconds until next boss spawns
	storage = 70200,
	bosspos = {x=17168,y=16606,z=8},
	bossspawnstorage = 70300
}

local t = {'Morgaroth','Ghazbaran','Ferumbras','Orshabaal','Countess Sorrow','Massacre','Fluffy','Dracola','the plasmother','Mr. Punish','The Handmaiden'}

local function f()
	doCreateMonster(t[math.random(#t)], config.bosspos, false, true, true)
	doBroadcastMessage('A new boss has spawned in the boss arena!', MESSAGE_STATUS_CONSOLE_ORANGE)
	doSetStorage(config.bossspawnstorage, 0)
end

function onKill(cid, target, damage, flags)
	if bit.band(flags, 1) == 1 and isMonster(target) and getCreatureMaster(target) == target and getPlayerStorageValue(cid,config.storage) == 1 then
		local s = getCreatureName(target)
		if isInArray(t, s:lower()) and getStorage(config.bossspawnstorage) == 0 then
			doBroadcastMessage(getCreatureName(cid)..' has just killed the boss "'..s..'", a new boss will spawn in '..config.respawnSecs..' seconds!', MESSAGE_STATUS_CONSOLE_ORANGE)
			doSetStorage(config.bossspawnstorage,1)
			addEvent(f, config.respawnSecs*1000)
		end
	end
	return true
end

bossarenatp:
Lua:
local config = {
tppos = {x=17190,y=16618,z=8}, -- WHERE TO TELEPORT TO.
monsterpos = {x=17168,y=16606,z=8}, -- WHERE MONSTER TELEPORTS.
maxplayers = 10, -- HOW MANY PLAYERS CAN ENTER.
globalstorage = 70000,
monsterstorage = 70100,
enteredArea = 70200, -- EMPTY PLAYER STORAGE.
exhauststorage = 70300 -- EMPTY PLAYER STORAGE.
}

local monsters = {'Morgaroth','Ghazbaran','Ferumbras','Orshabaal','Countess Sorrow','Massacre','Fluffy','Dracola','the plasmother','Mr. Punish','The Handmaiden'}
function onStepIn(cid,item,pos,fromPos)
	if isPlayer(cid) then
		if getPlayerLevel(cid) < 150 then
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'You need to be of Level 150 or higher to enter.')
		else
			local g = math.max(0, getStorage(config.globalstorage)) + 1
			if g > config.maxplayers then
				doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'Too many players are participating already.')
			elseif exhaustion.check(cid,config.exhauststorage) then
				doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'You can\'t enter yet, you\'ll have to wait '..exhaustion.get(cid,config.exhauststorage)..' more seconds.')
			else
				doSetStorage(config.globalstorage, g)
				doCreatureSetStorage(cid,config.enteredArea,1)
				doTeleportThing(cid,config.tppos)
				doSendMagicEffect(config.tppos, CONST_ME_TELEPORT)
				doSendMagicEffect(pos,CONST_ME_POFF)
				if getStorage(config.monsterstorage) < 1 then
					doCreateMonster(monsters[math.random(#monsters)],config.monsterpos)
					doSendMagicEffect(config.monsterpos,CONST_ME_TELEPORT)
					doSetStorage(config.monsterstorage,1)
				end
				return
			end
		end
		doTeleportThing(cid, {x=32345, y=32225, z=7})
		doSendMagicEffect({x=32345, y=32225, z=7}, CONST_ME_TELEPORT)
	end
end

function onAddItem(moveitem, tileitem, pos)
	pos.x = pos.x + 3
	doTeleportThing(moveitem.uid, pos)
	doSendMagicEffect(pos, 12)
end


bossarenatpout:
Lua:
local config = {
tppos = {x=32345,y=32225,z=7}, -- WHERE TO TELEPORT TO. (SHOULD BE CENTER OF THE ROOM)
maxplayers = 10, -- HOW MANY PLAYERS CAN ENTER.
globalstorage = 70000,
monsterstorage = 70100,
enteredArea = 70200,
from = {x=17157, y=16595, z=8}, -- AREA UPPERLEFT CORNER.
to = {x=17198, y=16626, z=8}, -- AREA LOWERRIGHT CORNER.
bossspawnstorage = 70400,
exhausttimer = 5, -- EXHAUSTION IN MINUTES.
exhauststorage = 70300
}

local from, to = config.from, config.to

function onStepIn(cid,item,pos,fromPos)
	local v = getThingPos(cid)
	if isPlayer(cid) then
		if getStorage(config.bossspawnstorage) > 0 then
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'Please wait until the next boss is spawned before leaving.')
			doTeleportThing(cid, fromPos, true)
			return true
		end
		exhaustion.set(cid,config.exhauststorage,config.exhausttimer*60)
		local s = math.max(0, getStorage(config.globalstorage) - 1)
		doSetStorage(config.globalstorage, s)
		doBroadcastMessage('['..s..'/'..config.maxplayers..'] people are in boss event now!', MESSAGE_STATUS_CONSOLE_RED)
		doTeleportThing(cid,config.tppos)
		doSendMagicEffect(pos,CONST_ME_POFF)
		doSendMagicEffect(config.tppos,CONST_ME_TELEPORT)
		doCreatureSetStorage(cid,config.enteredArea)
		if s == 0 then
			doSetStorage(config.monsterstorage,0)
			for x = from.x, to.x do
				for y = from.y, to.y do
					local v = getTopCreature({x=x, y=y, z=from.z})
					if v.type == 2 then
						doRemoveCreature(v.uid)
					end
				end
			end
		end
	end
	return true
end
 
Thank i Try but still not work

Lua:
local config = {
	respawnSecs = 20, -- how many seconds until next boss spawns
	storage = 70200,
	bosspos = {x=17168,y=16606,z=8},
	bossspawnstorage = 70300
}

local t = {'Morgaroth','Ghazbaran','Ferumbras','Orshabaal','Countess Sorrow','Massacre','Fluffy','Dracola','the plasmother','Mr. Punish','The Handmaiden'}

local function f()
	doCreateMonster(t[math.random(#t)], config.bosspos, false, true, true)
	doBroadcastMessage('A new boss has spawned in the boss arena!', MESSAGE_STATUS_CONSOLE_ORANGE)
	doSetStorage(config.bossspawnstorage, 0)
end

function onKill(cid, target, damage, flags)
	if bit.band(flags, 1) == 1 and isMonster(target) and getCreatureMaster(target) == target and getPlayerStorageValue(cid,config.storage) == 1 then
		local s = getCreatureName(target)
		if isInArray(t:lower(), s:lower()) and getStorage(config.bossspawnstorage) == 0 then
			doBroadcastMessage(getCreatureName(cid)..' has just killed the boss "'..s..'", a new boss will spawn in '..config.respawnSecs..' seconds!', MESSAGE_STATUS_CONSOLE_ORANGE)
			doSetStorage(config.bossspawnstorage,1)
			addEvent(f, config.respawnSecs*1000)
		end
	end
	return true
end
 
Well I have problems with the broadcast part... :p

I kill the boss, And nothing happends. I go out and back in to the teleport room. Then there is the boss... So the respawn is working and everything except the broadcast part...
 
Back
Top