newby
Active Member
- Joined
- Jun 11, 2016
- Messages
- 183
- Reaction score
- 43
Is anyone know how to add a system to every monster before spawn
Got a random chance 1 to 100
0 - normal [16-100]
1 - white skull [6-20]
1.5x attack, defense, mana, health, loot, exp (everything is possible)
2 - red skull [2-5]
2x attack, defense, mana, health, loot, exp (everything is possible)
3 - black skull [1]
3x attack, defense, mana, health, loot, exp (everything is possible)
I have a little idea how to do this:
But i need some helps in LUA because i'm starting on this and on C++ because i think it will need a new function OnMonsterSpawn
And i think another guys on forum would and should use this.
Got a random chance 1 to 100
0 - normal [16-100]
1 - white skull [6-20]
1.5x attack, defense, mana, health, loot, exp (everything is possible)
2 - red skull [2-5]
2x attack, defense, mana, health, loot, exp (everything is possible)
3 - black skull [1]
3x attack, defense, mana, health, loot, exp (everything is possible)
I have a little idea how to do this:
Code:
function onMonsterSpawn(??, ??, ??)
-- SKULL_NONE = 0
-- SKULL_WHITE = 3
-- SKULL_RED = 4
-- SKULL_BLACK = 5
local skull, bonus_percent
local chance = math.random(1, 100)
if(chance <= 1) then
skull = 5
bonus_percent = 3
elseif(chance >= 2 and chance <= 5) then
skull = 4
bonus_percent = 2
elseif(chance >= 6 and chance <= 20) then
skull = 3
bonus_percent = 1.5
else
skull = 0
bonus_percent = 0
end
if(skull > 0) then
local hp = (getCreatureMaxHealth(mid)) + ((getCreatureMaxHealth(mid) * bonus_percent) / ( 100 ))
setCreatureMaxHealth(mid, hp)
doCreatureSetSkullType(mid, skull)
end
-- return?
end
But i need some helps in LUA because i'm starting on this and on C++ because i think it will need a new function OnMonsterSpawn
And i think another guys on forum would and should use this.