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

CreatureEvent [Heart] Frag Reward v1.1

Status
Not open for further replies.

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
The Forgotten Server 0.3.6pl1 - Tested and Working

ownedw.jpg


Code:
[FONT="Palatino Linotype"][B]00:00 You see George's Heart.
It weighs 35.00 oz.
He was killed at level 40 by James who was level 20 at the time. [Unjustified][/B][/FONT]

Code:
[FONT="Palatino Linotype"][B]00:00 You see George's Heart.
It weighs 35.00 oz.
He was killed at level 39 by James who was level 20 at the time. [Justified][/B][/FONT]

data/creaturescripts/scripts/login.lua
PHP:
registerCreatureEvent(cid, "Reward")

data/creaturescripts/creaturescripts.xml
PHP:
<event type="death" name="Reward" event="script" value="reward.lua"/>

data/creaturescripts/scripts/reward.lua
Code:
function onDeath(cid, corpse, deathList)
	if isPlayer(cid) then
		local v = { killer_name = getCreatureName(deathList[1]), killer_level = getPlayerLevel(deathList[1]), target_name = getCreatureName(cid), target_level = getPlayerLevel(cid) }
		local reward = doAddContainerItem(corpse.uid, 5943, 1)
		doItemSetAttribute(reward, "description", "" .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. v.target_level .. " by " .. v.killer_name .. " who was level " .. v.killer_level .. " at the time. " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "[Unjustified]" or "[Justified]"))
		doItemSetAttribute(reward, "name", v.target_name .."'s Heart")
	end
	return true
end

Morgaroth%27s_Heart.gif


Changelog:
  • Added " at line 5.
 
Last edited:
OMG! That's awesome, rep+ for that


going to use it for my server :)


EDIT: You mus spread some reputation ... blabla ...

Will give you rep+ later :)
 
@Up,
Glad to hear :)

Version v1.1 -
 
The [Justified] and [Unjustified] looks a bit weird ... Put it into the text :)

00:00 You see George's Heart.
It weighs 35.00 oz.
He was killed at level 39 by James who was level 20 at the time. It was a justified kill.

or something like that, it's just a suggestion
 
The [Justified] and [Unjustified] looks a bit weird ... Put it into the text :)
or something like that, it's just a suggestion

You can simply do that yourself if you wish.

Code:
This death was " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "[Unjustified]" or "[Justified]"))
 
I got a little request :)

Could you make this script working in a certain area? like a pvp zone
 
I got a little request :)

Could you make this script working in a certain area? like a pvp zone

You could do this; example.

Code:
local arena = {
	from = { x = 100, y = 100, z = 7 },
	to = { x = 100, y = 100, z = 7 }
}
if isInRange(getCreaturePosition(cid), arena.from, arena.to) then
 
Isn't there something missing at the end of this line?

Code:
doItemSetAttribute(reward, "description", "" .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. v.target_level .. " by " .. v.killer_name .. " who was level " .. v.killer_level .. " at the time. " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "[Unjustified]" or "[Justified]"))
 
Lua:
local id = 5943
function onDeath(cid, corpse, deathList)
	local str, n, d = "", getCreatureName(cid), getPlayerIp(cid)
	for i = 1, #deathList do
		if isPlayer(deathList[i]) and deathList[i] ~= cid and not isPlayerExample(deathList[i]) and d ~= getPlayerIp(deathList[i]) then
			str = str .. ((i == #deathList and 1 < #deathList) and " and " or i > 1 and ", " or "") .. getCreatureName(deathList[i])
		end
	end
	local msg = "You received a " .. getItemNameById(id) .. " for killing " .. n
	for i = 1, #deathList do
		if isPlayer(deathList[i]) and deathList[i] ~= cid and not isPlayerExample(deathList[i]) and d ~= getPlayerIp(deathList[i]) then
			doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_BLUE, msg)
			doItemSetAttribute(doPlayerAddItem(deathList[i], id, 1, false), "description", "This is the heart of " .. n .. ", killed by " .. str .. ".")
		end
	end
	return true
end

#cyko
:)
 
Does it work? Looks good.
 
Great script! :) Thanks for leaking. ^^
 
Will it work like that?

Code:
local id = 5943
local arena = {
	from = { x = 100, y = 100, z = 7 },
	to = { x = 100, y = 100, z = 7 }
}
function onDeath(cid, corpse, deathList)
if isInRange(getCreaturePosition(cid), arena.from, arena.to) then
        local str, n, d = "", getCreatureName(cid), getPlayerIp(cid)
        for i = 1, #deathList do
                if isPlayer(deathList[i]) and deathList[i] ~= cid and not isPlayerExample(deathList[i]) and d ~= getPlayerIp(deathList[i]) then
                        str = str .. ((i == #deathList and 1 < #deathList) and " and " or i > 1 and ", " or "") .. getCreatureName(deathList[i])
                end
        end
        local msg = "You received a " .. getItemNameById(id) .. " for killing " .. n
        for i = 1, #deathList do
                if isPlayer(deathList[i]) and deathList[i] ~= cid and not isPlayerExample(deathList[i]) and d ~= getPlayerIp(deathList[i]) then
                        doPlayerSendTextMessage(deathList[i], MESSAGE_STATUS_CONSOLE_BLUE, msg)
                        doItemSetAttribute(doPlayerAddItem(deathList[i], id, 1, false), "description", "This is the heart of " .. n .. ", killed by " .. str .. ".")
                end
        end
        return true
end
 
You'll have to test it, sorry to say, but it isn't my responsibility to test other members scripts. If you want my opinion on it, most likely will not work correctly.
That is why I do not appreciate people posting their versions on my thread, if they would like to post it, make their own thread.
 
Status
Not open for further replies.
Back
Top