• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

onKill TFS 1.2

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
Hello everyone, I found a script by @Ninja and I did some edits and it isn't working.

Already registred at login.lua, xml, at monsters files, and it didn't give any erros, just don't work.

Code:
local config = {
  ["Boss 1"] = {time = 60, toPos = Position(566, 886, 11), tpPos = Position(566, 876, 10)},
   ["Boss 2"] = {time = 60, toPos = Position(566, 909, 12), tpPos = Position(566, 897, 11)},
   ["Boss 3"] = {time = 60, toPos = Position(566, 930, 12), tpPos = Position(566, 920, 12)}
}

local function deleteTeleport(position)
  local teleport = Tile(position):getItemById(1387)
  if teleport then
  teleport:remove()
  position:sendMagicEffect(CONST_ME_POFF)
  end
end

function onKill(creature, target)
  local monster = config[target:getName():lower()]
  if not monster or target:isPlayer() then
  return true
  end

  local item = Game.createItem(1387, 1, monster.tpPos)
  if item:isTeleport() then
  item:setDestination(monster.toPos)
  end

  creature:say("You have " .. monster.time .. " seconds to escape!", TALKTYPE_MONSTER_SAY)
  addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
  return true
end
 
Have you even tried to debug the script? The registered event name might be incorrect, or the keys for the table config might not be in lowercase et cetera.
 
@Ninja
Code:
<event type="kill" name="bossesx" script="bossesxz.lua" />

Login.lua
Code:
player:registerEvent('bossesx')

At monsters file:
Code:
<script>
     <event name="bossesx" />
   </script>

What you mean with debug the script and keys for the table config might not be lower-case?
 
The boss names (has to be in lowercase letters) are being used as keys to access elements in the table config. As for debugging, the usual method is to add print on various places within the script to see where it stops.
 
@Ninja
Code:
<event type="kill" name="bossesx" script="bossesxz.lua" />

Login.lua
Code:
player:registerEvent('bossesx')

At monsters file:
Code:
<script>
     <event name="bossesx" />
   </script>

What you mean with debug the script and keys for the table config might not be lower-case?

The problem is in your tag, try that:

Code:
<event type="kill" name="bossesx" event="script" value="bossesxz.lua" />
 
Back
Top