local mob = "Troll"
local bossName = "Orshabaal"
local killCount = 15
local positionBossSpawn = {x = 98, y = 104, z = 6}
local storValGlobal = 1024
local bossMsg = "The skies darken as Orshabaal enters the world! Flee mortals!"
function onKill(creature, target)
if isPlayer(target) ~= TRUE and getCreatureName(target) == mob then
if Game.getStorageValue(storValGlobal) == nil then
Game.setStorageValue(storValGlobal, 0)
end
Game.setStorageValue(storValGlobal, Game.getStorageValue(storValGlobal) + 1)
end
if Game.getStorageValue(storValGlobal) == killCount then
Game.createMonster(bossName, positionBossSpawn)
broadcastMessage(bossMsg)
Game.setStorageValue(storValGlobal, 0)
end
end
player:registerEvent("BossSpawnAfterKills")
<event type="kill" name="BossSpawnAfterKills" script="bossspawn.lua"/>
Tried to put em 0.X code, but got a problem:You could take any regular old script for killing creatures and use Game.setStorageValue(num, val) to keep a global count. Might be an interesting exercise.
Post automatically merged:
I quickly whipped up an example for you.
bossSpawn.lua in creaturescripts/scripts
Add to login.luaLua:local mob = "Troll" local bossName = "Orshabaal" local killCount = 15 local positionBossSpawn = {x = 98, y = 104, z = 6} local storValGlobal = 1024 local bossMsg = "The skies darken as Orshabaal enters the world! Flee mortals!" function onKill(creature, target) if isPlayer(target) ~= TRUE and getCreatureName(target) == mob then if Game.getStorageValue(storValGlobal) == nil then Game.setStorageValue(storValGlobal, 0) end Game.setStorageValue(storValGlobal, Game.getStorageValue(storValGlobal) + 1) end if Game.getStorageValue(storValGlobal) == killCount then Game.createMonster(bossName, positionBossSpawn) broadcastMessage(bossMsg) Game.setStorageValue(storValGlobal, 0) end end
Lua:player:registerEvent("BossSpawnAfterKills")
creaturescripts.xml
XML:<event type="kill" name="BossSpawnAfterKills" script="bossspawn.lua"/>
local mob = "Guzzlemaw"
local bossName = "Orshabaal"
local killCount = 15
local positionBossSpawn = {x = 932, y = 1356, z = 12}
local storValGlobal = 1024
local bossMsg = "The skies darken as Orshabaal enters the world! Flee mortals!"
function onKill(cid, target)
if isPlayer(target) ~= TRUE and getCreatureName(target) == mob then
if getGlobalStorageValue(storValGlobal) == nil then
setGlobalStorageValue(storValGlobal, 0)
end
setGlobalStorageValue(cid, getGlobalStorageValue(storValGlobal) + 1)
end
if getGlobalStorageValue(storValGlobal) == killCount then
doCreateMonster(bossName, positionBossSpawn)
broadcastMessage(bossMsg, MESSAGE_STATUS_WARNING)
setGlobalStorageValue(storValGlobal, 0)
end
end
Pretty sure, it was fixed a long by those links:Are you sure it's not related to your previous issue?
Does it work for regular trolls?TFS 0.X - [7.72]Djins dont die
Hi everyone, My server starts a problem: when i pick djin task, they dont die, other monsters fall in ground and give loot, but djins stays like in this SS. What can i do to fix?otland.net
local mob = "Guzzlemaw"
local bossName = "Orshabaal"
local killCount = 15
local positionBossSpawn = {x = 932, y = 1356, z = 12}
local storValGlobal = 1024
local bossMsg = "The skies darken as Orshabaal enters the world! Flee mortals!"
function onKill(cid, target)
if isPlayer(target) ~= TRUE and getCreatureName(target) == mob then
if getGlobalStorageValue(storValGlobal) == nil then
setGlobalStorageValue(storValGlobal, 0)
end
setGlobalStorageValue(cid, getGlobalStorageValue(storValGlobal) + 1)
end
if getGlobalStorageValue(storValGlobal) >= killCount then
doCreateMonster(bossName, positionBossSpawn)
broadcastMessage(bossMsg, MESSAGE_STATUS_WARNING)
setGlobalStorageValue(storValGlobal, 0)
end
return true
end
local mob = "Guzzlemaw"
local bossName = "Reflection of Mawhawk"
local killCount = 1000
local positionBossSpawn = {x = 932, y = 1356, z = 12}
local storValGlobal = 1024
local bossMsg = "The skies darken as Reflection of Mawhawk enters the world! Flee mortals!"
function onKill(cid, target)
if isPlayer(target) ~= TRUE and getCreatureName(target) == mob then
if getGlobalStorageValue(storValGlobal) == nil then
setGlobalStorageValue(storValGlobal, 0)
end
setGlobalStorageValue(storValGlobal, getGlobalStorageValue(storValGlobal) + 1)
end
if getGlobalStorageValue(storValGlobal) >= killCount then
doCreateMonster(bossName, positionBossSpawn)
broadcastMessage(bossMsg, MESSAGE_STATUS_WARNING)
setGlobalStorageValue(storValGlobal, 0)
end
return true
end
setGlobalStorageValue(cid, getGlobalStorageValue(storValGlobal) + 1)
setGlobalStorageValue(storValGlobal, getGlobalStorageValue(storValGlobal) + 1)
Thanks anyway, u gave me a starting point <3I was just staring at this; line 13
C++:setGlobalStorageValue(cid, getGlobalStorageValue(storValGlobal) + 1)
shouldn't that be
C++:setGlobalStorageValue(storValGlobal, getGlobalStorageValue(storValGlobal) + 1)
Edit: Bah, beaten by 20 minutes