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

Good idea & request: !bosshp talkaction.

breadmaker

New Member
Joined
Jul 16, 2010
Messages
160
Reaction score
3
Hello.
I have good idea for make helpfull talkaction.
If player say !bosshp, the script check if any boss is spawned on map example:
local = "Orshaabal" , "Nexious Spawn".
If the bosses are spawned on map and player say !bosshp, the player will see in console:
example.
Orshaabal - 100000 HP
Nexious Spawn - 40000 HP
If we attacking the bosses the hp will decrease and it will be show in !bosshp too, example:
Orshaabal - 10000 / 100000 HP
Nexious Spawn - 9394 / 40000 HP

If locals not found on map (bosses), player see in console:
No bosses on the map right now.

Now the players can view how many HP bosses have and how many hp left :)

Anyone can make that command ? :thumbup:
 
Rep me :D
Just add the names of the boss like you see it in the code. You can either write !bosshp and it will show information for all bosses or for example !bosshp orshabaal and it will show for orsha

Just 1 thing more to config: showifnot = false
If a monster which is in the bosses list is not on the map then it won't be displayed in the list. If you set it to true it will be shown in the list but marked as "Not spawned."...
IMPORTANT: If more than 1 boss of each type are in the map it will only show info for the first spawned.

Code:
<talkaction  words="!bosshp"  event="script" value="bosshp.lua"/>
Code:
local bosses, low = {
	"Orshabaal",
	"Demodras",
	"Razor",
	"Blacksmith"
}, {}

for b = 1, #bosses do
	table.insert(low, b, bosses[b]:lower())
end


local showifnot = false

function onSay(cid, words, param, channel)
	local boss, str, d = {}, "Show boss hp:\n\n", "Show boss hp:\n\n"
	if isInArray(low, param:lower()) and param ~= "" then
		boss[param:sub(1,1):upper()..param:sub(2,param:len()):lower()] = (getCreatureByName(param) and getCreatureByName(param) or 0)
		showifnot = true
	elseif param == "" then
		for i, name in pairs(bosses) do
			boss[name] = (getCreatureByName(name) and getCreatureByName(name) or 0)
		end
	else
		return doShowTextDialog(cid, getItemIdByName('Parchment'), string.format("%s is not registered as a boss.\n\nTry:\n", param)..table.concat(bosses, "\n"))
	end
	
	for name, uid in pairs(boss) do
		str = str .. ((uid == 0 and showifnot or uid > 0) and name .. ":\n" .. (uid ~= 0 and (getCreatureHealth(uid).."/"..getCreatureMaxHealth(uid) .. (getCreatureHealth(uid) == getCreatureMaxHealth(uid) and " Full" or "") .." Health") or "Not spawned.") .. "\n\n" or "")
	end
	if str == d then str = str .. "No bosses are spawned right now." end
	doShowTextDialog(cid, getItemIdByName('Parchment'), str)
	return true
end
 
Here..
Code:
local bosses, low = {
	"Orshabaal",
	"Demodras",
	"Razor",
	"Blacksmith"
}, {}

for b = 1, #bosses do
	table.insert(low, b, bosses[b]:lower())
end


local showifnot = false

function onSay(cid, words, param, channel)
	local boss, str, d = {}, "Show boss hp:\n\n", "Show boss hp:\n\n"
	if isInArray(low, param:lower()) and param ~= "" then
		boss[param:sub(1,1):upper()..param:sub(2,param:len()):lower()] = (getCreatureByName(param) and getCreatureByName(param) or 0)
		showifnot = true
	elseif param == "" then
		for i, name in pairs(bosses) do
			boss[name] = (getCreatureByName(name) and getCreatureByName(name) or 0)
		end
	else
		return doShowTextDialog(cid, getItemIdByName('Parchment'), string.format("%s is not registered as a boss.\n\nTry:\n", param)..table.concat(bosses, "\n"))
	end
	
	for name, uid in pairs(boss) do
		str = str .. ((uid == 0 and showifnot or uid > 0) and name .. ":\n" .. (uid ~= 0 and (getCreatureHealth(uid).."/"..getCreatureMaxHealth(uid) .. (getCreatureHealth(uid) == getCreatureMaxHealth(uid) and " Full" or "") .." Health") or "Not spawned.") .. "\n\n" or "")
	end
	if str == d then str = str .. "No bosses are spawned right now." end
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
	return true
end
 
Back
Top