Killing monster has a chance to drop a exp arrow which gives you double exp for next 60 seconds
You must go to the effect to start the double exp like on the gif:
You can check your time by using !exp
The way how its scripted is prob screwed up so im sorry xD im not a lua expert
data/scripts/spiderman.lua
You must go to the effect to start the double exp like on the gif:
Gyazo Screen Video
gyazo.com
You can check your time by using !exp
The way how its scripted is prob screwed up so im sorry xD im not a lua expert
data/scripts/spiderman.lua
Lua:
local custom_exp_damage_effect = CreatureEvent("custom_exp_damage_effect")
local config = {
['Rotworm'] = { chance = 100 }, -- 100 means 1%
['Crocodile'] = { chance = 100 },
['Mutated Bat'] = { chance = 100 },
['Mutated Human'] = { chance = 100 },
['Brimstone Bug'] = { chance = 100 },
['Troll'] = { chance = 100 },
['Coldheart'] = { chance = 100 },
['Crazed Beggar'] = { chance = 100 }
}
local function sendMessage(target)
if not target then
return true
end
target:sendMagicEffect(56)
target:sendMagicEffect(57)
end
function custom_exp_damage_effect.onKill(creature, target)
if target:isPlayer() then
return true
end
local monster = config[target:getName()]
if not monster then
return true
end
if math.random(1, 10000) <= monster.chance then
local tile = Tile(target:getPosition())
if tile then
local ground = tile:getGround()
if ground then
ground:setActionId(6000)
target:say('DOUBLE EXP!', TALKTYPE_MONSTER_SAY)
for i = 0, 3 do
addEvent(sendMessage, 750 * i, target:getPosition())
end
end
end
end
return true
end
custom_exp_damage_effect:type("kill")
custom_exp_damage_effect:register()
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
local custom_exp_damage_effect_login = CreatureEvent("custom_exp_damage_effect_login")
function custom_exp_damage_effect_login.onLogin(player)
player:registerEvent("custom_exp_damage_effect")
return true
end
custom_exp_damage_effect_login:type("login")
custom_exp_damage_effect_login:register()
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
local custom_exp_damage_effect_movement = MoveEvent()
custom_exp_damage_effect_movement:type("stepin")
local function sendEffect(cid)
local player = Player(cid)
if not player then
return true
end
local pos = player:getPosition()
local pos2 = player:getPosition() + Position(math.random(-2, 2), math.random(-2, 2), 0)
pos2:sendDistanceEffect(pos, 31)
end
function custom_exp_damage_effect_movement.onStepIn(player, item, position, fromPosition)
if player:isMonster() then
return true
end
local tile = Tile(player:getPosition())
if tile then
local ground = tile:getGround()
if ground then
ground:setActionId()
player:setStorageValue(6000, os.time() + 60)
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have received double experience for the next 60 seconds.')
for i = 0, 25 do
addEvent(sendEffect, 100 * i, player:getId())
end
end
end
return true
end
custom_exp_damage_effect_movement:aid(6000)
custom_exp_damage_effect_movement:register()
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
local expCheck = TalkAction("!exp")
local function secondsToReadable(s)
local hours = math.floor(s / 3600)
local minutes = math.floor(math.fmod(s, 3600)/60)
local seconds = math.floor(math.fmod(s, 60))
return (hours > 0 and (hours .. ' hour' .. (hours > 1 and 's ' or ' ')) or '') ..
(minutes > 0 and (minutes .. ' minute' .. (minutes > 1 and 's ' or ' ')) or '') ..
(seconds > 0 and (seconds .. ' second' .. (seconds > 1 and 's ' or ' ')) or '')
end
function expCheck.onSay(player, words)
local exhaust = 6000
if player:getStorageValue(exhaust) - os.time() > 0 then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your extra exp will end in : "..player:getStorageValue(exhaust) - os.time().."")
return false
end
return false
end
expCheck:separator(" ")
expCheck:register()
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
local ec = EventCallback
function ec.onGainExperience(source, exp, rawExp)
if not source or source:isPlayer() then
return exp
end
if self:getStorageValue(6000) >= os.time() then
exp = exp * 2.00
end
return exp
end
ec:register(1)
Last edited by a moderator: