• 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 Frag reward

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,984
Solutions
2
Reaction score
119
Location
Germany
GitHub
Shawak
create in..
data/creaturescripts/sctipts/reward.lua
PHP:
-- Credits to Shawak
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
	local cidpos = getPlayerPosition(lastHitKiller)
	loot = 5943
	item = doPlayerAddItem(lastHitKiller,loot,1)
	if(isPlayer(lastHitKiller) == TRUE) then
		hitKillerName = getPlayerName(lastHitKiller)
		doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..hitKillerName..".")
		doPlayerSendTextMessage(lastHitKiller, MESSAGE_STATUS_CONSOLE_ORANGE, "You Killed " .. getCreatureName(cid) .. ".")
		doSendMagicEffect(cidpos,12)
	else
		hitKillerName = getCreatureName(lastHitKiller)
		doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by a "..hitKillerName..".")
	end
	setItemName(item, ""..getPlayerName(cid).."\'s Heart")
	return TRUE
end
add in..
data/creaturescripts/creatuescripts.xml
PHP:
	<event type="death" name="Reward" script="reward.lua"/>
add in..
data/creaturescripts/sctipts/login.lua
PHP:
	registerCreatureEvent(cid, "Reward")

I hope it will usefull :D
 
Last edited:
<event type="preparedeath" name="Reward" script="arenawar.lua"/>

should be


<event type="preparedeath" name="Reward" script="reward.lua"/>




wrong lua file




but nice script :) can you make it so it shows the lvl of the killer too?
 
i get this error when i try to load it:

[13/02/2009 17:06:15] Warning: [Event::loadScript] Event onPrepareDeath not found. data/creaturescripts/scripts/reward.lua
 
#topic:
Change function to
PHP:
function onPrepareDeath(cid, killer)
or xml part change to
PHP:
<event type="death" name="Reward" script="reward.lua"/>
 
why doesn't : work?


PHP:
-- Credits to Shawak
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
    local cidpos = getPlayerPosition(lastHitKiller)
    loot = 2229
    item = doPlayerAddItem(lastHitKiller,loot,1)
    if(isPlayer(lastHitKiller) == TRUE) then
        hitKillerName = getPlayerName(lastHitKiller)
        doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..hitKillerName..".")
        doPlayerSendTextMessage(lastHitKiller, MESSAGE_STATUS_CONSOLE_ORANGE, "You Killed " .. getCreatureName(cid) .. ".")
        doSendMagicEffect(cidpos,12)
    else
        hitKillerName = getCreatureName(lastHitKiller)
        hitKillerLevel = getPlayerLevel(lastHitKiller)
        doSetItemSpecialDescription(item,"This is the skull of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..hitKillerName.." at Level.")
    end
    setItemName(item, ""..getPlayerName(cid).."\'s Skull")
    return TRUE
end
 
Thank you so much. Works on tfs 0.3.2 with onPreparedeath.
00:21 You see the Lolatyou's Heart.
It weighs 35.00 oz.
This is the heart of Lolatyou killed at Level 27 by Mista Twista.
 
Hello!
I found a little bug...

EXAMPLE:
-Im player X, i use fire bomb rune on ground, and after that i die (ex. by demon)
-Im Player Y im die by fire bomb rune player X, So player X can't get frag reward, so where is this? on my dead human... (lol...)

After that on console i read this error:
2n0k4yv.jpg


Please FIX that!
 
Hello!
I found a little bug =P

example:

[01/09/2009 16:12:46] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/login.lua)
[01/09/2009 16:12:46] data/creaturescripts/scripts/login.lua:44: 'end' expected (to close 'function' at line 5) near '<eof>'


help me plx ^^
 
Hello!
I found a little bug =P

example:

[01/09/2009 16:12:46] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/login.lua)
[01/09/2009 16:12:46] data/creaturescripts/scripts/login.lua:44: 'end' expected (to close 'function' at line 5) near '<eof>'


help me plx ^^

This ins't a bug of the script, but I can help you,
go to your login.lua and put an "end" at the end :thumbup:.
 
If i kill some1 i got a error in console and theres no rewards ;S
Check this out
Please help :S
 

Attachments

I have the same problem as arheon...
I'm using the server alissow 8.50

plx help
 
Back
Top