Lopaskurwa
Active Member
- Joined
- Oct 6, 2017
- Messages
- 873
- Solutions
- 2
- Reaction score
- 49
Hello, i found this script in otland trying to figure it out why nothing happens. How i understand this code should work like this if you deal 50% damage to this monster you will get reward so lets say i do 51(gets reward) and other player 49(doesnt get reward). So code looks like this. Though the issue is because its not registered in login.lua but nothing changed
Creaturescript
Global.lua
Creaturescript
XML:
<event type="death" name="monsterEvent" script="monsterevent.lua" />
Lua:
function onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
local percent = creature:getMaxHealth() * 0.50
for k, v in pairs(monstersSystem) do
if v.name:lower() == creature:getName():lower() then
for pid, info in pairs(creature:getDamageMap()) do
local player = Player(pid)
if player and info.total >= percent then
player:addExperience(v.expReward, true)
player:addMoney(v.goldReward)
player:addItem(v.itemReward, v.itemCount) -- this adds items
player:addEventPoints(v.pointsReward) -- So this is event points
if math.random(1,100) <= v.chance then
player:addItem(v.RandomitemReward, v.RandomitemCount) -- this is adds items too
end
end
end
end
end
return true
end
Global.lua
Lua:
monstersSystem = {
[1] = {name = "Ornstein Lvl 1", chance = 5, expReward = 15000000, pointsReward = 100, goldReward = 1000000, RandomitemReward = 8373, RandomitemCount = 1, itemReward = 16857, itemCount = 15},
[2] = {name = "Ornstein Lvl 2", chance = 5, expReward = 15000000, pointsReward = 10, goldReward = 1000000, RandomitemReward = 8373, RandomitemCount = 1, itemReward = 16857, itemCount = 15},
[3] = {name = "Wizpig", chance = 5, expReward = 15000000, pointsReward = 10, goldReward = 1000000, RandomitemReward = 8373, RandomitemCount = 1, itemReward = 16857, itemCount = 15},
[4] = {name = "Dracula", chance = 5, expReward = 15000000, pointsReward = 10, goldReward = 1000000, RandomitemReward = 8373, RandomitemCount = 1, itemReward = 16857, itemCount = 15}
}