Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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!
Good morning otland community, I want to know how I can make it so that when you kill certain monsters the same monster with a green or red or black skull can spawn... and that each one has its own difficulty? I have searched here in the forum but I didn't find anything, I found a way to put levels on the monsters but not skulls... on my server I was able to put skulls on the monsters:
function onKill(cid, target)
local player = Player(cid)
local targetName = getCreatureName(target)
if isMonster(target) then
local storageKey = "kills_" .. targetName
local totalKills = player:getStorageValue(storageKey) or 0
totalKills = totalKills + 1
player:setStorageValue(storageKey, totalKills)
local message = player:getName() .. " has killed a " .. targetName .. "! Total monsters killed: " .. totalKills
for _, targetPlayer in ipairs(Game.getPlayers()) do
targetPlayer:sendTextMessage(MESSAGE_EVENT_DEFAULT, message)
end
end
return true
end
edit this add chance and getmonstername and then create monster according to the quality i added debugging stuff and totalkills you can make something like % 100 so every 100 it will spawn x monster based on what monster you killed its probably best to have like troll1 troll2 troll3 so u can just add number to the name and it will spawn different level monster
Post automatically merged:
Lua:
function onKill(cid, target)
-- Get the player who killed the target
local player = Player(cid)
-- Get the name of the killed target
local targetName = getCreatureName(target)
-- Check if the killed target is a monster
if isMonster(target) then
-- Create a storage key specific to the killed monster
local storageKey = "kills_" .. targetName
-- Get the total number of kills for the current monster for the player
local totalKills = player:getStorageValue(storageKey) or 0
-- Check if totalKills is negative and set it to 0
if totalKills < 0 then
totalKills = 0
player:setStorageValue(storageKey, totalKills)
end
-- Increment the kill count for the current monster
totalKills = totalKills + 1
player:setStorageValue(storageKey, totalKills)
-- Construct a message indicating the kill
local message = player:getName() .. " has killed a " .. targetName .. "! Total monsters killed: " .. totalKills
-- Send the kill message to all players online
for _, targetPlayer in ipairs(Game.getPlayers()) do
targetPlayer:sendTextMessage(MESSAGE_EVENT_DEFAULT, message)
end
-- Check if the player has killed a multiple of 200 of the same monster
if totalKills % 200 == 0 then
-- Define the second monster to spawn
local monsterToSpawn = "monstername2"
-- Get the position of the killed monster
local targetPosition = target:getPosition()
-- Spawn the second monster at the position of the killed monster
Game.createMonster(monsterToSpawn, targetPosition)
-- Send a message to the player indicating the spawn of the second monster
player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Congratulations! You've killed " .. totalKills .. " " .. targetName .. " and summoned " .. monsterToSpawn .. "!")
end
end
-- Always return true to allow the kill event to proceed
return true
end
sending message to all players online is optional however it is nice feature for Evo otses since Default channel pretty much has no use in this game anyways.
function onKill(cid, target)
local player = Player(cid)
local targetName = getCreatureName(target)
if isMonster(target) then
local storageKey = "kills_" .. targetName
local totalKills = player:getStorageValue(storageKey) or 0
totalKills = totalKills + 1
player:setStorageValue(storageKey, totalKills)
local message = player:getName() .. " has killed a " .. targetName .. "! Total monsters killed: " .. totalKills
for _, targetPlayer in ipairs(Game.getPlayers()) do
targetPlayer:sendTextMessage(MESSAGE_EVENT_DEFAULT, message)
end
end
return true
end
edit this add chance and getmonstername and then create monster according to the quality i added debugging stuff and totalkills you can make something like % 100 so every 100 it will spawn x monster based on what monster you killed its probably best to have like troll1 troll2 troll3 so u can just add number to the name and it will spawn different level monster
Post automatically merged:
Lua:
function onKill(cid, target)
-- Get the player who killed the target
local player = Player(cid)
-- Get the name of the killed target
local targetName = getCreatureName(target)
-- Check if the killed target is a monster
if isMonster(target) then
-- Create a storage key specific to the killed monster
local storageKey = "kills_" .. targetName
-- Get the total number of kills for the current monster for the player
local totalKills = player:getStorageValue(storageKey) or 0
-- Check if totalKills is negative and set it to 0
if totalKills < 0 then
totalKills = 0
player:setStorageValue(storageKey, totalKills)
end
-- Increment the kill count for the current monster
totalKills = totalKills + 1
player:setStorageValue(storageKey, totalKills)
-- Construct a message indicating the kill
local message = player:getName() .. " has killed a " .. targetName .. "! Total monsters killed: " .. totalKills
-- Send the kill message to all players online
for _, targetPlayer in ipairs(Game.getPlayers()) do
targetPlayer:sendTextMessage(MESSAGE_EVENT_DEFAULT, message)
end
-- Check if the player has killed a multiple of 200 of the same monster
if totalKills % 200 == 0 then
-- Define the second monster to spawn
local monsterToSpawn = "monstername2"
-- Get the position of the killed monster
local targetPosition = target:getPosition()
-- Spawn the second monster at the position of the killed monster
Game.createMonster(monsterToSpawn, targetPosition)
-- Send a message to the player indicating the spawn of the second monster
player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Congratulations! You've killed " .. totalKills .. " " .. targetName .. " and summoned " .. monsterToSpawn .. "!")
end
end
-- Always return true to allow the kill event to proceed
return true
end
sending message to all players online is optional however it is nice feature for Evo otses since Default channel pretty much has no use in this game anyways.