• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

MoveEvent Boss Bailout

Ahh, yeah, you're using an older revision, that's why it doesn't have this function.
You can make it work by removing that whole line, but then again, if you want, you will have to find another way to allow players to access the total amount of gold that has been placed in.
And yes, it is possible to have different bosses each time.
 
It depends on what you mean "each time".
 
So, it's just a list of monsters that will be summoned at a random rate?
 
I can try to add it later today, I'm not at a computer with all my files.
I have rarely used math.random, so I don't exactly know how to implement it.

I learn by example :)
 
gonna eat breakfast and will look into it
 
Summons random monsters now!

- It summons a random monster from a defined array.
- It also announces that monster correctly

Lua:
-- BOSS BAILOUT
-- By: Evan @ otland.net

local goldCoins = {
	[2148] = {worth = 1},
	[2152] = {worth = 100},
	[2160] = {worth = 10000}
}

-- This function was made to remove a creature from the jail (to make it look more realistic) --
function removeCreature()
	for x = 1045, 1051 do
		for y = 1034, 1040 do
			local a = getTopCreature({x=x, y=y, z=9}).uid
			if a ~= 0 and isMonster(a) then
				doRemoveCreature(a)
			end
		end
	end
	return true
end

-- This function is used when the amount of gold is reached --
function doSomething() 
		doCreateMonster(newBoss[randomChance], newBossLocation)
		doBroadcastMessage(releaseMessage, advance)
		setGlobalStorageValue(goldStore, 0)
		doSetItemSpecialDescription(object.uid, "There are 0 gold coins in here.\n"..(targetCount).." more gold coins is needed.")
		removeCreature()
	return true
end

-- Main function --
function onAddItem(moveitem, tileitem, position)
-- YOU CAN CHANGE ANYTHING HERE --
goldStore = 8890 								-- The storage ID of where the amount of gold is stored
pos = {x = 1043, y = 1045, z = 8, stackpos = 2} -- Location of the sign
targetCount = 10500000							-- The amount of gold that is required to doSomething()
newBoss = {'Ghazbaran', 'Demon', 'Orc', 'Warlock'}							-- The boss that will be bailed out
newBossLocation = {x = 1025, y = 1036, z = 7}	-- The location where the boss will be summoned
randomChance = math.random(1, #newBoss)
releaseMessage = "It was a hefty payment, but the " ..(newBoss[randomChance]).. " has been bailed out!" -- The message sent when the boss is bailed out
-- DO NOT CHANGE ANYTHING HERE UNLESS YOU KNOW WHAT YOU'RE DOING --
goldCountStore = getGlobalStorageValue(goldStore)
object = getThingFromPos(pos)
goldWeight = getItemWeight(moveitem.uid) * 10

local v = goldCoins[moveitem.itemid]
	if v then
		doRemoveItem(moveitem.uid)
		doSendMagicEffect(position, 3)
		setGlobalStorageValue(goldStore, goldCountStore + (goldWeight * v.worth))
		doSetItemSpecialDescription(object.uid, "There are " ..(goldCountStore + (goldWeight * v.worth)).. " gold coins in here.\n"..(targetCount - (goldCountStore + (goldWeight * v.worth))).." more gold coins is needed.")
		if ((targetCount - (goldCountStore + (goldWeight * v.worth)))) <= 0 then
			doSomething()
		end
	else
		doRemoveItem(moveitem.uid)
		doSendMagicEffect(position, CONST_ME_POFF)
	end
	return true
end
 
Back
Top