Why dont you make just and entrance without exit? So in that way you dont need blockade for doors. About that moment when boss is killed why just dont you use corpses as teleport? I know its sounds like in ice age![]()
Hey, i searching boss room script, i have room 3x3 on central sqm is spawn boos, but i need script to kick from room and create blockade for doors if boss be killed.
Boss time to respawn is 60min
local boss_name = "BOSS_NAME_HERE"
local room_pos = {x = 1000, y = 1000, z = 7} -- POSITION WHERE BOSS SPAWNS
local new_location {x = 1200, y = 1200, z = 7} -- LOCATION FOR KICKING PLAYERS
local blockade_pos = {x = 1010, y = 1010, z = 7} -- CREATE WALL IN THIS POSITION
local wall_id = 2165 -- WALL ID
function onKill(creature, target)
local monster = target:getMonster()
if not monster then
return true
end
local monsterName = monster:getName():lower()
if monsterName == boss_name:lower() then
local spectators = getSpectators(room_pos, false, false, 0, 1, 0, 1)
for i = 1, #spectators do
if spectators[i]:isPlayer() then
spectators[i]:teleportTo(new_location)
end
end
Game.createItem(wall_id, 1, blockade_pos)
end
return true
end
expect errors, post them here if any
LUA:local boss_name = "BOSS_NAME_HERE" local room_pos = {x = 1000, y = 1000, z = 7} -- POSITION WHERE BOSS SPAWNS local new_location {x = 1200, y = 1200, z = 7} -- LOCATION FOR KICKING PLAYERS local blockade_pos = {x = 1010, y = 1010, z = 7} -- CREATE WALL IN THIS POSITION local wall_id = 2165 -- WALL ID function onKill(creature, target) local monster = target:getMonster() if not monster then return true end local monsterName = monster:getName():lower() if monsterName == boss_name:lower() then local spectators = getSpectators(room_pos, false, false, 0, 1, 0, 1) for i = 1, #spectators do if spectators[i]:isPlayer() then spectators[i]:teleportTo(new_location) end end Game.createItem(wall_id, 1, blockade_pos) end return true end
This script not work, if i killed boss he dont dieying he's still alive verytime and server giving me reward every 1 s.
(he's still alive but he dont has name)
//edit
Okey, i changed event type from kill to death and now he dieying but script dont kick me from room and dont create wall.
can you show error message from the console please (using onKill function)
and tell me your tfs version
I dont have errors in consoleTFS 0.4
local boss_name = "BOSS_NAME_HERE"
local room_pos = {x = 1000, y = 1000, z = 7} -- POSITION WHERE BOSS SPAWNS
local new_location {x = 1200, y = 1200, z = 7} -- LOCATION FOR KICKING PLAYERS
local blockade_pos = {x = 1010, y = 1010, z = 7} -- CREATE WALL IN THIS POSITION
local wall_id = 2165 -- WALL ID
function onKill(cid, target)
local monster = getCreatureName(target):lower()
if monster == boss_name:lower() then
local spectators = getSpectators(room_pos, 1, 1)
for i = 1, #spectators do
if isPlayer(spectators[i]) then
doTeleportThing(spectators[i], new_location)
end
end
doCreateItem(wall_id, 1, blockade_pos)
end
return true
end
<event type="kill" name="nKill" event="script" value="nScript.lua"/>
<script>
<event name="nKill" />
</script>
Not workdata\creaturescripts\scripts\nScript.lua - create this File and add the following
LUA:local boss_name = "BOSS_NAME_HERE" local room_pos = {x = 1000, y = 1000, z = 7} -- POSITION WHERE BOSS SPAWNS local new_location {x = 1200, y = 1200, z = 7} -- LOCATION FOR KICKING PLAYERS local blockade_pos = {x = 1010, y = 1010, z = 7} -- CREATE WALL IN THIS POSITION local wall_id = 2165 -- WALL ID function onKill(cid, target) local monster = getCreatureName(target):lower() if monster == boss_name:lower() then local spectators = getSpectators(room_pos, 1, 1) for i = 1, #spectators do if isPlayer(spectators[i]) then doTeleportThing(spectators[i], new_location) end end doCreateItem(wall_id, 1, blockade_pos) end return true end
data\creaturescripts\creaturescripts.xml - open this File and add this line
XML:<event type="kill" name="nKill" event="script" value="nScript.lua"/>
data\monster\YOUR BOSS FILE.xml- open your boss File
add the following after </flags>:
XML:<script> <event name="nKill" /> </script>