• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

RevScripts โค โ„ฑ๐“‡๐‘’๐‘’ ๐’ฎ๐’ธ๐“‡๐’พ๐“…๐“‰๐’พ๐“ƒ๐‘” ๐’ฎ๐‘’๐“‡๐“‹๐’พ๐’ธ๐‘’ ๐’ฏโ„ฑ๐’ฎ ๐Ÿท.๐Ÿป+ โค

Sarah Wesker

เธ„โˆ‚vฮฑฮทcฮต เธฃาฏฮทั‚ฮฑx โค
Support Team
Joined
Mar 16, 2017
Messages
1,185
Solutions
128
Reaction score
1,459
Location
London
GitHub
MillhioreBT
Twitch
millhiore_bt
โค ๐…๐ซ๐ž๐ž ๐’๐œ๐ซ๐ข๐ฉ๐ญ๐ข๐ง๐  ๐’๐ž๐ซ๐ฏ๐ข๐œ๐ž ๐Ÿ.๐Ÿ“+ โค

๐Ÿ“š (ใฃโ—”โ—กโ—”)ใฃ โ„๐“ƒ๐’ป๐‘œ๐“‡๐“‚๐’ถ๐“‰๐’พ๐‘œ๐“ƒ ๐Ÿ“š
โค โ„ฐ๐“ƒ๐‘”๐’พ๐“ƒ๐‘’: ๐’ฏโ„ฑ๐’ฎ ๐’ช๐’ป๐’พ๐’ธ๐’พ๐’ถ๐“
โค โ„ฐ๐“ƒ๐‘”๐’พ๐“ƒ๐‘’ ๐’ฑ๐‘’๐“‡๐“ˆ๐’พ๐‘œ๐“ƒ: ๐Ÿท.๐Ÿป+

โš™๐Ÿ”งโ„‹๐‘œ๐“Œ ๐“‰๐‘œ ๐“‡๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰ ๐’ถ ๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰?
โค โ„ณ๐’ถ๐“€๐‘’ ๐“ˆ๐“Š๐“‡๐‘’ ๐“Ž๐‘œ๐“Š ๐“‚๐‘’๐‘’๐“‰ ๐“‰๐’ฝ๐‘’ ๐’ธ๐‘œ๐“‡๐“‡๐‘’๐’ธ๐“‰ ๐“‹๐‘’๐“‡๐“ˆ๐’พ๐‘œ๐“ƒ ๐’ถ๐“ƒ๐’น ๐‘’๐“ƒ๐‘”๐’พ๐“ƒ๐‘’.
โค ๐’ฏ๐“‡๐“Ž ๐“ƒ๐‘œ๐“‰ ๐“‰๐‘œ ๐“‚๐’ถ๐“€๐‘’ ๐“Ž๐‘œ๐“Š๐“‡ ๐“‡๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰ ๐“‰๐‘œ๐‘œ ๐’ธ๐‘œ๐“‚๐“…๐“๐‘’๐“, ๐’ถ๐“ˆ ๐“‰๐’ฝ๐‘’ ๐“ˆ๐’พ๐“‚๐“…๐“๐‘’๐“ˆ๐“‰ ๐‘œ๐“ƒ๐‘’๐“ˆ ๐“Œ๐’พ๐“๐“ ๐’ท๐‘’ ๐“‰๐’ถ๐“€๐‘’๐“ƒ ๐’ธ๐’ถ๐“‡๐‘’ ๐‘œ๐’ป ๐’ป๐’พ๐“‡๐“ˆ๐“‰.
โค ๐’ด๐‘œ๐“Š ๐’ถ๐‘”๐“‡๐‘’๐‘’ ๐“ƒ๐‘œ๐“‰ ๐“‰๐‘œ ๐’ป๐’พ๐“๐‘’ ๐’ถ ๐‘”๐“‡๐’พ๐‘’๐“‹๐’ถ๐“ƒ๐’ธ๐‘’๐“ˆ ๐’พ๐’ป ๐“Ž๐‘œ๐“Š๐“‡ ๐’ถ๐“…๐“…๐“๐’พ๐’ธ๐’ถ๐“‰๐’พ๐‘œ๐“ƒ ๐’พ๐“ˆ ๐’ถ๐’ธ๐’ธ๐‘’๐“…๐“‰๐‘’๐’น ๐’ท๐“Š๐“‰ ๐“ƒ๐‘’๐“‹๐‘’๐“‡ ๐“‡๐‘’๐“ˆ๐‘œ๐“๐“‹๐‘’๐’น.
โค ๐’ด๐‘œ๐“Š ๐“‚๐“Š๐“ˆ๐“‰ ๐’ฝ๐’ถ๐“‹๐‘’ ๐’ถ ๐’ธ๐‘’๐“‡๐“‰๐’ถ๐’พ๐“ƒ ๐“‡๐‘’๐“…๐“Š๐“‰๐’ถ๐“‰๐’พ๐‘œ๐“ƒ ๐’พ๐“ƒ ๐“‰๐’ฝ๐‘’ ๐’ป๐‘œ๐“‡๐“Š๐“‚, โ„ ๐’น๐‘œ ๐“ƒ๐‘œ๐“‰ ๐’ถ๐’ธ๐’ธ๐‘’๐“…๐“‰ ๐“‡๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰๐“ˆ ๐’ป๐‘œ๐“‡ ๐“ƒ๐‘’๐“Œ ๐‘œ๐“‡ ๐“ˆ๐“Š๐“ˆ๐“…๐’พ๐’ธ๐’พ๐‘œ๐“Š๐“ˆ ๐’ถ๐’ธ๐’ธ๐‘œ๐“Š๐“ƒ๐“‰๐“ˆ, ๐“‰๐“‡๐“Ž ๐“ƒ๐‘œ๐“‰ ๐“‰๐‘œ ๐“Š๐“ˆ๐‘’ โ„ฑ๐’œ๐’ฆโ„ฐ๐’ฎ.
โค โ„›๐‘’๐“‚๐‘’๐“‚๐’ท๐‘’๐“‡ ๐“‹๐‘’๐“‡๐“Ž ๐“Œ๐‘’๐“๐“ ๐“‰๐’ฝ๐’ถ๐“‰ ๐’พ๐“‰ ๐’พ๐“ˆ ๐’ป๐‘œ๐“‡ ๐’ช๐’ป๐’ป๐’พ๐’ธ๐’พ๐’ถ๐“ ๐’ฏโ„ฑ๐’ฎ ๐“ˆ๐‘œ ๐’น๐‘œ๐“ƒ'๐“‰ ๐’ท๐‘œ๐“‰๐’ฝ๐‘’๐“‡ ๐’ถ๐“ˆ๐“€๐’พ๐“ƒ๐‘” ๐’ป๐‘œ๐“‡ ๐“ˆ๐‘œ๐“‚๐‘’๐“‰๐’ฝ๐’พ๐“ƒ๐‘” ๐’ป๐‘œ๐“‡ ๐“Ž๐‘œ๐“Š๐“‡ ๐‘œ๐“‰๐’ฝ๐‘’๐“‡ ๐‘’๐“ƒ๐‘”๐’พ๐“ƒ๐‘’, ๐’ถ๐“ˆ โ„ ๐“Œ๐’พ๐“๐“ ๐’พ๐‘”๐“ƒ๐‘œ๐“‡๐‘’ ๐“ˆ๐’ถ๐’พ๐’น ๐“‡๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰.
โค ๐’ฏ๐’ฝ๐‘’ ๐’น๐‘’๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰๐’พ๐‘œ๐“ƒ ๐“‚๐“Š๐“ˆ๐“‰ ๐’ท๐‘’ ๐’พ๐“ƒ โ„ฐ๐“ƒ๐‘”๐“๐’พ๐“ˆ๐’ฝ ๐’ถ๐“ƒ๐’น ๐“Œ๐‘’๐“๐“ ๐‘’๐“๐“…๐“๐’ถ๐’พ๐“ƒ๐‘’๐’น ๐“Œ๐’พ๐“‰๐’ฝ๐‘œ๐“Š๐“‰ ๐“‰๐‘œ๐‘œ ๐“‚๐’ถ๐“ƒ๐“Ž ๐“Œ๐‘œ๐“‡๐’น๐“ˆ.

๐ŸŽ€โ„‹๐‘œ๐“Œ ๐’น๐‘œ โ„ ๐“€๐“ƒ๐‘œ๐“Œ ๐’พ๐’ป ๐“‚๐“Ž ๐’ถ๐“…๐“…๐“๐’พ๐’ธ๐’ถ๐“‰๐’พ๐‘œ๐“ƒ ๐“Œ๐’ถ๐“ˆ ๐’ถ๐’ธ๐’ธ๐‘’๐“…๐“‰๐‘’๐’น?๐ŸŽ€
โค โ„๐’ป ๐“Ž๐‘œ๐“Š๐“‡ ๐“‡๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰ ๐’ฝ๐’ถ๐“ˆ ๐“‚๐“Ž ๐“๐’พ๐“€๐‘’, ๐’พ๐“‰ ๐“‚๐‘’๐’ถ๐“ƒ๐“ˆ ๐“‰๐’ฝ๐’ถ๐“‰ ๐’พ๐“‰ ๐“Œ๐’ถ๐“ˆ ๐’ถ๐’ธ๐’ธ๐‘’๐“…๐“‰๐‘’๐’น.
โค โ„๐’ป ๐“Ž๐‘œ๐“Š๐“‡ ๐“‡๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰ ๐’พ๐“ˆ ๐’ถ๐’ธ๐’ธ๐‘’๐“…๐“‰๐‘’๐’น, ๐“Ž๐‘œ๐“Š ๐’ฟ๐“Š๐“ˆ๐“‰ ๐’ฝ๐’ถ๐“‹๐‘’ ๐“‰๐‘œ ๐“Œ๐’ถ๐’พ๐“‰ ๐’ป๐‘œ๐“‡ ๐“‚๐‘’ ๐“‰๐‘œ ๐’ถ๐“ƒ๐“ˆ๐“Œ๐‘’๐“‡ ๐“Ž๐‘œ๐“Š๐“‡ ๐“‡๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰.

