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

Windows Mods where?

how to make it? i stuck at the same point right now..
Well let's take a random mod from the released mods.
[MOD]Experience Scroll with time expire!
This mod is a bit less confusing then other mods I've seen, but it's basically the same thing each time.
You have a couple of events you need to register, and then create the lua scripts in the scripts folder.
For creaturescripts, you'll also need to register them in login.lua

For TFS 1.x+, you might need to update some of the functions, if the compat file doesn't allow it to work right away.

dara/actions/actions.xml
XML:
<action itemid="9004" event="script" value="expstagescroll.lua"/>
data/actions/scripts/expstagescroll.lua
Lua:
local config = {
   rate = 2,
   storage = 1000,
   expstorage = 1100,
   register = 1200,
   time = 14400,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if getPlayerStorageValue(cid, config.storage) <= 0 then
       local rates = getPlayerRates(cid)
       setPlayerStorageValue(cid, config.expstorage, rates[SKILL__LEVEL])
       setPlayerStorageValue(cid, config.register, 1)
       itemEx=itemid == 9004
       doCreatureSay(cid, "Your extra experience rate has been activated! It now is: " .. config.rate .. "x added to your former experience rate.", TALKTYPE_ORANGE_1, true, cid)
       setPlayerStorageValue(cid, config.storage, os.time()+config.time)
       doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]*config.rate)
       doRemoveItem(item.uid,1)
       registerCreatureEvent(cid, "ExpStage")
   else
       doCreatureSay(cid, "You must finish first exp condition to start other exp condition !", TALKTYPE_ORANGE_1, true, cid)
   end
   return true
end
data/creaturescripts/creaturescripts.xml
XML:
<creatureevent type="think" name="ExpStage" event="script" value="onThink_expstagescroll.lua"/>
<creatureevent type="login" name="ExpStageLogin" event="script" value="onLogin_expstagescroll.lua"/>
data/creaturescripts/scripts/onThink_expstagescroll.lua
Lua:
local config = {
   rate = 2,
   storage = 1000,
   expstorage = 1100,
   register = 1200,
   time = 14400,
}

function onThink(cid, interval)
   if getPlayerStorageValue(cid, config.register) == 1 then
       if getPlayerStorageValue(cid, config.storage) <= os.time() then
           doCreatureSay(cid, "Your extra experience rate has finished! It is now normaly experience rate.", TALKTYPE_ORANGE_1, true, cid)
           setPlayerStorageValue(cid, config.storage, 0)
           setPlayerStorageValue(cid, config.register, 0)
           local oldexp = getPlayerStorageValue(cid, config.expstorage)
           doPlayerSetExperienceRate(cid, oldexp)
           unregisterCreatureEvent(cid, "ExpStage")
       end
   end
   return true
end
data/creaturescripts/scripts/onLogin_expstagescroll.lua
Lua:
local config = {
   rate = 2,
   storage = 1000,
   expstorage = 1100,
   register = 1200,
   time = 14400,
}

function onLogin(cid)
   if getPlayerStorageValue(cid, config.register) == 1 then
       registerCreatureEvent(cid, "ExpStage")
       local rates = getPlayerRates(cid)
       doCreatureSay(cid, "Your extra experience rate is still here! It is: " .. config.rate .. "x added to your former experience rate.", TALKTYPE_ORANGE_1, true, cid)
       if getPlayerStorageValue(cid, config.storage) > os.time() then
       local oldexp = getPlayerStorageValue(cid, config.expstorage)
       doPlayerSetExperienceRate(cid, oldexp+config.rate)
       end
   end
   return true
end
data/creaturescripts/scripts/login.lua
Lua:
registerCreatureEvent(cid, "ExpStage")
registerCreatureEvent(cid, "ExpStageLogin")
 
Back
Top