athenso
Average Coder
- Joined
- May 31, 2011
- Messages
- 155
- Solutions
- 3
- Reaction score
- 23
I used this for a simple "click bush, math.random(1,20) monster spawn" sort of thing.
None of the code is mine, i just put the pieces together.
First you need to add the function(050-function):
Creature script
zombiebush.lua
login
None of the code is mine, i just put the pieces together.
First you need to add the function(050-function):
Code:
function doPlayerAddPercentLevel(cid, percent)
local player_lv, player_lv_1 = getExperienceForLevel(getPlayerLevel(cid)), getExperienceForLevel(getPlayerLevel(cid)+1)
local percent_lv = ((player_lv_1 - player_lv) / 100) * percent
doPlayerAddExperience(cid, percent_lv)
end
Creature script
Code:
<event type="kill" name="ZombieBush" event="script" value="zombiebush.lua"/>
zombiebush.lua
Code:
local t = {
monsterName = 'zombie'
}
function onKill(cid, target, flags)
if getCreatureName(target):lower() == t.monsterName:lower() then
doPlayerAddPercentLevel(cid, 2)
end
return true
end
login
Code:
registerCreatureEvent (cid, "ZombieBush")