๐’ฏ๐’ฝ๐’พ๐“ˆ ๐’พ๐“ˆ ๐“‚๐“Ž ๐‘œ๐“๐’น ๐’ป๐“‡๐‘’๐‘’ ๐“ˆ๐‘’๐“‡๐“‹๐’พ๐’ธ๐‘’๐“ˆ ๐“‰๐’ฝ๐“‡๐‘’๐’ถ๐’น ๐’พ๐’ป ๐“Ž๐‘œ๐“Š'๐’น ๐“๐’พ๐“€๐‘’ ๐“‰๐‘œ ๐’ธ๐’ฝ๐‘’๐’ธ๐“€ ๐’ท๐‘’๐’ป๐‘œ๐“‡๐‘’ ๐“Ž๐‘œ๐“Š ๐’ถ๐“ˆ๐“€ ๐’ป๐‘œ๐“‡ ๐“ˆ๐‘œ๐“‚๐‘’๐“‰๐’ฝ๐’พ๐“ƒ๐‘” ๐“‡๐‘’๐“…๐‘’๐’ถ๐“‰๐‘’๐’น.

๐Ÿ“Œ โ„›๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰ ๐‘’๐“๐’ถ๐“‚๐“…๐“๐‘’: ๐Ÿ“Œ

โ„ฐ๐“ƒ๐‘”๐’พ๐“ƒ๐‘’ ๐’ถ๐“ƒ๐’น ๐’ฑ๐‘’๐“‡๐“ˆ๐’พ๐‘œ๐“ƒ โœ…
๐’Ÿ๐‘’๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰๐’พ๐‘œ๐“ƒ ๐Ÿ“‘
...
 

dewral

Banned User
Joined
Dec 4, 2019
Messages
303
Solutions
10
Reaction score
206
Hey!
Nice to see something like this again :D
Can i ask for a script that when you enter a tile you gain a condition critical etc with storage for it.
something like similiar?

Lua:
function onStepIn(creature, item, position, fromPosition)
    if creature:isMonster() then
        return true
    end
    if creature:getStorageValue((8854+item:getActionId())) <= 0 then
        creature:setStorageValue((8854+item:getActionId()),1)
        creature:setMaxHealth(creature:getMaxHealth() + 100000)
        creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        creature:sendTextMessage(MESSAGE_INFO_DESCR, 'You have absorbed the dark energy.')
        creature:say('Damn i feel so much stronger!',TALKTYPE_MONSTER_SAY)
    else
        creature:teleportTo(fromPosition)
        creature:sendTextMessage(MESSAGE_INFO_DESCR, 'You already absorbed that dark energy!')
        creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    end
end
Bassicaly i just wanna make player gain certain amount of % critical, hp etc :D
I hope it's not a big deal :D
 

sururuts

Member
Joined
Sep 14, 2010
Messages
37
Reaction score
8
Maybe a faction fighting script, the concept is basic and is present in various other MMO's and i don't think i've ever seen it on tibia

1. people would be allowed to choose between 2 factions, and they would be able to kill players from the other faction without any punishment, and unable to attack players from the same faction...

2.to make it more interesting maybe some points could be added as a reward when you kill players from the other faction, or even a killcount for players

3. the fighting could be delimited maybe to work only on a certain zone (like PVP or no loggout), but could work on the entire map as well
 

Evil Puncker

I know nothing
TFS Developer
Joined
May 30, 2009
Messages
8,507
Solutions
260
Reaction score
4,455
engine: tfs master
version: latest

Wedding/Marriage System

2022-05-31 20_33_10-dream.otbm_ - Remere's Map Editor.png

  • players will stay on the two SQM (any sex)
  • it will cost 50k from each player (configurable)
  • it will cost 1x item id 10503 (wedding outfit box) from each player (configurable)
  • it will broadcast or not that the marriage occurred (configurable)
  • both players need to pull the lever to confirm

checks:
  • if player is already married
  • if player level is higher than 20 (configurable)

on success:
- players onLook will show: "married to playername"
Lua:
function Player:getMarriageDescription(thing)
    local descr = ""
    if getPlayerMarriageStatus(thing:getGuid()) == MARRIED_STATUS then
        playerSpouse = getPlayerSpouse(thing:getGuid())
        if self == thing then
            descr = descr .. " You are "
        elseif thing:getSex() == PLAYERSEX_FEMALE then
            descr = descr .. " She is "
        else
            descr = descr .. " He is "
        end
        descr = descr .. "married to " .. getPlayerNameById(playerSpouse) .. '.'
    end
    return descr
end
(old code by @Godely just for example)
- players will receive 10502 (engraved wedding ring) with description like this:
Lua:
                        local item1 = Item(doPlayerAddItem(cid, 10502, 1))
                        local item2 = Item(doPlayerAddItem(cid, 10502, 1))
                        item1:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, player:getName() .. ' & ' .. getPlayerNameById(candidate) .. ' forever - married on ' .. os.date('%B %d, %Y.'))
                        item2:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, player:getName() .. ' & ' .. getPlayerNameById(candidate) .. ' forever - married on ' .. os.date('%B %d, %Y.'))
