nefinoo
Carnage.flv
Im trying to find a monster point system when you kill 1 monster get 1 point.
i am using storage value = 100 to save the points count.
i am using storage value = 100 to save the points count.
Im trying to find a monster point system when you kill 1 monster get 1 point.
i am using storage value = 100 to save the points count.
local storage = 100
local monsterList = {
["demon"] = 1,
["dragon"] = 1,
["dragon lord"] = 1
}
local anyMonsterPoints = 1 -- -1 to disable
local killPoints = CreatureEvent("KillPoints")
function killPoints.onKill(player, target)
if not target:isMonster() then
return true
end
local monsterName = target:getName():lower()
local points = monsterList[monsterName]
if not points then
points = anyMonsterPoints
end
if points < 0 then
return true
end
local storageValue = player:getStorageValue(storage)
if storageValue < 0 then...
Im trying to find a monster point system when you kill 1 monster get 1 point.
i am using storage value = 100 to save the points count.
local storage = 100
local monsterList = {
["demon"] = 1,
["dragon"] = 1,
["dragon lord"] = 1
}
local anyMonsterPoints = 1 -- -1 to disable
local killPoints = CreatureEvent("KillPoints")
function killPoints.onKill(player, target)
if not target:isMonster() then
return true
end
local monsterName = target:getName():lower()
local points = monsterList[monsterName]
if not points then
points = anyMonsterPoints
end
if points < 0 then
return true
end
local storageValue = player:getStorageValue(storage)
if storageValue < 0 then
storageValue = 0
end
player:setStorageValue(storage, storageValue + points)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("You have %d points.", storageValue + points))
return true
end
killPoints:register()
local killLogin = CreatureEvent("KillLogin")
function killLogin.onLogin(player)
player:registerEvent("KillPoints")
return true
end
killLogin:register()
What are these points used for?Works! thanks so much
I use them for a stats system that I made, the points you obtain are saved in a storage value, and that value or those "points" are spent.What are these points used for?
-- Monster list with names
local monsters = {
"Amazon", "Ancient Scarab", "Assassin", "Badger", "Bandit", "Banshee", "Bat", "Bear", "Behemoth", "Beholder",
"Black Knight", "Black Sheep", "Blue Djinn", "Bonebeast", "Bug", "Butterfly", "Butterfly Purple", "Butterfly Yellow",
"Butterfly Red", "Butterfly Blue", "Carniphila", "Cave Rat", "Centipede", "Chicken", "Cobra", "Crab", "Crocodile",
"Crypt Shambler", "Cyclops", "Dark Monk", "Deer", "Demon Skeleton", "Demon", "Dog", "Dragon Lord", "Dragon",
"Dwarf Geomancer", "Dwarf Guard", "Dwarf Soldier", "Dwarf", "Dworc Fleshhunter", "Dworc Venomsniper", "Dworc Voodoomaster",
"Efreet", "Elder Beholder", "Elephant", "Elf Arcanist", "Elf Scout", "Elf", "Fire Devil", "Fire Elemental",
"Flamingo", "Frost Troll", "Gargoyle", "Gazer", "Ghost", "Ghoul", "Giant Spider", "Goblin", "Green Djinn",
"Hero", "Hunter", "Hyaena", "Hydra", "Kongra", "Larva", "Lich", "Lion", "Lizard Sentinel", "Lizard Snakecharmer",
"Lizard Templar", "Marid", "Merlkin", "Minotaur Archer", "Minotaur Guard", "Minotaur Mage", "Minotaur", "Monk",
"Mummy", "Necromancer", "Orc Berserker", "Orc Leader", "Orc Rider", "Orc Shaman", "Orc Spearman", "Orc Warlord",
"Orc Warrior", "Orc", "Panda", "Parrot", "Pig", "Poison Spider", "Polar Bear", "Priestess", "Rabbit", "Rat",
"Rotworm", "Scarab", "Scorpion", "Serpent Spawn", "Sheep", "Sibang", "Skeleton", "Skunk", "Slime2", "Slime",
"Smuggler", "Snake", "Spider", "Spit Nettle", "Stalker", "Stone Golem", "Swamp Troll", "Tarantula", "Terror Bird",
"Tiger", "Troll", "Valkyrie", "Vampire", "War Wolf", "Warlock", "Wasp", "Wild Warrior", "Winter Wolf", "Witch",
"Wolf", "Yeti"
}
-- Define the onKill function
function onKill(cid, target)
local player = Player(cid)
local targetName = getCreatureName(target)
-- Check if the target is a monster
if isMonster(target) then
-- Find the index of the monster in the list
local monsterIndex = -1
for i, name in ipairs(monsters) do
if name == targetName then
monsterIndex = i
break
end
end
if monsterIndex ~= -1 then
-- Use the monster index to set storage
local key = 1010000 + monsterIndex
local killCount = player:getStorageValue(key) or 0
-- If the kill count is -1 or 0, set it to 1 instead of incrementing by 1
if killCount <= 0 then
killCount = 1
else
killCount = killCount + 1
end
player:setStorageValue(key, killCount)
-- Send task information to the player
local taskMessage = "[Bestiary] You have killed a " .. targetName .. "! Total " .. targetName .. "s killed: " .. killCount .. "."
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, taskMessage)
-- Check if the killCount meets the requirement for the rewards
if killCount % 100 == 0 then
local maxHealth = target:getMaxHealth()
local expReward = math.random(maxHealth*25, maxHealth * 55.25) -- Random experience reward based on monster's max health
local goldReward = math.random(maxHealth*15, maxHealth * 18.25) -- Random gold reward based on monster's max health
player:addExperience(expReward)
player:addMoney(goldReward)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received a reward for killing " .. killCount .. " " .. targetName .. "s! Experience: " .. expReward .. ", Gold: " .. goldReward)
-- Check if the kill count is also a multiple of 500 and give gem bag also!
if killCount % 500 == 0 then
player:addItem(6512, 1) -- Add a gem bag
local expReward = math.random(maxHealth*66, maxHealth * 82.25) -- Random experience reward based on monster's max health
local goldReward = math.random(maxHealth*20, maxHealth * 32.25) -- Random gold reward based on monster's max health
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received a Double reward for killing " .. killCount .. " " .. targetName .. "s! Experience: " .. expReward .. ", Gold: " .. goldReward)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received a gem bag as a reward for killing " .. killCount .. " " .. targetName .. "s!")
end
end
else
print("Monster not found in the list:", targetName)
end
end
return true
end
This script does not workLua:-- Monster list with names local monsters = { "Amazon", "Ancient Scarab", "Assassin", "Badger", "Bandit", "Banshee", "Bat", "Bear", "Behemoth", "Beholder", "Black Knight", "Black Sheep", "Blue Djinn", "Bonebeast", "Bug", "Butterfly", "Butterfly Purple", "Butterfly Yellow", "Butterfly Red", "Butterfly Blue", "Carniphila", "Cave Rat", "Centipede", "Chicken", "Cobra", "Crab", "Crocodile", "Crypt Shambler", "Cyclops", "Dark Monk", "Deer", "Demon Skeleton", "Demon", "Dog", "Dragon Lord", "Dragon", "Dwarf Geomancer", "Dwarf Guard", "Dwarf Soldier", "Dwarf", "Dworc Fleshhunter", "Dworc Venomsniper", "Dworc Voodoomaster", "Efreet", "Elder Beholder", "Elephant", "Elf Arcanist", "Elf Scout", "Elf", "Fire Devil", "Fire Elemental", "Flamingo", "Frost Troll", "Gargoyle", "Gazer", "Ghost", "Ghoul", "Giant Spider", "Goblin", "Green Djinn", "Hero", "Hunter", "Hyaena", "Hydra", "Kongra", "Larva", "Lich", "Lion", "Lizard Sentinel", "Lizard Snakecharmer", "Lizard Templar", "Marid", "Merlkin", "Minotaur Archer", "Minotaur Guard", "Minotaur Mage", "Minotaur", "Monk", "Mummy", "Necromancer", "Orc Berserker", "Orc Leader", "Orc Rider", "Orc Shaman", "Orc Spearman", "Orc Warlord", "Orc Warrior", "Orc", "Panda", "Parrot", "Pig", "Poison Spider", "Polar Bear", "Priestess", "Rabbit", "Rat", "Rotworm", "Scarab", "Scorpion", "Serpent Spawn", "Sheep", "Sibang", "Skeleton", "Skunk", "Slime2", "Slime", "Smuggler", "Snake", "Spider", "Spit Nettle", "Stalker", "Stone Golem", "Swamp Troll", "Tarantula", "Terror Bird", "Tiger", "Troll", "Valkyrie", "Vampire", "War Wolf", "Warlock", "Wasp", "Wild Warrior", "Winter Wolf", "Witch", "Wolf", "Yeti" } -- Define the onKill function function onKill(cid, target) local player = Player(cid) local targetName = getCreatureName(target) -- Check if the target is a monster if isMonster(target) then -- Find the index of the monster in the list local monsterIndex = -1 for i, name in ipairs(monsters) do if name == targetName then monsterIndex = i break end end if monsterIndex ~= -1 then -- Use the monster index to set storage local key = 1010000 + monsterIndex local killCount = player:getStorageValue(key) or 0 -- If the kill count is -1 or 0, set it to 1 instead of incrementing by 1 if killCount <= 0 then killCount = 1 else killCount = killCount + 1 end player:setStorageValue(key, killCount) -- Send task information to the player local taskMessage = "[Bestiary] You have killed a " .. targetName .. "! Total " .. targetName .. "s killed: " .. killCount .. "." player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, taskMessage) -- Check if the killCount meets the requirement for the rewards if killCount % 100 == 0 then local maxHealth = target:getMaxHealth() local expReward = math.random(maxHealth*25, maxHealth * 55.25) -- Random experience reward based on monster's max health local goldReward = math.random(maxHealth*15, maxHealth * 18.25) -- Random gold reward based on monster's max health player:addExperience(expReward) player:addMoney(goldReward) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received a reward for killing " .. killCount .. " " .. targetName .. "s! Experience: " .. expReward .. ", Gold: " .. goldReward) -- Check if the kill count is also a multiple of 500 and give gem bag also! if killCount % 500 == 0 then player:addItem(6512, 1) -- Add a gem bag local expReward = math.random(maxHealth*66, maxHealth * 82.25) -- Random experience reward based on monster's max health local goldReward = math.random(maxHealth*20, maxHealth * 32.25) -- Random gold reward based on monster's max health player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received a Double reward for killing " .. killCount .. " " .. targetName .. "s! Experience: " .. expReward .. ", Gold: " .. goldReward) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received a gem bag as a reward for killing " .. killCount .. " " .. targetName .. "s!") end end else print("Monster not found in the list:", targetName) end end return true end
My question is still: What do you spend these points on? Because these points are not donate coin, so I wonderI use them for a stats system that I made, the points you obtain are saved in a storage value, and that value or those "points" are spent.
local storage = 601
local monsterList = {
["hydra"] = {
name = "hydra",
killsRequired = 10,
rewards = {
{itemId = 2160, itemCount = 100},
{itemId = 2638, itemCount = 100}
}
},
["dragon"] = {
name = "dragon",
killsRequired = 10,
rewards = {
{itemId = 2638, itemCount = 100},
{itemId = 2160, itemCount = 100}
}
},
["dragon lord"] = {
name = "dragon lord",
killsRequired = 10,
rewards = {
{itemId = 2638, itemCount = 100},
{itemId = 2160, itemCount = 100}
}
}
}
local anyMonsterPoints = -1 -- -1 to disable
local killPoints = CreatureEvent("KillPoints")
function killPoints.onKill(player, target)
if not target:isMonster() then
return true
end
local monsterName = target:getName():lower()
local monsterData = monsterList[monsterName]
if not monsterData then
monsterData = {name = monsterName, killsRequired = anyMonsterPoints, rewards = {{itemId = anyMonsterPoints, itemCount = anyMonsterPoints}}}
end
if monsterData.killsRequired < 0 then
return true
end
local storageValue = player:getStorageValue(storage)
if storageValue < 0 then
storageValue = 0
end
-- Check if the player has already received the bonus
if storageValue >= monsterData.killsRequired then
return true
end
player:setStorageValue(storage, storageValue + 1)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("You have killed %d %s.", storageValue + 1, monsterData.name))
-- If the player kills the specified number of monsters, give him the reward and stop counting
if storageValue + 1 == monsterData.killsRequired then
for _, reward in ipairs(monsterData.rewards) do
player:addItem(reward.itemId, reward.itemCount)
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Congratulations! You received bonus rewards for completing the mission against %s.", monsterData.name))
player:setStorageValue(storage, monsterData.killsRequired) --Counting stops after achieving the goal
end
return true
end
killPoints:register()
local killLogin = CreatureEvent("KillLogin")
function killLogin.onLogin(player)
player:registerEvent("KillPoints")
return true
end
killLogin:register()
this script works but you are using lowername monster names im using first capital letter it has to match properly in monster file.This script does not work
My question is still: What do you spend these points on? Because these points are not donate coin, so I wonder
I modified the script slightly to give players rewards after killing a certain number of monsters
View attachment 85032Lua:local storage = 601 local monsterList = { ["hydra"] = { name = "hydra", killsRequired = 10, rewards = { {itemId = 2160, itemCount = 100}, {itemId = 2638, itemCount = 100} } }, ["dragon"] = { name = "dragon", killsRequired = 10, rewards = { {itemId = 2638, itemCount = 100}, {itemId = 2160, itemCount = 100} } }, ["dragon lord"] = { name = "dragon lord", killsRequired = 10, rewards = { {itemId = 2638, itemCount = 100}, {itemId = 2160, itemCount = 100} } } } local anyMonsterPoints = -1 -- -1 to disable local killPoints = CreatureEvent("KillPoints") function killPoints.onKill(player, target) if not target:isMonster() then return true end local monsterName = target:getName():lower() local monsterData = monsterList[monsterName] if not monsterData then monsterData = {name = monsterName, killsRequired = anyMonsterPoints, rewards = {{itemId = anyMonsterPoints, itemCount = anyMonsterPoints}}} end if monsterData.killsRequired < 0 then return true end local storageValue = player:getStorageValue(storage) if storageValue < 0 then storageValue = 0 end -- Check if the player has already received the bonus if storageValue >= monsterData.killsRequired then return true end player:setStorageValue(storage, storageValue + 1) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("You have killed %d %s.", storageValue + 1, monsterData.name)) -- If the player kills the specified number of monsters, give him the reward and stop counting if storageValue + 1 == monsterData.killsRequired then for _, reward in ipairs(monsterData.rewards) do player:addItem(reward.itemId, reward.itemCount) end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Congratulations! You received bonus rewards for completing the mission against %s.", monsterData.name)) player:setStorageValue(storage, monsterData.killsRequired) --Counting stops after achieving the goal end return true end killPoints:register() local killLogin = CreatureEvent("KillLogin") function killLogin.onLogin(player) player:registerEvent("KillPoints") return true end killLogin:register()
on a stats system! i have my own stast system, you get points and those points are spend on a stat system or a "shop" where you can buy Health points, Mana points, skills or anything you want.This script does not work
My question is still: What do you spend these points on? Because these points are not donate coin, so I wonder
I modified the script slightly to give players rewards after killing a certain number of monsters
View attachment 85032Lua:local storage = 601 local monsterList = { ["hydra"] = { name = "hydra", killsRequired = 10, rewards = { {itemId = 2160, itemCount = 100}, {itemId = 2638, itemCount = 100} } }, ["dragon"] = { name = "dragon", killsRequired = 10, rewards = { {itemId = 2638, itemCount = 100}, {itemId = 2160, itemCount = 100} } }, ["dragon lord"] = { name = "dragon lord", killsRequired = 10, rewards = { {itemId = 2638, itemCount = 100}, {itemId = 2160, itemCount = 100} } } } local anyMonsterPoints = -1 -- -1 to disable local killPoints = CreatureEvent("KillPoints") function killPoints.onKill(player, target) if not target:isMonster() then return true end local monsterName = target:getName():lower() local monsterData = monsterList[monsterName] if not monsterData then monsterData = {name = monsterName, killsRequired = anyMonsterPoints, rewards = {{itemId = anyMonsterPoints, itemCount = anyMonsterPoints}}} end if monsterData.killsRequired < 0 then return true end local storageValue = player:getStorageValue(storage) if storageValue < 0 then storageValue = 0 end -- Check if the player has already received the bonus if storageValue >= monsterData.killsRequired then return true end player:setStorageValue(storage, storageValue + 1) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("You have killed %d %s.", storageValue + 1, monsterData.name)) -- If the player kills the specified number of monsters, give him the reward and stop counting if storageValue + 1 == monsterData.killsRequired then for _, reward in ipairs(monsterData.rewards) do player:addItem(reward.itemId, reward.itemCount) end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Congratulations! You received bonus rewards for completing the mission against %s.", monsterData.name)) player:setStorageValue(storage, monsterData.killsRequired) --Counting stops after achieving the goal end return true end killPoints:register() local killLogin = CreatureEvent("KillLogin") function killLogin.onLogin(player) player:registerEvent("KillPoints") return true end killLogin:register()
work on 8.6?Lua:local storage = 100 local monsterList = { ["demon"] = 1, ["dragon"] = 1, ["dragon lord"] = 1 } local anyMonsterPoints = 1 -- -1 to disable local killPoints = CreatureEvent("KillPoints") function killPoints.onKill(player, target) if not target:isMonster() then return true end local monsterName = target:getName():lower() local points = monsterList[monsterName] if not points then points = anyMonsterPoints end if points < 0 then return true end local storageValue = player:getStorageValue(storage) if storageValue < 0 then storageValue = 0 end player:setStorageValue(storage, storageValue + points) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("You have %d points.", storageValue + points)) return true end killPoints:register() local killLogin = CreatureEvent("KillLogin") function killLogin.onLogin(player) player:registerEvent("KillPoints") return true end killLogin:register()
What is 8.6? There are several types of TFS. You should ask, 'Does it work with TFS 0.4 8.6 or TFS 0.36 8.6?' Otherwise, it clearly doesn't work, only for those using TFS downgrade 1.3+ or TFS 1.4.2+ it is compatible. Because this code is revscript...work on 8.6?