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

Bonus guild move sqm script 1.3 to 1.5 revscript

Thiagobs

New Member
Joined
Nov 18, 2014
Messages
24
Reaction score
1
Hello, i'm have problem to convert script 1.3 to 1.5.

when passing the actionid, guild1 gets a bonus, if another guild passes the actionid, the bonus will pass to guild2 and removed from guild1.


tfs 1.3
data/movements/scripts/guildexp.lua
if not guildExperienceBonus then
guildExperienceBonus = 0 -- default value; no guild
end

function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return true
end

local guild = player:getGuild()
if guild then
guildExperienceBonus = guild:getId()
player:sendTextMessage(MESSAGE_INFO_DESCR, 'Sua guild agora possui o bônus em experiência.')
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
end
return true
end

data/movements/movements.xm
<movevent event="StepIn" actionid="33462" script="guildexp.lua" />
data/events/scripts/player.lua
local guild = self:getGuild()
if guild and guild:getId() == guildExperienceBonus then
exp = exp * 1.2 -- 20% bonus
end
 
Last edited:
Try with:
Lua:
Game.setStorageValue(key, value)
Game.getStorageValue(key)

data\scripts\movements\guild_bonus.lua
Lua:
local guildBonus = MoveEvent()
guildBonus:type("stepin")
function guildBonus.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    local guild = player:getGuild()
    local guildBonusGid = Game.getStorageValue(GlobalStorageKeys.guildBonusGid) or 0
    if guild and guildBonusGid ~= guild:getId() then
        Game.setStorageValue(GlobalStorageKeys.guildBonusGid, guild:getId())
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'Sua guild agora possui o bônus em experiência.')
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    end

    return true
end
guildBonus:aid(33462)
guildBonus:register()

data\lib\core\storages.lua
Lua:
GlobalStorageKeys = {
    guildBonusGid = 1337
}

And in player.lua:
Lua:
local guildBonusGid = Game.getStorageValue(GlobalStorageKeys.guildBonusGid)
 
Back
Top