• 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!

CreatureEvent Extra Area Experience

Critico

Sexy
Joined
Mar 25, 2010
Messages
370
Reaction score
176
Tested: 8.6+

Is a code you put an area, and that area give more exp if the player kill a monster... can be used for VIP area.


data/creaturescripts/scripts

area_exp.lua
Lua:
function onKill(cid, target)

local exp_area ={
{from = {x=1014,y=1016,z=7},to = {x=1017,y=1019,z=7}, exp = 0.5},
{from = {x=1008,y=1018,z=7},to = {x=1011,y=1021,z=7}, exp = 0.25}
}

if isPlayer(cid) and isMonster(target) == true then
for _, var in ipairs(exp_area) do
if isInRange(getCreaturePosition(cid), var.from, var.to) then
local percent = var.exp
local exp = getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier)
local count = math.floor(((getMonsterInfo(string.lower(getCreatureName(target))).experience*exp)*percent))
doPlayerAddExperience(cid, count)
addEvent(doSendAnimatedText, 500, getCreaturePosition(cid), '+'..count, math.random(50,60))
end
end
end
return true
end

add in login.lua

Code:
registerCreatureEvent(cid, "area_exp")

creaturescript.xml
Code:
<event type="kill" name="area_exp" event="script" value="area_exp.lua"/>


Configuration

Lua:
local exp_area ={
{from = {x=1014,y=1016,z=7},to = {x=1017,y=1019,z=7}, exp = 0.5},
{from = {x=1008,y=1018,z=7},to = {x=1011,y=1021,z=7}, exp = 0.25}
}

from = {x=1014,y=1016,z=7} -- beginning of the area(pos)
to = {x=1017,y=1019,z=7} -- final area (pos)
exp = 0.5 -- extra exp percent

0.5 = 50%
0.3 = 30%
0.25 = 25%

etc...
 
Back
Top