(old code by @Godely just for example)
- both players will receive outfit: 329 and 328 (they don't have addons)

Divorce

divorcing will also be possible by using !divorce talkaction

  • it will cost 50k (configurable)
  • players don't need to be online
  • if they have the 10502 (engraved wedding ring) on their backpack or equipped it will transform into 10510 (broken wedding ring)
  • add option if they can keep the outfit or not
 
Last edited:
OP
OP
Sarah Wesker

Sarah Wesker

เธ„โˆ‚vฮฑฮทcฮต เธฃาฏฮทั‚ฮฑx โค
Support Team
Joined
Mar 16, 2017
Messages
1,185
Solutions
128
Reaction score
1,459
Location
London
GitHub
MillhioreBT
Twitch
millhiore_bt
Hey!
Nice to see something like this again :D
Can i ask for a script that when you enter a tile you gain a condition critical etc with storage for it.
something like similiar?

Lua:
function onStepIn(creature, item, position, fromPosition)
    if creature:isMonster() then
        return true
    end
    if creature:getStorageValue((8854+item:getActionId())) <= 0 then
        creature:setStorageValue((8854+item:getActionId()),1)
        creature:setMaxHealth(creature:getMaxHealth() + 100000)
        creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        creature:sendTextMessage(MESSAGE_INFO_DESCR, 'You have absorbed the dark energy.')
        creature:say('Damn i feel so much stronger!',TALKTYPE_MONSTER_SAY)
    else
        creature:teleportTo(fromPosition)
        creature:sendTextMessage(MESSAGE_INFO_DESCR, 'You already absorbed that dark energy!')
        creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    end
end
Bassicaly i just wanna make player gain certain amount of % critical, hp etc :D
I hope it's not a big deal :D

โ„‹๐‘’๐“๐“๐‘œ, โ„ ๐’ฝ๐’ถ๐“‹๐‘’ ๐’ถ๐’ธ๐’ธ๐‘’๐“…๐“‰๐‘’๐’น ๐“Ž๐‘œ๐“Š๐“‡ ๐“‡๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰. โœ…

โ„ ๐’ฝ๐‘œ๐“…๐‘’ ๐“‰๐’ฝ๐’ถ๐“‰ ๐“‰๐’ฝ๐‘’ ๐“‡๐‘’๐“ˆ๐“Š๐“๐“‰ ๐’พ๐“ˆ ๐“ˆ๐’พ๐“‚๐’พ๐“๐’ถ๐“‡ ๐‘’๐“ƒ๐‘œ๐“Š๐‘”๐’ฝ ๐“‰๐‘œ ๐“Œ๐’ฝ๐’ถ๐“‰ ๐“Ž๐‘œ๐“Š ๐’ถ๐“ˆ๐“€๐‘’๐’น ๐’ป๐‘œ๐“‡ ๐’ถ๐“ƒ๐’น ๐“‰๐’ฝ๐’ถ๐“‰ ๐“Ž๐‘œ๐“Š ๐“๐’พ๐“€๐‘’ ๐’พ๐“‰ ๐’ถ ๐“๐‘œ๐“‰.
โ„›๐‘’๐“ˆ๐“Š๐“๐“‰:
data/scripts/darkenergy_buff.lua
Lua:
local config = {
    talkAction = "!darkenergy", --Only for ACCOUNT_TYPE_GOD accounts
    actionId = 56500,
    storageBase = 88000,
    successMessages = "You have absorbed the dark energy.",
    successSay = "Damn i feel so much stronger!",
    successEffect = CONST_ME_MAGIC_GREEN,
    failMessage = "You already absorbed that dark energy!",
    failEffect = CONST_ME_MAGIC_RED,

    rewards = {
    --[[1]] { type=SKILL_SWORD, value=10 },
    --[[2]] { type=SKILL_AXE, value=10 },
    --[[3]] { type=SKILL_CLUB, value=10 },
    --[[4]] { type=SKILL_DISTANCE, value=10 },
    --[[5]] { type=SKILL_SHIELD, value=10 },
    --[[6]] { type=SKILL_FIST, value=10 },
    --[[7]] { type=SKILL_FISHING, value=10 },
    --[[8]] { type=SPECIALSKILL_CRITICALHITCHANCE, value=10 },
    --[[9]] { type=SPECIALSKILL_CRITICALHITAMOUNT, value=10 },
    --[[10]] { type=SPECIALSKILL_LIFELEECHCHANCE, value=10 },
    --[[11]] { type=SPECIALSKILL_LIFELEECHAMOUNT, value=10 },
    --[[12]] { type=SPECIALSKILL_MANALEECHCHANCE, value=10 },
    --[[13]] { type=SPECIALSKILL_MANALEECHAMOUNT, value=10 },
    --[[14]] { type=STAT_MAXHITPOINTS, value=1000 },
    --[[15]] { type=STAT_MAXMANAPOINTS, value=1000 },
    --[[16]] { type=STAT_MAGICPOINTS, value=10 }
    }
}

local conditions = {
    --[[1]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_SWORD},
    --[[2]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_AXE},
    --[[3]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_CLUB},
    --[[4]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_DISTANCE},
    --[[5]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_SHIELD},
    --[[6]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_FIST},
    --[[7]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_FISHING},
    --[[8]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_CRITICALHITCHANCE},
    --[[9]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_CRITICALHITAMOUNT},
    --[[10]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_LIFELEECHCHANCE},
    --[[11]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_LIFELEECHAMOUNT},
    --[[12]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_MANALEECHCHANCE},
    --[[13]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_MANALEECHAMOUNT},
    --[[14]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_STAT_MAXHITPOINTS},
    --[[15]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_STAT_MAXMANAPOINTS},
    --[[16]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_STAT_MAGICPOINTS}
}

local function getCustomSkillLevel(player, index)
    local storageBase = config.storageBase + index
    if player.storage[storageBase] == -1 then
        player.storage[storageBase] = 0
        return 0
    end

    return player.storage[storageBase]
end

local function setCustomSkillLevel(player, index, skillId, value)
    player.storage[config.storageBase + index] = value
    local reward = conditions[index]
    if not reward then
        return error("WTF!")
    end
    if not value or value == 0 then
        local condition = player:getCondition(reward.type, CONDITIONID_DEFAULT, config.storageBase + index)
        if not condition then
            return
        end
        return player:removeCondition(condition)
    end
    local condition = Condition(reward.type, CONDITIONID_DEFAULT)
    condition:setParameter(CONDITION_PARAM_TICKS, -1)
    condition:setParameter(CONDITION_PARAM_SUBID, config.storageBase + index)
    condition:setParameter(reward.param, value)
    return player:addCondition(condition)
end

local function addPlayerDarkEnergy(player, fromPosition)
    if player.storage[config.storageBase] ~= 1 then
        player.storage[config.storageBase] = 1
        for index, reward in pairs(config.rewards) do
            setCustomSkillLevel(player, index, reward.type, reward.value)
        end
        player:getPosition():sendMagicEffect(config.successEffect)
        player:sendTextMessage(MESSAGE_INFO_DESCR, config.successMessages)
        player:say(config.successSay, TALKTYPE_MONSTER_SAY)
    else
        player:teleportTo(fromPosition)
        player:sendTextMessage(MESSAGE_INFO_DESCR, config.failMessage)
        player:getPosition():sendMagicEffect(config.failEffect)
    end
end

local moveevent = MoveEvent()

function moveevent.onStepIn(creature, item, pos, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end
    addPlayerDarkEnergy(player, fromPosition)
    return true
end

moveevent:aid(config.actionId)
moveevent:register()

local creatureEvent = CreatureEvent("DarkEnergyLoad")

function creatureEvent.onLogin(player)
    for index, reward in pairs(config.rewards) do
        local value = getCustomSkillLevel(player, index)
        if value ~= 0 then
            setCustomSkillLevel(player, index, reward.type, value)
        end
    end
    return true
end

creatureEvent:register()

local talkAction = TalkAction(config.talkAction)

function talkAction.onSay(player, words, param, type)
    local split = param:split(",")
    if split[1] == "reset" then
        local target = Player(split[2]) or player
        target.storage[config.storageBase] = -1
        for index, reward in pairs(config.rewards) do
            setCustomSkillLevel(target, index, reward.type, 0)
        end
        return false
    elseif split[1] == "give" then
        addPlayerDarkEnergy(Player(split[2]) or player, player:getPosition())
        return false
    end

    player:popupFYI(string.format("Available parameters:\nreset\ngive\n\nExamples:\n%s give\n%s reset\n\nIf you want to apply the effects to another player,\njust write the player's name as the second parameter.\nExamples:\n%s give,Sarah\n%s reset,Sarah", config.talkAction, config.talkAction, config.talkAction, config.talkAction))
    return false
end

talkAction:accountType(ACCOUNT_TYPE_GOD)
talkAction:separator(" ")
talkAction:register()

๐’ฉ๐‘œ๐“‰๐‘’: ๐“‡๐‘’๐“‚๐‘’๐“‚๐’ท๐‘’๐“‡ ๐“‰๐’ฝ๐’ถ๐“‰ ๐“Ž๐‘œ๐“Š ๐’ธ๐’ถ๐“ƒ ๐“Š๐“ˆ๐‘’ ๐“‰๐’ฝ๐‘’ ๐’ธ๐‘œ๐“ƒ๐’ป๐’พ๐‘”.๐“‰๐’ถ๐“๐“€๐’œ๐’ธ๐“‰๐’พ๐‘œ๐“ƒ ๐“‰๐’ถ๐“๐“€๐’ถ๐’ธ๐“‰๐’พ๐‘œ๐“ƒ ๐“‰๐‘œ ๐’ถ๐’น๐’น ๐‘œ๐“‡ ๐“‡๐‘’๐“‚๐‘œ๐“‹๐‘’ ๐“‰๐’ฝ๐’พ๐“ˆ ๐’ท๐“Š๐’ป๐’ป ๐’ป๐“‡๐‘œ๐“‚ ๐’ถ ๐“…๐“๐’ถ๐“Ž๐‘’๐“‡.
โ„ฐ๐“๐’ถ๐“‚๐“…๐“๐‘’๐“ˆ:
โค !darkenergy give Laniakea
โค !darkenergy reset Laniakea
๐’ช๐“‡ ๐’ป๐‘œ๐“‡ ๐“Ž๐‘œ๐“Š๐“‡๐“ˆ๐‘’๐“๐’ป:

โค !darkenergy give
โค !darkenergy reset
โ—โ„๐“‚๐“…๐‘œ๐“‡๐“‰๐’ถ๐“ƒ๐“‰โ—: ๐’ฏ๐’ฝ๐’พ๐“ˆ ๐“‰๐’ถ๐“๐“€๐’ถ๐’ธ๐“‰๐’พ๐‘œ๐“ƒ ๐’พ๐“ˆ ๐’ป๐‘œ๐“‡ ๐’ข๐’ช๐’Ÿ ๐’ถ๐’ธ๐’ธ๐‘œ๐“Š๐“ƒ๐“‰ ๐‘œ๐“ƒ๐“๐“Ž.


๐ŸŽž ๐’ฑ๐’พ๐“ˆ๐“Š๐’ถ๐“๐’พ๐“๐’ถ๐“‰๐’พ๐‘œ๐“ƒ ๐‘œ๐’ป ๐’ถ ๐“…๐“๐’ถ๐“Ž๐‘’๐“‡ ๐’ถ๐’ธ๐“‰๐’พ๐“‹๐’ถ๐“‰๐’พ๐“ƒ๐‘” ๐‘œ๐“ƒ๐’ฎ๐“‰๐‘’๐“…โ„๐“ƒ ๐ŸŽž


GIF 31-05-2022 09-41-45 p. m..gif
 

Repsor

New Member
Joined
May 26, 2022
Messages
10
Solutions
1
Reaction score
0
What about a shortcut system ? :D so that player need to find shortcuts on the map and can teleport there from temple as example or they can chose the shortcut from a item :D
 

tomaszek123

New Member
Joined
May 29, 2014
Messages
23
Solutions
1
Reaction score
3
Hi,

A room with a door when 1 player get inside no one else can get through the door untill the first player gets out of a room by a teleport.


And a room that you can get through the door only at specific time once a day with a broadcast message.

Thanks
 

dewral

Banned User
Joined
Dec 4, 2019
Messages
303
Solutions
10
Reaction score
206
โ„‹๐‘’๐“๐“๐‘œ, โ„ ๐’ฝ๐’ถ๐“‹๐‘’ ๐’ถ๐’ธ๐’ธ๐‘’๐“…๐“‰๐‘’๐’น ๐“Ž๐‘œ๐“Š๐“‡ ๐“‡๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰. โœ…

โ„ ๐’ฝ๐‘œ๐“…๐‘’ ๐“‰๐’ฝ๐’ถ๐“‰ ๐“‰๐’ฝ๐‘’ ๐“‡๐‘’๐“ˆ๐“Š๐“๐“‰ ๐’พ๐“ˆ ๐“ˆ๐’พ๐“‚๐’พ๐“๐’ถ๐“‡ ๐‘’๐“ƒ๐‘œ๐“Š๐‘”๐’ฝ ๐“‰๐‘œ ๐“Œ๐’ฝ๐’ถ๐“‰ ๐“Ž๐‘œ๐“Š ๐’ถ๐“ˆ๐“€๐‘’๐’น ๐’ป๐‘œ๐“‡ ๐’ถ๐“ƒ๐’น ๐“‰๐’ฝ๐’ถ๐“‰ ๐“Ž๐‘œ๐“Š ๐“๐’พ๐“€๐‘’ ๐’พ๐“‰ ๐’ถ ๐“๐‘œ๐“‰.
โ„›๐‘’๐“ˆ๐“Š๐“๐“‰:
data/scripts/darkenergy_buff.lua
Lua:
local config = {
    talkAction = "!darkenergy", --Only for ACCOUNT_TYPE_GOD accounts
    actionId = 56500,
    storageBase = 88000,
    successMessages = "You have absorbed the dark energy.",
    successSay = "Damn i feel so much stronger!",
    successEffect = CONST_ME_MAGIC_GREEN,
    failMessage = "You already absorbed that dark energy!",
    failEffect = CONST_ME_MAGIC_RED,

    rewards = {
    --[[1]] { type=SKILL_SWORD, value=10 },
    --[[2]] { type=SKILL_AXE, value=10 },
    --[[3]] { type=SKILL_CLUB, value=10 },
    --[[4]] { type=SKILL_DISTANCE, value=10 },
    --[[5]] { type=SKILL_SHIELD, value=10 },
    --[[6]] { type=SKILL_FIST, value=10 },
    --[[7]] { type=SKILL_FISHING, value=10 },
    --[[8]] { type=SPECIALSKILL_CRITICALHITCHANCE, value=10 },
    --[[9]] { type=SPECIALSKILL_CRITICALHITAMOUNT, value=10 },
    --[[10]] { type=SPECIALSKILL_LIFELEECHCHANCE, value=10 },
    --[[11]] { type=SPECIALSKILL_LIFELEECHAMOUNT, value=10 },
    --[[12]] { type=SPECIALSKILL_MANALEECHCHANCE, value=10 },
    --[[13]] { type=SPECIALSKILL_MANALEECHAMOUNT, value=10 },
    --[[14]] { type=STAT_MAXHITPOINTS, value=1000 },
    --[[15]] { type=STAT_MAXMANAPOINTS, value=1000 },
    --[[16]] { type=STAT_MAGICPOINTS, value=10 }
    }
}

local conditions = {
    --[[1]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_SWORD},
    --[[2]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_AXE},
    --[[3]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_CLUB},
    --[[4]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_DISTANCE},
    --[[5]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_SHIELD},
    --[[6]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_FIST},
    --[[7]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SKILL_FISHING},
    --[[8]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_CRITICALHITCHANCE},
    --[[9]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_CRITICALHITAMOUNT},
    --[[10]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_LIFELEECHCHANCE},
    --[[11]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_LIFELEECHAMOUNT},
    --[[12]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_MANALEECHCHANCE},
    --[[13]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_SPECIALSKILL_MANALEECHAMOUNT},
    --[[14]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_STAT_MAXHITPOINTS},
    --[[15]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_STAT_MAXMANAPOINTS},
    --[[16]] {type=CONDITION_ATTRIBUTES, param=CONDITION_PARAM_STAT_MAGICPOINTS}
}

local function getCustomSkillLevel(player, index)
    local storageBase = config.storageBase + index
    if player.storage[storageBase] == -1 then
        player.storage[storageBase] = 0
        return 0
    end

    return player.storage[storageBase]
end

local function setCustomSkillLevel(player, index, skillId, value)
    player.storage[config.storageBase + index] = value
    local reward = conditions[index]
    if not reward then
        return error("WTF!")
    end
    if not value or value == 0 then
        local condition = player:getCondition(reward.type, CONDITIONID_DEFAULT, config.storageBase + index)
        if not condition then
            return
        end
        return player:removeCondition(condition)
    end
    local condition = Condition(reward.type, CONDITIONID_DEFAULT)
    condition:setParameter(CONDITION_PARAM_TICKS, -1)
    condition:setParameter(CONDITION_PARAM_SUBID, config.storageBase + index)
    condition:setParameter(reward.param, value)
    return player:addCondition(condition)
end

local function addPlayerDarkEnergy(player, fromPosition)
    if player.storage[config.storageBase] ~= 1 then
        player.storage[config.storageBase] = 1
        for index, reward in pairs(config.rewards) do
            setCustomSkillLevel(player, index, reward.type, reward.value)
        end
        player:getPosition():sendMagicEffect(config.successEffect)
        player:sendTextMessage(MESSAGE_INFO_DESCR, config.successMessages)
        player:say(config.successSay, TALKTYPE_MONSTER_SAY)
    else
        player:teleportTo(fromPosition)
        player:sendTextMessage(MESSAGE_INFO_DESCR, config.failMessage)
        player:getPosition():sendMagicEffect(config.failEffect)
    end
end

local moveevent = MoveEvent()

function moveevent.onStepIn(creature, item, pos, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end
    addPlayerDarkEnergy(player, fromPosition)
    return true
end

moveevent:aid(config.actionId)
moveevent:register()

local creatureEvent = CreatureEvent("DarkEnergyLoad")

function creatureEvent.onLogin(player)
    for index, reward in pairs(config.rewards) do
        local value = getCustomSkillLevel(player, index)
        if value ~= 0 then
            setCustomSkillLevel(player, index, reward.type, value)
        end
    end
    return true
end

creatureEvent:register()

local talkAction = TalkAction(config.talkAction)

function talkAction.onSay(player, words, param, type)
    local split = param:split(",")
    if split[1] == "reset" then
        local target = Player(split[2]) or player
        target.storage[config.storageBase] = -1
        for index, reward in pairs(config.rewards) do
            setCustomSkillLevel(target, index, reward.type, 0)
        end
        return false
    elseif split[1] == "give" then
        addPlayerDarkEnergy(Player(split[2]) or player, player:getPosition())
        return false
    end

    player:popupFYI(string.format("Available parameters:\nreset\ngive\n\nExamples:\n%s give\n%s reset\n\nIf you want to apply the effects to another player,\njust write the player's name as the second parameter.\nExamples:\n%s give,Sarah\n%s reset,Sarah", config.talkAction, config.talkAction, config.talkAction, config.talkAction))
    return false
end

talkAction:accountType(ACCOUNT_TYPE_GOD)
talkAction:separator(" ")
talkAction:register()

๐’ฉ๐‘œ๐“‰๐‘’: ๐“‡๐‘’๐“‚๐‘’๐“‚๐’ท๐‘’๐“‡ ๐“‰๐’ฝ๐’ถ๐“‰ ๐“Ž๐‘œ๐“Š ๐’ธ๐’ถ๐“ƒ ๐“Š๐“ˆ๐‘’ ๐“‰๐’ฝ๐‘’ ๐’ธ๐‘œ๐“ƒ๐’ป๐’พ๐‘”.๐“‰๐’ถ๐“๐“€๐’œ๐’ธ๐“‰๐’พ๐‘œ๐“ƒ ๐“‰๐’ถ๐“๐“€๐’ถ๐’ธ๐“‰๐’พ๐‘œ๐“ƒ ๐“‰๐‘œ ๐’ถ๐’น๐’น ๐‘œ๐“‡ ๐“‡๐‘’๐“‚๐‘œ๐“‹๐‘’ ๐“‰๐’ฝ๐’พ๐“ˆ ๐’ท๐“Š๐’ป๐’ป ๐’ป๐“‡๐‘œ๐“‚ ๐’ถ ๐“…๐“๐’ถ๐“Ž๐‘’๐“‡.
โ„ฐ๐“๐’ถ๐“‚๐“…๐“๐‘’๐“ˆ:
โค !darkenergy give Laniakea
โค !darkenergy reset Laniakea
๐’ช๐“‡ ๐’ป๐‘œ๐“‡ ๐“Ž๐‘œ๐“Š๐“‡๐“ˆ๐‘’๐“๐’ป:

โค !darkenergy give
โค !darkenergy reset
โ—โ„๐“‚๐“…๐‘œ๐“‡๐“‰๐’ถ๐“ƒ๐“‰โ—: ๐’ฏ๐’ฝ๐’พ๐“ˆ ๐“‰๐’ถ๐“๐“€๐’ถ๐’ธ๐“‰๐’พ๐‘œ๐“ƒ ๐’พ๐“ˆ ๐’ป๐‘œ๐“‡ ๐’ข๐’ช๐’Ÿ ๐’ถ๐’ธ๐’ธ๐‘œ๐“Š๐“ƒ๐“‰ ๐‘œ๐“ƒ๐“๐“Ž.


๐ŸŽž ๐’ฑ๐’พ๐“ˆ๐“Š๐’ถ๐“๐’พ๐“๐’ถ๐“‰๐’พ๐‘œ๐“ƒ ๐‘œ๐’ป ๐’ถ ๐“…๐“๐’ถ๐“Ž๐‘’๐“‡ ๐’ถ๐’ธ๐“‰๐’พ๐“‹๐’ถ๐“‰๐’พ๐“ƒ๐‘” ๐‘œ๐“ƒ๐’ฎ๐“‰๐‘’๐“…โ„๐“ƒ ๐ŸŽž


View attachment 68234
Perfect ๐Ÿ’ชThank you!
 

Landera

Veteran OT User
Joined
Nov 24, 2011
Messages
887
Solutions
1
Reaction score
289
Tfs 1.5

Like to have a reverse oracle, I did already made a concept. It basically reset all skills and send you to rook without a vocation at lvl 1.

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)            npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)        npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)        npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                npcHandler:onThink()                    end

if msgcontains(msg, 'rookgaard') then
    npcHandler:say('Hmmm. Long time I visited that isle. Not very exciting place. Why do you ask? Do you wish to go there?')
    talk_state = 3
   
    elseif msgcontains(msg, 'yes') and talk_state == 3 then
    npcHandler:say('Careful, careful, it\'s a one-way ticket only! You can never come back here if you leave now, and you will lose all your equipment and products!?')
    talk_state = 4
    elseif msgcontains(msg, 'no') and talk_state == 3 then
    npcHandler:say('A wise decision. It\'s much better here, believe me. Been there, done that.')
    talk_state = 0
   
    elseif msgcontains(msg, 'yes') and talk_state == 4 then
    npcHandler:say('Then so be it. I\'m sorry to see you go, but if this is what you want, step this way... right. Now, cover your eyes... GO!')

    doPlayerSetVocation(cid, 0)
    doPlayerSetTown(cid, 1)

    doPlayerSetMagicLevel(cid, 0)
    doPlayerSetSkillLevel(cid, SKILL_SHIELD, 10)
    doPlayerSetSkillLevel(cid, SKILL_DISTANCE, 10)
    doPlayerSetSkillLevel(cid, SKILL_AXE, 10)
     doPlayerSetSkillLevel(cid, SKILL_SWORD, 10)
    doPlayerSetSkillLevel(cid, SKILL_CLUB, 10)
    player:removeExperience(player:getExperience() - getExpForLevel(1), false)  
    player:setMaxHealth(150)
    player:setMaxMana(55)
    player:addHealth(player:getMaxHealth())
    player:addMana(player:getMaxMana())
    player:setCapacity(400)

    doTeleportThing(cid, {x=32097,y=32219,z=7})
    doSendMagicEffect(destination, CONST_ME_MAGIC_BLUE)

    local slots = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
    for _, slot in pairs(slots) do
    local item = player:getSlotItem(slot)
    if item then
        item:remove()
    end
end

    doPlayerAddItem(cid, 1987, 1)
    doAddContainerItem(bag,2650,1)
    doAddContainerItem(bag,2382,1)
    doAddContainerItem(bag,2674,1)
end

npcHandler:addModule(FocusModule:new())
 
Last edited:

tomaszek123

New Member
Joined
May 29, 2014
Messages
23
Solutions
1
Reaction score
3
Request:
Tfs 1.5

A script that allows me to put specific item to loot from all monsters in the game.

For example, 1% chance to drop 1cc from rotworm with text above corpse once dropped.
It would be easier than editing every single monster in the game.

Thanks
 

Chriistian.L.B

Intermediate OT User
Joined
Apr 17, 2008
Messages
205
Solutions
4
Reaction score
105
I would like a script of a box that of random items with a percentage of chance of coming X item, the percentage would also have a category being: Common, Uncommon, Semi-rare, rare, legendary.
 

rlx

Well-Known Member
Joined
Feb 25, 2019
Messages
133
Solutions
1
Reaction score
68

Stanos

Veteran OT User
Joined
Jun 12, 2018
Messages
539
Reaction score
272
Location
Europe
Talkaction script

Short about the system, basically its same like twitch prediction system, admin creates a voting pool for example /predict, will this system be created?, probably not, yes, REWARDID, 50


/predict (is talkaction name)
will this system be created? (is asked question)
probably not (answer 1)
yes (answer 2)
REWARDID, 50 (reward item id if answer is correct)

So once u boradcast this shit, people sees it in broadcast that stays in your screen and they would need to type for example /answer, 1, once they type it it would show precentage how many people choosed which answer, and lets say the event caster decides to set answer "yes" with talkaction /setanswer, 1 people who votes yes gets the reward and thats it.

Requirements

  • Can set custom answer names
  • Can set custom question
  • Can set rewards
  • Broadcast the global message that stays in the screen until event is closed
  • Have only 2 minutes to pick the answer, if 2 minutes passes voting is closed
  • Shows the precentage how many people choosed the X answer
  • When 2 minutes passes the caster can set the correct answer with talkaction /setanswer, 1
  • People who picked the selected answer gets the reward and people who didnt doesnt get it
  • Another custom feature that could spice shit up even more is, if there was posibility to put your own items on line from exmaple if you set up in config gamble = true it would require you to put your own item for gamble to pick a answer so lets say the caster makes it like this /predict, blablala, yes, no, 2160, 50 it means you need 50 gold to choose a answer and if you choose correct answer it double your gold, same with other items if the caster chooses to put on the event it always doubles your bet if u win, but if you lose, you lose all
  • Thats it, this is video example of the system
 

3zequi3l

New Member
Joined
Jan 14, 2021
Messages
5
Reaction score
0
Location
Mรฉxico
Hello good evening, according to the Tibiaface Slot system, it can be modified so that it appears what attributes to put on the item? please... here I leave the script:

Lua:
--------------------------
-- Creaditos: [Adm] SevuOT de tibiaface.com
-- Nota: este sistema fue creado con la intension de regalarles algo en navidad! feliz navidad!
-- Version: 1.0
-- RECOMENDACIONES: > Si no sabe de lua o scripts, mejor no tocar mucho el script, es delicado a cambios brutos <

-- Objetos con el cual podras aรฑadirle slots a otros objeos
-- Tambien puedes aรฑadir esta funcionalidad a mas de un objeto, solo aรฑadiendo una coma y seguido de la nueva ID
-- Ejemplo: local addSlotItems = { 2160, 2452 }
local addSlotItems = { 42028 }
local slotAction = Action()
local creatureEvent = CreatureEvent()

-- Libreria para la funcionalidad del sistema
local Attr = {}
Attr.__index = Attr
Attr.init = function(slot)
    local attr = {}
    setmetatable(attr, Attr)
    attr.name = slot.name
    attr.value = slot.value
    attr.percent = slot.percent
    return attr
end
setmetatable(Attr, {
    __call = function(_, ...) return Attr.init(...) end,
    __eq = function(a, b) return a.name == b.name and a.value == b.value and a.percent == b.percent end
})

local slotLib = {}
slotLib.maxSlots = 3 -- max 10, more get a errors
slotLib.baseSubids = 90
slotLib.cache = {}

slotLib.attributes = {
    { name = "Club", values = { 1, 2 }, percent = false },
    { name = "Sword", values = { 1, 2 }, percent = false },
    { name = "Axe", values = { 1, 2 }, percent = false },
    { name = "Distance", values = { 1, 2 }, percent = false },
    { name = "Shield", values = { 1, 2 }, percent = false },
    { name = "Fishing", values = { 1, 2 }, percent = false },
    { name = "MagicLevel", values = { 1, 2 }, percent = false },
    { name = "CriticalChance", values = { 1, 2 }, percent = false },
    { name = "CriticalAmount", values = { 1, 2 }, percent = false },
    { name = "LifeLeechChance", values = { 1, 2 }, percent = false },
    { name = "LifeLeechAmount", values = { 1, 2 }, percent = false },
    { name = "ManaLeechChance", values = { 1, 2 }, percent = false },
    { name = "ManaLeechAmount", values = { 1, 2 }, percent = false },
    { name = "Speed", values = { 1, 2 }, percent = false },
    { name = "HealthGain", values = { 1, 2 }, percent = false },
    { name = "ManaGain", values = { 1, 2 }, percent = false }
}

slotLib.conditions = {
    ["Club"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_CLUB },
    ["Sword"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_SWORD },
    ["Axe"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_AXE },
    ["Distance"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_DISTANCE },
    ["Shield"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_SHIELD },
    ["Fishing"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_FISHING },
    ["MagicLevel"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_STAT_MAGICPOINTS },
    ["CriticalChance"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_CRITICAL_HIT_CHANCE },
    ["CriticalAmount"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_CRITICAL_HIT_DAMAGE },
    ["LifeLeechChance"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_LIFE_LEECH_CHANCE },
    ["LifeLeechAmount"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_LIFE_LEECH_AMOUNT },
    ["ManaLeechChance"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_MANA_LEECH_CHANCE },
    ["ManaLeechAmount"] = { Type = CONDITION_ATTRIBUTES, Attr = CONDITION_PARAM_SKILL_MANA_LEECH_AMOUNT },
    ["Speed"] = { Type = CONDITION_SPEED, Attr = CONDITION_PARAM_SPEED },
    ["HealthGain"] = { Type = CONDITION_REGENERATION, Attr = CONDITION_PARAM_HEALTHGAIN },
    ["ManaGain"] = { Type = CONDITION_REGENERATION, Attr = CONDITION_PARAM_MANAGAIN }
}

slotLib.addItemSlot = function(item)
    local slots = slotLib.getItemSlots(item)
    local replace = #slots >= slotLib.maxSlots
    local slot = slotLib.attributes[math.random(1, #slotLib.attributes)]
    if slot then
        local slotIndex = not replace and #slots + 1 or math.random(1, slotLib.maxSlots)
        local newvalue = slot.values[math.random(1, #slot.values)]
        local oldvalue = replace and slots[slotIndex].value or newvalue
        slots[slotIndex] = {
            name = slot.name,
            value = not slot.percent and newvalue,
            valuePercent = slot.percent and newvalue
        }
        slotLib.setItemSlots(item, slots)
        return newvalue >= oldvalue
    end
end

slotLib.getItemSlots = function(item)
    local slots = {}
    for slot in string.gmatch(Item.getDescription(item), "(%[.-%])") do
        local name = string.match(slot, "%[(%a+)%p")
        local value = tonumber(string.match(slot, "%p(%d+)%]"))
        local valuePercent = tonumber(string.match(slot, "%p(%d+)%%+%]"))
        slots[#slots + 1] = {
            name = name,
            value = value,
            valuePercent = valuePercent
        }
    end
    return slots
end

slotLib.setItemSlots = function(item, slots)
    local description = ItemType.getDescription(ItemType(Item.getId(item))) or ""
    for _, slot in pairs(slots) do
        description = string.format("%s[%s+%u%s]%s", description, slot.name, slot.value or slot.valuePercent, slot.valuePercent and "%" or "", _ == #slots and "" or "\n")
    end
    return Item.setAttribute(item, ITEM_ATTRIBUTE_DESCRIPTION, description)
end

slotLib.autoDetection = function(playerId)
    local player = Player(playerId)
    if player then
        if not slotLib.cache[playerId] then
            slotLib.cache[playerId] = {}
        end
        for slot = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
            local item = player:getSlotItem(slot)
            if item then
                local slots = slotLib.getItemSlots(item)
                slotLib.onSlotEquip(player, slots, slot)
                if #slots < slotLib.maxSlots then
                    for index = #slots+1, slotLib.maxSlots do
                        local subid = slotLib.baseSubids + slot + (CONST_SLOT_AMMO * index)
                        player:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, subid, true)
                        player:removeCondition(CONDITION_SPEED, CONDITIONID_DEFAULT, subid, true)
                        player:removeCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT, subid, true)
                    end
                end
            else
                for index = 1, slotLib.maxSlots do
                    local subid = slotLib.baseSubids + slot + (CONST_SLOT_AMMO * index)
                    player:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, subid, true)
                    player:removeCondition(CONDITION_SPEED, CONDITIONID_DEFAULT, subid, true)
                    player:removeCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT, subid, true)
                end
            end
        end
        addEvent(slotLib.autoDetection, 100, playerId)
    else
        slotLib.cache[playerId] = nil
    end
end

slotLib.onSlotEquip = function(player, slots, slotIndex)
    for index, slot in pairs(slots) do
        local attr = Attr(slot)
        local subid = slotLib.baseSubids + slotIndex + (CONST_SLOT_AMMO * index)
        if not slotLib.cache[player.uid][subid] or slotLib.cache[player.uid][subid] ~= attr then
            if slotLib.cache[player.uid][subid] and slotLib.cache[player.uid][subid] ~= attr then
                player:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, subid, true)
                player:removeCondition(CONDITION_SPEED, CONDITIONID_DEFAULT, subid, true)
                player:removeCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT, subid, true)
            end
            local info = slotLib.conditions[attr.name]
            if info then
                local condition = Condition(info.Type, CONDITIONID_DEFAULT)
                if condition then
                    condition:setParameter(info.Attr, attr.value)
                    condition:setParameter(CONDITION_PARAM_TICKS, -1)
                    condition:setParameter(CONDITION_PARAM_SUBID, subid)
                    player:addCondition(condition)
                    slotLib.cache[player.uid][subid] = attr
                end
            end
        end
    end
end

slotLib.isUpgradeable = function(item)
    local it = ItemType(item.itemid)
    return it:getArmor() >= 1 or it:getDefense() >= 1 or it:getAttack() >= 1 or it:getExtraDefense() >= 1 or it:getShootRange() >= 1 or it:getWeaponType() >= 1
end

function slotAction.onUse(player, item, fromPos, target, toPos, isHotkey)
    if not target or not target:isItem() then
        return player:sendCancelMessage("Sorry not possible, only work on items.")
    end
    if not slotLib.isUpgradeable(target) then
        return player:sendCancelMessage("Sorry not possible, this item cannot update slots.")
    end
    local greatz = slotLib.addItemSlot(target)
    target:getPosition():sendMagicEffect(greatz and CONST_ME_FIREWORK_RED or CONST_ME_FIREWORK_BLUE)
    player:say(greatz and "Perfect!" or "Bad!")
    return true
end

slotAction:id(addSlotItems[1])
slotAction:register()

function creatureEvent.onLogin(player)
    slotLib.autoDetection(player.uid)
    return true
end

creatureEvent:register()
 
OP
OP
Sarah Wesker

Sarah Wesker

เธ„โˆ‚vฮฑฮทcฮต เธฃาฏฮทั‚ฮฑx โค
Support Team
Joined
Mar 16, 2017
Messages
1,185
Solutions
128
Reaction score
1,459
Location
London
GitHub
MillhioreBT
Twitch
millhiore_bt
engine: tfs master
version: latest

Wedding/Marriage System

View attachment 68233

  • players will stay on the two SQM (any sex)
  • it will cost 50k from each player (configurable)
  • it will cost 1x item id 10503 (wedding outfit box) from each player (configurable)
  • it will broadcast or not that the marriage occurred (configurable)
  • both players need to pull the lever to confirm

checks:
  • if player is already married
  • if player level is higher than 20 (configurable)

on success:
- players onLook will show: "married to playername"
Lua:
function Player:getMarriageDescription(thing)
    local descr = ""
    if getPlayerMarriageStatus(thing:getGuid()) == MARRIED_STATUS then
        playerSpouse = getPlayerSpouse(thing:getGuid())
        if self == thing then
            descr = descr .. " You are "
        elseif thing:getSex() == PLAYERSEX_FEMALE then
            descr = descr .. " She is "
        else
            descr = descr .. " He is "
        end
        descr = descr .. "married to " .. getPlayerNameById(playerSpouse) .. '.'
    end
    return descr
end
(old code by @Godely just for example)
- players will receive 10502 (engraved wedding ring) with description like this:
Lua:
                        local item1 = Item(doPlayerAddItem(cid, 10502, 1))
                        local item2 = Item(doPlayerAddItem(cid, 10502, 1))
                        item1:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, player:getName() .. ' & ' .. getPlayerNameById(candidate) .. ' forever - married on ' .. os.date('%B %d, %Y.'))
                        item2:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, player:getName() .. ' & ' .. getPlayerNameById(candidate) .. ' forever - married on ' .. os.date('%B %d, %Y.'))
(old code by @Godely just for example)
- both players will receive outfit: 329 and 328 (they don't have addons)

Divorce

divorcing will also be possible by using !divorce talkaction

  • it will cost 50k (configurable)
  • players don't need to be online
  • if they have the 10502 (engraved wedding ring) on their backpack or equipped it will transform into 10510 (broken wedding ring)
  • add option if they can keep the outfit or not
โ„‹๐‘’๐“๐“๐‘œ, โ„ ๐’ฝ๐’ถ๐“‹๐‘’ ๐’ถ๐’ธ๐’ธ๐‘’๐“…๐“‰๐‘’๐’น ๐“Ž๐‘œ๐“Š๐“‡ ๐“‡๐‘’๐“†๐“Š๐‘’๐“ˆ๐“‰. โœ…

โ„ ๐’ฝ๐‘œ๐“…๐‘’ ๐“‰๐’ฝ๐’ถ๐“‰ ๐“‰๐’ฝ๐‘’ ๐“‡๐‘’๐“ˆ๐“Š๐“๐“‰ ๐’พ๐“ˆ ๐“ˆ๐’พ๐“‚๐’พ๐“๐’ถ๐“‡ ๐‘’๐“ƒ๐‘œ๐“Š๐‘”๐’ฝ ๐“‰๐‘œ ๐“Œ๐’ฝ๐’ถ๐“‰ ๐“Ž๐‘œ๐“Š ๐’ถ๐“ˆ๐“€๐‘’๐’น ๐’ป๐‘œ๐“‡ ๐’ถ๐“ƒ๐’น ๐“‰๐’ฝ๐’ถ๐“‰ ๐“Ž๐‘œ๐“Š ๐“๐’พ๐“€๐‘’ ๐’พ๐“‰ ๐’ถ ๐“๐‘œ๐“‰.
โ„›๐‘’๐“ˆ๐“Š๐“๐“‰:
data/scripts/marriagesystem.lua
Lua:
local config = {
    divorceTalkaction = "!divorce", -- Command
    actionId = 65011, -- lever AID
    successRingId = 10502,
    ringDescription = "This ring is the proof of love between |PLAYERNAME| and |OTHERNAME| - Married on |TIME|.",
    signaturePrefixMessages = "MarriageSystem [<3] says:",
    successBroadcastMessage = "The player |PLAYERNAME| has married |OTHERNAME|.",
    selfEnoughMessage = "You don't have all the requirements needed to get married.\nThe cost is: |COST| gold coins.\nYou need: |ITEMNAMES|",
    otherEnoughMessage = "|PLAYERNAME| doesn't have all the requirements needed to get married.\nThe cost is: |COST| gold coins.\nYou need: |ITEMNAMES|",

    successMarriageEffect = CONST_ME_HEARTS,
    removeOutfitEffect = CONST_ME_POFF,

    playerPositions = {
        Position(3184, 1818, 7), --  Tile 1
        Position(3186, 1818, 7) -- Tile 2
    },

    requirements = {
        [PLAYERSEX_FEMALE] = {
            level = 20,
            cost = 100 * 50, -- 50K
            items = {
                {10503, 1} -- 1 wedding outfit box
            },
            divorce_cost = 100 * 30 -- 30K
        },
        [PLAYERSEX_MALE] = {
            level = 20,
            cost = 100 * 50, -- 50K
            items = {
                {10503, 1} -- 1 wedding outfit box
            },
            divorce_cost = 100 * 30 -- 30K
        }
    },

    rewards = {
        [PLAYERSEX_FEMALE] = {
            outfit = {lookType=329, peristent=false, defaultType=136}
        },
        [PLAYERSEX_MALE] = {
            outfit = {lookType=328, peristent=false, defaultType=128}
        }
    },

    marriageStorageId = 89000,
    removeOutfitStorageId = 89001,

    --cache
    proposals = {},
    requests = {},
    playerNames = {}
}

local function sendTextMessage(player, message)
    return player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("%s\n%s", config.signaturePrefixMessages, message))
end

local function sendCancelMessage(player, message)
    return player:sendCancelMessage(string.format("%s\n%s", config.signaturePrefixMessages, message))
end

local function payCost(player, other, playerReq, otherReq, test)
    local playerBankBalance = player:getBankBalance()
    local playerMoneyBalance = player:getMoney()
    local playerTotalBalance = playerBankBalance + playerMoneyBalance
    local playerPayStatus = playerTotalBalance >= playerReq.cost
    local playerItemReqMessage = {}
    for index, itemReq in pairs(playerReq.items) do
        playerItemReqMessage[#playerItemReqMessage +1] = string.format("%d %s", itemReq[2], ItemType(itemReq[1]):getName())
        if player:getItemCount(itemReq[1]) < itemReq[2] then
            playerPayStatus = false
        end
    end

    local otherBankBalance = other:getBankBalance()
    local otherMoneyBalance = other:getMoney()
    local otherTotalBalance = otherBankBalance + otherMoneyBalance
    local otherPayStatus = otherTotalBalance >= otherReq.cost
    local otherItemReqMessage = {}
    for index, itemReq in pairs(otherReq.items) do
        otherItemReqMessage[#otherItemReqMessage +1] = string.format("%d %s", itemReq[2], ItemType(itemReq[1]):getName())
        if other:getItemCount(itemReq[1]) < itemReq[2] then
            otherPayStatus = false
        end
    end

    if playerPayStatus and otherPayStatus then
        if test then
            return true
        end

        local playerName = player:getName()
        local otherName = other:getName()
        local ringDescription = config.ringDescription:gsub("|PLAYERNAME|", playerName):gsub("|OTHERNAME|", otherName):gsub("|TIME|", os.date("%A %dth %B %Y"))

        local playerRing = Game.createItem(config.successRingId, 1)
        playerRing:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, ringDescription)
        local playerAddRingResult = player:addItemEx(playerRing)
        if playerAddRingResult ~= RETURNVALUE_NOERROR then
            player:sendCancelMessage(playerAddRingResult)
            sendTextMessage(player, "You do not have enough capacity to carrie the ring.")
            playerRing:remove()
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end

        local otherRing = Game.createItem(config.successRingId, 1)
        otherRing:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, ringDescription)
        local otherAddRingResult = other:addItemEx(otherRing)
        if otherAddRingResult ~= RETURNVALUE_NOERROR then
            other:sendCancelMessage(otherAddRingResult)
            sendTextMessage(other, "You do not have enough capacity to carrie the ring.")
            otherRing:remove()
            playerRing:remove()
            other:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end

        playerMoneyBalance = playerMoneyBalance - playerReq.cost
        if playerMoneyBalance < 0 then
            player:removeMoney(playerReq.cost + playerMoneyBalance)
            playerBankBalance = playerBankBalance - math.abs(playerMoneyBalance)
            player:setBankBalance(playerBankBalance)
        else
            player:removeMoney(playerReq.cost)
        end

        for index, itemReq in pairs(playerReq.items) do
            player:removeItem(itemReq[1], itemReq[2])
        end

        otherMoneyBalance = otherMoneyBalance - otherReq.cost
        if otherMoneyBalance < 0 then
            other:removeMoney(otherReq.cost + otherMoneyBalance)
            otherBankBalance = otherBankBalance - math.abs(otherMoneyBalance)
            other:setBankBalance(otherBankBalance)
        else
            other:removeMoney(otherReq.cost)
        end

        for index, itemReq in pairs(otherReq.items) do
            other:removeItem(itemReq[1], itemReq[2])
        end

        local playerGuid = player:getGuid()
        local otherGuid = other:getGuid()
        player.storage[config.marriageStorageId] = otherGuid
        other.storage[config.marriageStorageId] = playerGuid
        player:addOutfit(config.rewards[player:getSex()].outfit.lookType)
        other:addOutfit(config.rewards[other:getSex()].outfit.lookType)

        if #config.successBroadcastMessage > 0 then
            local broadcastMessage = string.format("%s\n%s", config.signaturePrefixMessages, config.successBroadcastMessage)
            broadcastMessage = broadcastMessage:gsub("|PLAYERNAME|", playerName)
            broadcastMessage = broadcastMessage:gsub("|OTHERNAME|", otherName)
            Game.broadcastMessage(broadcastMessage, MESSAGE_INFO_DESCR)
        end

        sendCancelMessage(player, string.format("You married %s.", otherName))
        sendCancelMessage(other, string.format("You married %s.", playerName))
        config.playerPositions[1]:sendMagicEffect(config.successMarriageEffect)
        config.playerPositions[2]:sendMagicEffect(config.successMarriageEffect)
        config.proposals[playerGuid] = nil
        config.proposals[playerGuid] = nil
        config.requests[otherGuid] = nil
        config.requests[otherGuid] = nil
        return true
    end

    if playerPayStatus and not otherPayStatus then
        sendTextMessage(other, config.selfEnoughMessage:gsub("|COST|", otherReq.cost):gsub("|ITEMNAMES|", table.concat(otherItemReqMessage, ", ")))
        sendTextMessage(player, config.otherEnoughMessage:gsub("|COST|", otherReq.cost):gsub("|PLAYERNAME|", other:getName()):gsub("|ITEMNAMES|", table.concat(otherItemReqMessage, ", ")))
    elseif otherPayStatus and not playerPayStatus then
        sendTextMessage(player, config.selfEnoughMessage:gsub("|COST|", playerReq.cost):gsub("|ITEMNAMES|", table.concat(playerItemReqMessage, ", ")))
        sendTextMessage(other, config.otherEnoughMessage:gsub("|COST|", playerReq.cost):gsub("|PLAYERNAME|", player:getName()):gsub("|ITEMNAMES|", table.concat(playerItemReqMessage, ", ")))
    else
        sendTextMessage(player, config.selfEnoughMessage:gsub("|COST|", playerReq.cost):gsub("|ITEMNAMES|", table.concat(playerItemReqMessage, ", ")))
        sendTextMessage(other, config.selfEnoughMessage:gsub("|COST|", otherReq.cost):gsub("|ITEMNAMES|", table.concat(otherItemReqMessage, ", ")))
    end

    config.playerPositions[1]:sendMagicEffect(CONST_ME_POFF)
    config.playerPositions[2]:sendMagicEffect(CONST_ME_POFF)
    return false
end

local action = Action()

function action.onUse(player, item, fromPos, target, toPos, isHotkey)
    local playerPosition, otherPosition = player:getPosition()
    if playerPosition == config.playerPositions[1] then
        otherPosition = config.playerPositions[2]
    elseif playerPosition == config.playerPositions[2] then
        otherPosition = config.playerPositions[1]
    else player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return true
    end

    local playerRequirements = config.requirements[player:getSex()]
    if player:getLevel() < playerRequirements.level then
        player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("To get married you need to be level %d.", playerRequirements.level))
        return true
    end

    local partnerGuid = player.storage[config.marriageStorageId]
    if partnerGuid and partnerGuid > 0 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You are already married.")
        return true
    end

    local other = Tile(otherPosition):getTopVisibleCreature(player)
    if not other or not other:isPlayer() then
        player:sendCancelMessage("You cannot initiate a marriage because there is no one on the other tile.")
        return true
    end

    local function toggle()
        item:transform(item:getId() == 1946 and 1945 or 1946)
    end

    local playerGuid = player:getGuid()
    local playerRequest = config.requests[playerGuid]
    if playerRequest then
        if playerRequest.playerGuid ~= other:getGuid() then
            config.requests[playerGuid] = nil
            config.proposals[playerGuid] = nil
        else
            if not payCost(player, other, playerRequirements, config.requirements[other:getSex()]) then
                return true
            end

            config.requests[playerGuid] = nil
            config.proposals[playerGuid] = nil
            toggle()
            return true
        end
    end

    local playerProposal = config.proposals[playerGuid]
    if not playerProposal then
        local partnerGuid = other.storage[config.marriageStorageId]
        if partnerGuid and partnerGuid > 0 then
            sendTextMessage(player, string.format("%s is already married.", other:getName()))
            return true
        end

        if not payCost(player, other, playerRequirements, config.requirements[other:getSex()], true) then
            return true
        end

        local otherGuid = other:getGuid()
        config.proposals[playerGuid] = {otherGuid = otherGuid}
        config.requests[otherGuid] = {playerGuid = playerGuid}
        sendTextMessage(player, string.format("You have sent a marriage request to %s.", other:getName()))
        sendTextMessage(other, string.format("You have received a marriage request from %s.", player:getName()))
        toggle()
        return true
    end

    player:sendCancelMessage(string.format("You already sent a request to %s.", other:getName()))
    return true
end

action:aid(config.actionId)
action:register()

local function loadPartnerName(player, partnerGuid)
    local resultId = db.storeQuery(string.format("SELECT `name` FROM `players` WHERE `id` = %d;", partnerGuid))
    if not resultId then
        player.storage[config.marriageStorageId] = nil
        removeOutfit(player)
        sendTextMessage(player, "We didn't find your marriage in the database, so now you don't have a marriage.")
        return
    end

    config.playerNames[partnerGuid] = result.getString(resultId, "name")
    result.free(resultId)
end

local function removeOutfit(player)
    local rewards = config.rewards[player:getSex()]
    if not rewards.outfit.peristent then
        player:removeOutfit(rewards.outfit.lookType)
        local outfit = player:getOutfit()
        if outfit.lookType == rewards.outfit.lookType then
            outfit.lookType = rewards.outfit.defaultType
            player:setOutfit(outfit)
            player:getPosition():sendMagicEffect(config.removeOutfitEffect)
        end
    end
end

local creatureEvent = CreatureEvent("loadMarriageNames")

function creatureEvent.onLogin(player)
    if player.storage[config.removeOutfitStorageId] == 1 then
        player.storage[config.removeOutfitStorageId] = -1
        removeOutfit(player)
        sendTextMessage(player, "Your partner has divorced you.")
    end

    local partnerGuid = player.storage[config.marriageStorageId]
    if not partnerGuid or partnerGuid <= 0 then
        return true
    end

    local partner = Player(partnerGuid)
    if partner then
        config.playerNames[partnerGuid] = partner:getName()
    else
        loadPartnerName(player, partnerGuid)
    end
    return true
end

creatureEvent:register()

local ec = EventCallback

function ec.onLook(player, thing, position, distance, description)
    if not thing:isPlayer() then
        return description
    end

    local partnerGuid = thing.storage[config.marriageStorageId]
    if not partnerGuid or partnerGuid <= 0 then
        return description
    end

    local partnerName = config.playerNames[partnerGuid]
    if not partnerName then
        loadPartnerName(thing, partnerGuid)
        partnerName = config.playerNames[partnerGuid]
        if not partnerName then
            return description
        end
    end

    if player:getId() == thing:getId() then
        description = string.format("%s\nYou are", description)
    elseif thing:getSex() == PLAYERSEX_FEMALE then
        description = string.format("%s\nShe is", description)
    else
        description = string.format("%s\nHe is", description)
    end

    description = string.format("%s married to %s.", description, partnerName)
    return description
end

ec:register(1)

local function payDivorce(player, cost)
    local bankBalance = player:getBankBalance()
    local moneyBalance = player:getMoney()
    if (bankBalance + moneyBalance) >= cost then
        moneyBalance = moneyBalance - cost
        if moneyBalance < 0 then
            player:removeMoney(cost + moneyBalance)
            bankBalance = bankBalance - math.abs(moneyBalance)
            player:setBankBalance(bankBalance)
        else
            player:removeMoney(cost)
        end
        return true
    end
    return false
end

local talkAction = TalkAction(config.divorceTalkaction)

function talkAction.onSay(player, words, param, type)
    local partnerGuid = player.storage[config.marriageStorageId]
    if not partnerGuid or partnerGuid <= 0 then
        player:sendCancelMessage("You are not married.")
        return false
    end

    local divorceCost = config.requirements[player:getSex()].divorce_cost
    if not payDivorce(player, divorceCost) then
        sendTextMessage(player, string.format("You don't have enough money to pay for the divorce.\nThe cost is: %d gold coins.", divorceCost))
        return false
    end

    local partner = Player(partnerGuid)
    if not partner then
        db.query(string.format("DELETE FROM `player_storage` WHERE `player_id` = %d AND `key` = %d", partnerGuid, config.marriageStorageId))
        db.query(string.format("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (%d, %d, %d)", partnerGuid, config.removeOutfitStorageId, 1))
    else
        partner.storage[config.marriageStorageId] = -1
        config.playerNames[partnerGuid] = nil
        removeOutfit(partner)
        sendTextMessage(partner, "Your partner has divorced you.")
    end

    player.storage[config.marriageStorageId] = -1
    config.playerNames[player:getGuid()] = nil
    removeOutfit(player)
    sendTextMessage(player, "You have divorced your partner.")
    return false
end

talkAction:separator(" ")
talkAction:register()

๐’ฉ๐‘œ๐“‰๐‘’: ๐“‡๐‘’๐“‚๐‘’๐“‚๐’ท๐‘’๐“‡ ๐“‰๐’ฝ๐’ถ๐“‰ ๐“Ž๐‘œ๐“Š ๐’ธ๐’ถ๐“ƒ ๐’ธ๐‘œ๐“ƒ๐’ป๐’พ๐‘”๐“Š๐“‡๐‘’ ๐“‰๐’ฝ๐‘’ ๐’ธ๐‘œ๐“‚๐“‚๐’ถ๐“ƒ๐’น ๐’พ๐“ƒ ๐“‰๐’ฝ๐‘’ ๐’ธ๐‘œ๐“ƒ๐’ป๐’พ๐‘”.
๐’ฏ๐’พ๐“…๐“ˆ: โ„๐’ป ๐“‡๐‘’๐“Œ๐’ถ๐“‡๐’น ๐‘œ๐“Š๐“‰๐’ป๐’พ๐“‰๐“ˆ ๐’ฝ๐’ถ๐“‹๐‘’ ๐“‰๐’ฝ๐‘’ ๐“…๐‘’๐“‡๐“ˆ๐’พ๐“ˆ๐“‰๐‘’๐“ƒ๐“‰ ๐“‹๐’ถ๐“‡๐’พ๐’ถ๐’ท๐“๐‘’ ๐“ˆ๐‘’๐“‰ ๐“‰๐‘œ ๐“‰๐“‡๐“Š๐‘’ ๐“‰๐’ฝ๐‘’ ๐‘œ๐“Š๐“‰๐’ป๐’พ๐“‰ ๐“Œ๐’พ๐“๐“ ๐“ƒ๐‘œ๐“‰ ๐’ท๐‘’ ๐“‡๐‘’๐“‚๐‘œ๐“‹๐‘’๐’น ๐’ป๐“‡๐‘œ๐“‚ ๐“‰๐’ฝ๐‘’ ๐“…๐“๐’ถ๐“Ž๐‘’๐“‡ ๐‘œ๐“ƒ ๐’น๐’พ๐“‹๐‘œ๐“‡๐’ธ๐‘’.
โ„ฐ๐“๐’ถ๐“‚๐“…๐“๐‘’ ๐‘œ๐’ป ๐’น๐’พ๐“‹๐‘œ๐“‡๐’ธ๐‘’
โค !divorce

๐’ฑ๐’พ๐“ˆ๐“Š๐’ถ๐“๐’พ๐“๐’ถ๐“‰๐’พ๐‘œ๐“ƒ ๐‘œ๐’ป ๐“‰๐’ฝ๐‘’ ๐“…๐“๐’ถ๐“Ž๐‘’๐“‡๐“ˆ ๐’พ๐“ƒ ๐“‚๐’ถ๐“‡๐“‡๐’พ๐’ถ๐‘”๐‘’.

GIF 05-06-2022 02-15-59 p. m..gif
 
Last edited:

Dohko

Active Member
Joined
Mar 7, 2017
Messages
94
Reaction score
25
Hi Sarah, how are you?
First of all congratulations for the attitude of helping us on the forum.

Version:
TFS 1.5

Request:
I would like a script that identifies how many basic attacks (not consider spells) an specific vocation has performed, to perform a special attack on every seventh hit.
The additional attack would be like an "exori con" on the target. Dealing damage based on player's level+skill.
 

bpm91

Active Member
Joined
May 23, 2019
Messages
455
Solutions
7
Reaction score
44
Location
Brazil
Hi Sarah, how are you?
First of all congratulations for the attitude of helping us on the forum.

Version:
TFS 1.5


I would like a script that when using the item gives points in the store. example 10 coins = 10 points 100 coins = 100 points 56 coins = 56 points. the item id is 5378
 
Top