Hello!
I have an error when I try to use a script.
I run my server off TFS Version 0.2.3 (Mystic Spirit)
The code below is saved as broadcastSingleMonsterKilled.lua in the target location creaturescripts\scripts\
I have also added the appropriate text in creaturescripts.xml:
I am not positive if I need it in the login.lua, but I have also placed appropriate text in there (or so I believe I did):
The errors I get after I kill a Bug or any other creature are as follows:
Also can someone help me to make a script so it will broadcast every monster killed by every player as well? A broadcast such as "PlayerName just killed a MonsterName"
Thanks for any help for getting this to work on my version of TFS
I have an error when I try to use a script.
I run my server off TFS Version 0.2.3 (Mystic Spirit)
The code below is saved as broadcastSingleMonsterKilled.lua in the target location creaturescripts\scripts\
Code:
local config = {
broadCast = FALSE, -- Red broadcast = TRUE/FALSE
monsterName = "Bug",
}
function onKill(cid, target)
if isMonster(target) == TRUE and isPlayer(cid) == TRUE then
if getCreatureName(target) == string.lower(config.monsterName) then
if config.broadCast == TRUE then
doBroadcastMessage(getPlayerName(cid).." killed a "..getCreatureName(target))
else
doPlayerSendTextMessage(cid, 22, "You killed a "..getCreatureName(target))
end
end
end
return TRUE
end
I have also added the appropriate text in creaturescripts.xml:
<event type="kill" name="broadcastSingleMonsterKilled" script="broadcastSingleMonsterKilled.lua"/>
I am not positive if I need it in the login.lua, but I have also placed appropriate text in there (or so I believe I did):
registerCreatureEvent(cid, "broadcastSingleMonsterKilled")
The errors I get after I kill a Bug or any other creature are as follows:
[26/06/2009 15:37:03] Lua Script Error: [CreatureScript Interface]
[26/06/2009 15:37:03] data/creaturescripts/scripts/broadcastSingleMonsterKilled.luanKill
[26/06/2009 15:37:03] ...turescripts/scripts/broadcastSingleMonsterKilled.lua:6: attempt to call global 'isMonster' (a nil value)
[26/06/2009 15:37:03] stack traceback:
[26/06/2009 15:37:03] ...turescripts/scripts/broadcastSingleMonsterKilled.lua:6: in function <...turescripts/scripts/broadcastSingleMonsterKilled.lua:5>
Also can someone help me to make a script so it will broadcast every monster killed by every player as well? A broadcast such as "PlayerName just killed a MonsterName"
Thanks for any help for getting this to work on my version of TFS
Last edited: