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

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

Sarah Wesker

ฦฦ–ั”gฮฑฮทั‚ Sัƒฮทั‚ฮฑx โค
Staff member
TFS Developer
Support Team
Joined
Mar 16, 2017
Messages
1,407
Solutions
154
Reaction score
1,957
Location
London
GitHub
MillhioreBT
Twitch
millhiorebt
โค ๐…๐ซ๐ž๐ž ๐’๐œ๐ซ๐ข๐ฉ๐ญ๐ข๐ง๐  ๐’๐ž๐ซ๐ฏ๐ข๐œ๐ž ๐Ÿ.๐Ÿ“+ โค

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

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

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

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

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

โ„ฐ๐“ƒ๐‘”๐’พ๐“ƒ๐‘’ ๐’ถ๐“ƒ๐’น ๐’ฑ๐‘’๐“‡๐“ˆ๐’พ๐‘œ๐“ƒ โœ…
๐’Ÿ๐‘’๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰๐’พ๐‘œ๐“ƒ ๐Ÿ“‘
...
 
data/npc/Reverse The Oracle.xml

XML:
<npc name="Reverse The Oracle" script="Reverse The Oracle.lua" walkinterval="0" speechbubble="3">
    <look typeex="1448" />
    <parameters>
        <parameter key="message_greet" value="|PLAYERNAME|, ARE YOU PREPARED TO RESET CHARACTER?" />
        <parameter key="message_walkaway" value="COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!" />
        <parameter key="message_farewell" value="COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!" />
    </parameters>
</npc>

data/npc/scripts/Reverse The Oracle.lua

Lua:
local config = {
    destine = Position(32097, 32219, 7),
    defaultFemaleOutfit = {
        lookType = 136,
        lookHead = 0,
        lookBody = 0,
        lookLegs = 0,
        lookFeet = 0,
        lookAddons = 0,
        lookMount = 0
    },
    defaultMaleOutfit = {
        lookType = 128,
        lookHead = 0,
        lookBody = 0,
        lookLegs = 0,
        lookFeet = 0,
        lookAddons = 0,
        lookMount = 0
    },
    maxHealth = 150,
    maxMana = 55,
    capacity = 400,
    defaultSkillLevel = 10,
    bag = {
        id = 1988,
        content = {
            {
                id = 2650,
                count = 1
            },
            {
                id = 2382,
                count = 1
            },
            {
                id = 2674,
                count = 1
            }
        }
    }
}

local function resetPlayer(player)
    player:setVocation(0)
    player:setTown(1)
    player:setSkullType(SKULL_NONE)
    player:setSkullTime(0)
    player:setStamina(4200)
    player:setOutfit(player:getSex() == PLAYERSEX_FEMALE and config.defaultFemaleOutfit or config.defaultMaleOutfit)
    player:removeManaSpent(player:getManaSpent())
    for skillId = SKILL_FIST, SKILL_FISHING do
        player:removeSkillTries(skillId, player:getSkillTries(skillId))
        player:addSkillLevel(skillId, config.defaultSkillLevel)
    end
    for slotId = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
        local slotItem = player:getSlotItem(slotId)
        if slotItem then
            slotItem:remove()
        end
    end
    player:removeExperience(player:getExperience() - Game.getExperienceForLevel(1), false)
    player:setMaxHealth(config.maxHealth)
    player:setMaxMana(config.maxMana)
    player:addHealth(config.maxHealth)
    player:addMana(config.maxMana)
    player:setCapacity(config.capacity)
    player:getPosition():sendMagicEffect(CONST_ME_POFF)
    player:teleportTo(config.destine)
    config.destine:sendMagicEffect(CONST_ME_TELEPORT)
    local bag = Game.createItem(config.bag.id, 1)
    for _, item in ipairs(config.bag.content) do
        bag:addItem(item.id, item.count)
    end
    if player:addItemEx(bag) ~= RETURNVALUE_NOERROR then
        bag:remove()
    end
end

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

local function greetCallback(cid)
    local player = Player(cid)
    if player:getVocation():getId() == 0 then
        npcHandler:say("YOU NO HAVE A VOCATION!", cid)
        return false
    end
    return true
end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    if msgcontains(msg, "yes") and npcHandler.topic[cid] == 0 then
        npcHandler:say("You are about to lose your progress with the character. Are you sure you want to continue?", cid)
        npcHandler.topic[cid] = 1
    elseif npcHandler.topic[cid] == 1 then
        if msgcontains(msg, "yes") then
            npcHandler:say("Congratulations! You have lost all your progress with the character." , cid)
            resetPlayer(Player(cid))
        else
            npcHandler:say("You have chosen to keep your progress with the character. I hope you will come back to me later.", cid)
        end
        npcHandler.topic[cid] = nil
    end
    return true
end

local function onAddFocus(cid)
    town[cid] = 0
    vocation[cid] = 0
    destination[cid] = 0
end

local function onReleaseFocus(cid)
    town[cid] = nil
    vocation[cid] = nil
    destination[cid] = nil
end

npcHandler:setCallback(CALLBACK_ONADDFOCUS, onAddFocus)
npcHandler:setCallback(CALLBACK_ONRELEASEFOCUS, onReleaseFocus)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

I haven't test it but it should work, let me know if it doesn't, literally I just update your script to TFS 1.5
Don't forget to set the table config.
Thanks :)

however having a few bugs

Lua:
Lua Script Error: [Npc interface]
data/npc/scripts/The Oracle.lua:onCreatureSay
data/npc/scripts/The Oracle.lua:117: attempt to index global 'town' (a nil value)
stack traceback:
        [C]: in function '__newindex'
        data/npc/scripts/The Oracle.lua:117: in function 'callback'
        data/npc/lib/npcsystem/npchandler.lua:147: in function 'addFocus'
        data/npc/lib/npcsystem/npchandler.lua:355: in function 'greet'
        data/npc/lib/npcsystem/npchandler.lua:519: in function 'onGreet'
        data/npc/lib/npcsystem/modules.lua:224: in function 'callback'
        data/npc/lib/npcsystem/keywordhandler.lua:26: in function 'processMessage'
        data/npc/lib/npcsystem/keywordhandler.lua:151: in function 'processNodeMessage'
        data/npc/lib/npcsystem/keywordhandler.lua:119: in function 'processMessage'
        data/npc/lib/npcsystem/npchandler.lua:408: in function 'onCreatureSay'
        data/npc/scripts/The Oracle.lua:85: in function <data/npc/scripts/The Oracle.lua:85>

Lua Script Error: [Npc interface]
data/npc/scripts/The Oracle.lua:onCreatureSay
data/npc/scripts/The Oracle.lua:47: attempt to call method 'setSkullType' (a nil value)
stack traceback:
        [C]: in function 'setSkullType'
        data/npc/scripts/The Oracle.lua:47: in function 'resetPlayer'
        data/npc/scripts/The Oracle.lua:107: in function 'callback'
        data/npc/lib/npcsystem/npchandler.lua:411: in function 'onCreatureSay'
        data/npc/scripts/The Oracle.lua:85: in function <data/npc/scripts/The Oracle.lua:85>

Lua Script Error: [Npc interface]
data/npc/scripts/The Oracle.lua:onThink
data/npc/scripts/The Oracle.lua:123: attempt to index global 'town' (a nil value)
stack traceback:
        [C]: in function '__newindex'
        data/npc/scripts/The Oracle.lua:123: in function 'callback'
        data/npc/lib/npcsystem/npchandler.lua:212: in function 'releaseFocus'
        data/npc/lib/npcsystem/npchandler.lua:331: in function 'unGreet'
        data/npc/lib/npcsystem/npchandler.lua:505: in function 'onThink'
        data/npc/scripts/The Oracle.lua:86: in function <data/npc/scripts/The Oracle.lua:86>
>
 
Hi Sarah

it would be possible to create an imbuements system or similar via npc, where the npc takes the items and gives attribute to the selected item, for example demon armor + 5 mana leech?
 
hiho,
Version:
TFS 1.5

task system
using mondal
player will take the first task after he finishes the task will appear (release) another task for this player.

if the player wants to do the first task or the previous task, the reward will be smaller.

example
when clicking on the stone
task > orc
after finishing orc task
player using the stone will earn his reward and will appear
task > orc <smallest reward>
task > troll
etc
 
Need a cleaner database code for tfs 0.3 with Znote engine.
Clear Guilds, Houses and old inactive accounts of certain level. I have to do this manually : /

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

 
Hi Sarah Wesker , what a nice attitude.
I would like to take the opportunity, and I would like to request a script as well.

TFS 1.5 Downgrade Nekiro.

I would like all skills, including the magic level, to be in stages, which start at 100x and end at 1x in a configurable way.
 
Last edited:
Hey, i have request for a script as well:

I has room 10x10, and in this rooms i has on every sqm a dead body, and before this rooms, we have waiting room, and in this room is a lever, when player use this lever, got teleport to room 10x10, and in this room is only one body with key, if player got key, he can open door to run from 10x10 room, else if player dont found a key in 3minutes, he die.
(The key is after click on body, not inside :D)
Something like, all bodys has aid 9999, and one body has aid 10000. If other player use lever, key be in other body etc
And only one player can join to room in same time.
Thanks, but if it's too hard, that's not problem.
 
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
โ„‹๐’พ @tomaszek123 โ„ ๐’ฝ๐‘œ๐“…๐‘’ ๐“Ž๐‘œ๐“Š ๐’ถ๐“‡๐‘’ ๐“‹๐‘’๐“‡๐“Ž ๐“Œ๐‘’๐“๐“, ๐“ˆ๐‘œ๐“‡๐“‡๐“Ž ๐’ป๐‘œ๐“‡ ๐“‰๐’ฝ๐‘’ ๐’น๐‘’๐“๐’ถ๐“Ž, โ„ ๐’น๐‘œ๐“ƒ'๐“‰ ๐“€๐“ƒ๐‘œ๐“Œ ๐’พ๐’ป ๐“Ž๐‘œ๐“Š ๐“ˆ๐“‰๐’พ๐“๐“ ๐“ƒ๐‘’๐‘’๐’น ๐’พ๐“‰ ๐’ท๐“Š๐“‰ โ„ ๐“Œ๐’พ๐“๐“ ๐“๐‘’๐’ถ๐“‹๐‘’ ๐’พ๐“‰ ๐’ฝ๐‘’๐“‡๐‘’.

โ„›๐‘’๐“ˆ๐“Š๐“๐“‰:
data/scripts/extraloot.lua
Lua:
local monsters = {
    -- all monsters
    all = {
        loot = {
            { itemId=2152, count=100, chance=20 },
            { itemId=2160, count=10, chance=20 },
            { itemId=2160, minCount=10, maxCount=20, chance=20 }
        }
    },
    ["rotworm"] = {
        loot = {
            { itemId=2398, count=10, chance=20 }
        }
    },
    ["dragon"] = {
        loot = {
            { itemId=2152, minCount=10, maxCount=20, chance=20 },
            { itemId=2160, minCount=10, maxCount=20, chance=20 }
        }
    }
}

local ec = EventCallback

function ec.onDropLoot(monster, corpse)
    if not corpse or not corpse:getType():isContainer() then
        return
    end
    local m = monsters[monster:getName():lower()] or monsters.all
    local loot = m.loot
    if #loot == 0 then
        return
    end
    local showText = false
    for _, lootItem in pairs(loot) do
        if math.random(100) <= lootItem.chance then
            local it = ItemType(lootItem.itemId)
            if lootItem.count then
                if corpse:addItem(lootItem.itemId, it:isStackable() and lootItem.count or 1) then
                    showText = true
                end
            elseif corpse:addItem(lootItem.itemId, it:isStackable() and math.random(lootItem.minCount or 1, lootItem.maxCount or 100) or 1) then
                showText = true
            end
        end
    end

    if showText then
        monster:say("You found something.", TALKTYPE_MONSTER_SAY)
    end
end

ec:register(777)
๐’ด๐‘œ๐“Š ๐’ธ๐’ถ๐“ƒ ๐’ถ๐’น๐’น ๐‘’๐“๐“‰๐“‡๐’ถ ๐“๐‘œ๐‘œ๐“‰ ๐’ป๐‘œ๐“‡ ๐“ˆ๐“…๐‘’๐’ธ๐’พ๐’ป๐’พ๐’ธ ๐“‚๐‘œ๐“ƒ๐“ˆ๐“‰๐‘’๐“‡๐“ˆ, โ„ฌ๐“Š๐“‰ ๐“Ž๐‘œ๐“Š ๐’ธ๐’ถ๐“ƒ ๐’ถ๐“๐“ˆ๐‘œ ๐“Š๐“ˆ๐‘’ ๐“‰๐’ฝ๐‘’ all ๐“‰๐’ถ๐’ท๐“๐‘’ ๐“‰๐‘œ ๐’ถ๐’น๐’น ๐“๐‘œ๐‘œ๐“‰ ๐“‰๐‘œ ๐’ถ๐“๐“ ๐“‚๐‘œ๐“ƒ๐“ˆ๐“‰๐‘’๐“‡๐“ˆ, ๐‘’๐“๐’ธ๐‘’๐“…๐“‰ ๐“‰๐’ฝ๐‘’ ๐‘œ๐“ƒ๐‘’๐“ˆ ๐“‰๐’ฝ๐’ถ๐“‰ ๐’ถ๐“๐“‡๐‘’๐’ถ๐’น๐“Ž ๐’ฝ๐’ถ๐“‹๐‘’ ๐’ถ ๐“‰๐’ถ๐’ท๐“๐‘’, ๐“๐’พ๐“€๐‘’ rotworm ๐’ถ๐“ƒ๐’น dragon. ๐’น๐‘’๐“๐‘’๐“‰๐‘’ ๐“‰๐’ฝ๐‘’๐“‚ ๐’พ๐’ป ๐“Ž๐‘œ๐“Š ๐’ฟ๐“Š๐“ˆ๐“‰ ๐“Œ๐’ถ๐“ƒ๐“‰ ๐“‰๐‘œ ๐“Š๐“ˆ๐‘’ ๐“‰๐’ฝ๐‘’ all ๐“‰๐’ถ๐’ท๐“๐‘’ ๐“‰๐‘œ ๐’ธ๐‘œ๐“ƒ๐“‰๐“‡๐‘œ๐“ ๐‘’๐“‹๐‘’๐“‡๐“Ž๐‘œ๐“ƒ๐‘’.

fds.gif
 
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
โ„‹๐’พ @Stanos โ„ ๐’ฝ๐‘œ๐“…๐‘’ ๐“Ž๐‘œ๐“Š ๐’ถ๐“‡๐‘’ ๐“‹๐‘’๐“‡๐“Ž ๐“Œ๐‘’๐“๐“, ๐“ˆ๐‘œ๐“‡๐“‡๐“Ž ๐’ป๐‘œ๐“‡ ๐“‰๐’ฝ๐‘’ ๐’น๐‘’๐“๐’ถ๐“Ž, โ„ ๐“€๐“ƒ๐‘œ๐“Œ ๐“Ž๐‘œ๐“Š ๐“‚๐’ถ๐“Ž ๐“ƒ๐‘œ๐“‰ ๐“ƒ๐‘’๐‘’๐’น ๐’พ๐“‰ ๐’ถ๐“ƒ๐“Ž๐“‚๐‘œ๐“‡๐‘’ ๐’ท๐“Š๐“‰ โ„'๐“๐“ ๐“๐‘’๐’ถ๐“‹๐‘’ ๐’พ๐“‰ ๐’ฝ๐‘’๐“‡๐‘’ ๐’ถ๐“ƒ๐“Ž๐“Œ๐’ถ๐“Ž:

โ„›๐‘’๐“ˆ๐“Š๐“๐“‰:
data/scripts/predictions.lua
Lua:
local config = {
    talkAction = "/predict",
    talkActionAnswer = "/answer",
    timeout = 5, -- default timeout in minutes
    answersTimeout = 2, -- timeout for answers in minutes
    minimumBet = 100, -- 100 gp
    maximumBet = 1000000, -- 1kk
    multiplierBet = 2, -- You win double(x2) bet if you win.
    rewardBag = 1993 -- reward bag id
}

local predictions = {}

local function formatTime(seconds)
    local hours = math.floor(seconds / 3600)
    local minutes = math.floor((seconds / 60) % 60)
    local seconds = seconds % 60
    return string.format("%02d:%02d:%02d", hours, minutes, seconds)
end

local function timeout(prediction)
    local rewardBag = Game.createItem(config.rewardBag, 1)
    for _, rewardInfo in pairs(prediction.rewards) do
        rewardBag:addItem(rewardInfo.itemId, rewardInfo.count)
    end

    for pid, vote in pairs(prediction.votes) do
        local player = Player(pid)
        if player then
            if vote.answer == prediction.answer then
                player:setBankBalance(player:getBankBalance() + vote.bet * config.multiplierBet)
                player:addItemEx(rewardBag:clone())
                player:sendTextMessage(MESSAGE_LOOT, string.format("You have won: %s.\nYour balance: +%d gold coins.", rewardBag:getContentDescription(), vote.bet * config.multiplierBet))
                player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
            else
                player:sendTextMessage(MESSAGE_INFO_DESCR, "You have lost your bet and rewards.")
            end
        end
    end

    rewardBag:remove()
    predictions[prediction.name] = nil
end

local function start(seconds, prediction)
    if seconds == 0 then
        Game.broadcastMessage(string.format("[Prediction %s] finish.\nThe answer was: %s", prediction.name, prediction.answer), MESSAGE_INFO_DESCR)
        timeout(prediction)
        return
    end

    if seconds ~= prediction.rawTimeout then
        if seconds % math.ceil(prediction.rawTimeout / 6) == 0 then
            local votePercentAnswer1 = prediction.votePercents[prediction.answer1]
            local votePercentAnswer2 = prediction.votePercents[prediction.answer2]
            local totalPercent = votePercentAnswer1 + votePercentAnswer2
            Game.broadcastMessage(string.format("[Prediction %s] %s left to finish.\nVotes: %d%% (%s) | %d%% (%s)", prediction.name, formatTime(seconds), math.ceil(votePercentAnswer1 / totalPercent * 100), prediction.answer1, math.ceil(votePercentAnswer2 / totalPercent * 100), prediction.answer2), MESSAGE_INFO_DESCR)
        end
    end

    if seconds > 0 then
        addEvent(start, 1000, seconds - 1, prediction)
    end
end

local talkAction = TalkAction(config.talkAction)

function talkAction.onSay(player, words, param, type)
    local split = param:splitTrimmed(",")
    local command = split[1]
    if not command or command == "" then
        player:sendCancelMessage("Invalid command paramter.")
        return false
    end

    if command == "create" then
        local predictionName = split[2]
        if not predictionName or predictionName == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local question = split[3]
        if not question or question == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local answer1 = split[4]
        if not answer1 or answer1 == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local answer2 = split[5]
        if not answer2 or answer2 == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local prediction = {
            name = predictionName,
            question = question,
            answer1 = answer1,
            answer2 = answer2,
            rewards = {}
        }

        for i = 6, #split, 2 do
            local reward = ItemType(split[i])
            if not reward or reward:getId() == 0 then
                reward = ItemType(tonumber(split[i]))
                if not reward or reward:getId() == 0 then
                    player:sendCancelMessage("Invalid command paramter.")
                    return false
                end
            end

            local count = tonumber(split[i + 1]) or 1
            if count < 1 then
                player:sendCancelMessage("Invalid command paramter.")
                return false
            end

            prediction.rewards[#prediction.rewards + 1] = {itemId = reward:getId(), count = count}
        end

        predictions[predictionName] = prediction
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Prediction '%s' created.", predictionName))
        return false
    elseif command == "list" then
        local text = "Predictions:\n\n"
        for predictionName, prediction in pairs(predictions) do
            local timeout = (prediction.rawTimeout or config.timeout) * 60
            local answersTimeout = (prediction.answersTimeout or config.answersTimeout) * 60
            text = text .. string.format("> '%s' - timeout: %s - vote: %s\n", predictionName, formatTime(timeout), formatTime(answersTimeout))
        end

        player:popupFYI(text)
        return false
    elseif command == "setanswer" then
        local predictionName = split[2]
        if not predictionName or predictionName == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local prediction = predictions[predictionName]
        if not prediction then
            player:sendCancelMessage("Prediction not found.")
            return false
        end

        local answer = split[3]
        if not answer or answer ~= prediction.answer1 and answer ~= prediction.answer2 then
            player:sendCancelMessage(string.format("Invalid answer, must be %s or %s.", prediction.answer1, prediction.answer2))
            return false
        end

        prediction.answer = answer
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Prediction '%s' set answer to %s.", predictionName, answer))
        return false
    elseif command == "start" then
        local predictionName = split[2]
        if not predictionName or predictionName == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local prediction = predictions[predictionName]
        if not prediction then
            player:sendCancelMessage("Prediction not found.")
            return false
        end

        if not prediction.answer then
            player:sendCancelMessage("Prediction answer not set.")
            return false
        end

        prediction.started = true
        prediction.rawTimeout = (prediction.rawTimeout or config.timeout) * 60
        prediction.rawAnswersTimeout = (prediction.rawAnswersTimeout or config.answersTimeout) * 60
        prediction.timeout = os.time() + prediction.rawTimeout
        prediction.answersTimeout = os.time() + prediction.rawAnswersTimeout
        prediction.votes = {}
        prediction.votePercents = {
            [prediction.answer1] = 0,
            [prediction.answer2] = 0
        }

        local text = string.format("Prediction '%s' started.\n\n%s\n\n%s", predictionName, prediction.question, prediction.answer1)
        if prediction.answer2 ~= prediction.answer1 then
            text = text .. string.format("\n%s", prediction.answer2)
        end
        Game.broadcastMessage(text)
        start(prediction.rawTimeout, prediction)
        return false
    elseif command == "settimeout" then
        local predictionName = split[2]
        if not predictionName or predictionName == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local prediction = predictions[predictionName]
        if not prediction then
            player:sendCancelMessage("Prediction not found.")
            return false
        end

        local timeout = tonumber(split[3])
        if not timeout or timeout < 1 then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local answersTimeout = tonumber(split[4])
        if not answersTimeout or answersTimeout < 1 then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        if timeout <= answersTimeout then
            player:sendCancelMessage("Timeout must be greater than answers timeout.")
            return false
        end

        prediction.rawTimeout = timeout
        prediction.rawAnswersTimeout = math.min(timeout, answersTimeout)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Prediction '%s' set timeout to %s minutes and answers timeout to %s minutes.", predictionName, timeout, answersTimeout))
        return false
    end
    return false
end

talkAction:access(true)
talkAction:separator(" ")
talkAction:register()

local talkAction = TalkAction(config.talkActionAnswer)

function talkAction.onSay(player, words, param, type)
    local split = param:splitTrimmed(",")
    if #split < 2 then
        player:sendCancelMessage("Invalid command paramter.")
        return false
    end

    local predictionName = split[1]
    if not predictionName or predictionName == "" then
        player:sendCancelMessage("Invalid command paramter.")
        return false
    end

    local prediction = predictions[predictionName]
    if not prediction then
        player:sendCancelMessage("Prediction not found.")
        return false
    end

    if not prediction.started then
        player:sendCancelMessage("Prediction not started.")
        return false
    end

    if os.time() > prediction.answersTimeout then
        player:sendCancelMessage("Prediction answers timeout.")
        return false
    end

    local answer = split[2]
    if not answer or answer ~= prediction.answer1 and answer ~= prediction.answer2 then
        player:sendCancelMessage("Invalid answer.")
        return false
    end

    local bet = tonumber(split[3]) or 0
    if bet < config.minimumBet then
        player:sendCancelMessage(string.format("You must bet at least %d gold coins.", config.minimumBet))
        return false
    elseif bet > config.maximumBet then
        player:sendCancelMessage(string.format("You can bet a maximum of %d gold coins.", config.maxmiumBet))
        return false
    end

    local vote = prediction.votes[player:getGuid()]
    if not vote then
        local bankBalance = player:getBankBalance()
        local money = player:getMoney()
        if bet > bankBalance + money then
            player:sendCancelMessage("You do not have enough money.")
            return false
        end

        if money >= bet then
            player:removeMoney(bet)
        else
            player:removeMoney(bet)
            player:setBankBalance(bankBalance + (bet - money))
        end

        prediction.votes[player:getGuid()] = {
            answer = answer,
            bet = bet
        }
        prediction.votePercents[answer] = prediction.votePercents[answer] + 1
    else
        local diffBet = bet - vote.bet
        if diffBet > 0 then
            local bankBalance = player:getBankBalance()
            local money = player:getMoney()
            if diffBet > bankBalance + money then
                player:sendCancelMessage("You do not have enough money.")
                return false
            end

            if money >= diffBet then
                player:removeMoney(diffBet)
            else
                player:removeMoney(diffBet)
                player:setBankBalance(bankBalance + (diffBet - money))
            end
        else
            player:setBankBalance(player:getBankBalance() - diffBet)
        end

        prediction.votePercents[vote.answer] = prediction.votePercents[vote.answer] - 1
        vote.answer = answer
        vote.bet = bet
        prediction.votePercents[answer] = prediction.votePercents[answer] + 1
    end
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You voted.")
    return false
end

talkAction:separator(" ")
talkAction:register()
โ„ ๐“‰๐’ฝ๐’พ๐“ƒ๐“€ โ„ ๐’น๐’พ๐’น ๐“ƒ๐‘œ๐“‰ ๐’ป๐‘œ๐“๐“๐‘œ๐“Œ ๐“‰๐’ฝ๐‘’ ๐“‡๐‘’๐“†๐“Š๐’พ๐“‡๐‘’๐“‚๐‘’๐“ƒ๐“‰๐“ˆ ๐“Ž๐‘œ๐“Š ๐“‚๐‘’๐“ƒ๐“‰๐’พ๐‘œ๐“ƒ๐‘’๐’น ๐“‰๐‘œ ๐“‰๐’ฝ๐‘’ ๐“๐‘’๐“‰๐“‰๐‘’๐“‡, โ„ ๐“‰๐’ฝ๐’พ๐“ƒ๐“€ โ„ ๐’น๐’พ๐’น ๐“ƒ๐‘œ๐“‰ ๐“Š๐“ƒ๐’น๐‘’๐“‡๐“ˆ๐“‰๐’ถ๐“ƒ๐’น ๐‘’๐“‹๐‘’๐“‡๐“Ž๐“‰๐’ฝ๐’พ๐“ƒ๐‘”. โ„ฌ๐“Š๐“‰ โ„ ๐“Œ๐’พ๐“๐“ ๐‘’๐“๐“…๐“๐’ถ๐’พ๐“ƒ ๐’ฝ๐‘œ๐“Œ ๐“Ž๐‘œ๐“Š ๐’ธ๐’ถ๐“ƒ ๐“Š๐“ˆ๐‘’ ๐“‰๐’ฝ๐’พ๐“ˆ ๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰.

๐’œ๐’น๐“‚๐’พ๐“ƒ ๐’ž๐‘œ๐“‚๐“‚๐’ถ๐“ƒ๐’น๐“ˆ:
* Create a prediction: /predict create,predictName,Question,Answer1,Answer2,Rewards...
example: /predict create,baby,You are a baby?,yes,no,crystal coin,10,fire axe,1,gold coin,50

* Set Answer: /predict setanswer,predictName,Answer1 or /predict setanswer,predictName,Answer2
example: /predict setanswer,baby,yes or /predict setanswer,baby,no

* Set Timeout: /predict settimeout,predictName,Timeout,VoteTimeOut in minutes.
example: /predict settimeout,baby,10,5 then the prediction ends in 10 minutes and you have 5 minutes to vote for an answer.

* Start Prediction: /predict start,predictName
example: /predict start,baby

๐’ซ๐“๐’ถ๐“Ž๐‘’๐“‡๐“ˆ ๐’ž๐‘œ๐“‚๐“‚๐’ถ๐“ƒ๐’น๐“ˆ:
* Vote and bet for a answer: /answer predictName,Answer,Bet
example: /answer baby,no,1000

asdsa.gif

๐’ฉ๐‘œ๐“‰๐‘’๐“ˆ:
โ„๐“ƒ ๐’ธ๐’ถ๐“ˆ๐‘’ ๐“Ž๐‘œ๐“Š ๐’ฝ๐’ถ๐“‹๐‘’๐“ƒ'๐“‰ ๐“ƒ๐‘œ๐“‰๐’พ๐’ธ๐‘’๐’น ๐“‰๐’ฝ๐’พ๐“ˆ ๐“‹๐‘’๐“‡๐“ˆ๐’พ๐‘œ๐“ƒ ๐’ถ๐“๐“๐‘œ๐“Œ๐“ˆ ๐“Ž๐‘œ๐“Š ๐“‰๐‘œ ๐’ธ๐“‡๐‘’๐’ถ๐“‰๐‘’ ๐“ˆ๐‘’๐“‹๐‘’๐“‡๐’ถ๐“ ๐“…๐“‡๐‘’๐’น๐’พ๐’ธ๐“‰๐’พ๐‘œ๐“ƒ๐“ˆ ๐’ถ๐“ƒ๐’น ๐’ถ๐’ธ๐“‰๐’พ๐“‹๐’ถ๐“‰๐‘’ ๐“‰๐’ฝ๐‘’๐“‚ ๐“Œ๐’ฝ๐‘’๐“ƒ ๐“ƒ๐‘’๐’ธ๐‘’๐“ˆ๐“ˆ๐’ถ๐“‡๐“Ž, ๐“‡๐‘’๐“๐‘œ๐’ถ๐’น๐’พ๐“ƒ๐‘” ๐“‰๐’ฝ๐‘’ ๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰๐“ˆ ๐“Œ๐’พ๐“๐“ ๐“‡๐‘’๐“‚๐‘œ๐“‹๐‘’ ๐‘’๐“‹๐‘’๐“‡๐“Ž๐“‰๐’ฝ๐’พ๐“ƒ๐‘”, ๐“Ž๐‘œ๐“Š ๐“ˆ๐’ฝ๐‘œ๐“Š๐“๐’น๐“ƒ'๐“‰ ๐“‡๐‘’๐“๐‘œ๐’ถ๐’น ๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰๐“ˆ ๐’พ๐“ƒ ๐“‰๐’ฝ๐‘’ ๐“‚๐’พ๐’น๐’น๐“๐‘’ ๐‘œ๐’ป ๐“…๐“‡๐‘’๐’น๐’พ๐’ธ๐“‰๐’พ๐‘œ๐“ƒ ๐“…๐“‡๐‘œ๐‘”๐“‡๐‘’๐“ˆ๐“ˆ.
 
data/scripts/factions.lua

Lua:
local config = {
    talkAction = "!faction",
    storage = 888999,
    storageCount = 888998,
    storageDeaths = 888997,
    options = {
        ["red"] = {
            id = 1,
            text = "Red",
            allowPvp = true
        },
        ["blue"] = {
            id = 2,
            text = "Blue",
            allowPvp = true
        }
    }
}

config.optionsByIndex = {}
for k, v in pairs(config.options) do
    config.optionsByIndex[v.id] = v
end

local function getFaction(player)
    return config.optionsByIndex[player.storage[config.storage]]
end

local talkAction = TalkAction(config.talkAction)

function talkAction.onSay(player, words, param, type)
    local option = config.options[param:lower()]
    if not option then
        player:sendCancelMessage("This faction is not exist.")
        return false
    end
    local faction = getFaction(player)
    if faction then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You already have a faction.")
        return false
    end
    player.storage[config.storage] = option.id
    player.storage[config.storageCount] = 0
    player.storage[config.storageDeaths] = 0
    player:sendTextMessage(MESSAGE_INFO_DESCR, "Cangratulations! You have joined " .. option.text .. " faction.")
    player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    player:registerEvent("FactionDeaths")
    return false
end

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

local ec = EventCallback

function ec.onLook(player, thing, position, distance, description)
    if not thing:isCreature() then
        return description
    end
    local other = thing:getPlayer()
    if not other then
        return description
    end
    local playerFaction = getFaction(other)
    if not playerFaction then
        return description
    end
    description = string.format("%s\nFaction: %s | Kills: %d | Deaths: %d", description, playerFaction.text, other.storage[config.storageCount], other.storage[config.storageDeaths])
    return description
end

ec:register(1)

local ec = EventCallback

function ec.onTargetCombat(creature, target)
    if not creature or not target then
        return RETURNVALUE_NOERROR
    end
    local player = creature:getPlayer()
    if not player then
        return RETURNVALUE_NOERROR
    end
    local other = target:getPlayer()
    if not other then
        return RETURNVALUE_NOERROR
    end
    local playerFaction = getFaction(player)
    if not playerFaction then
        return RETURNVALUE_NOERROR
    end
    local otherFaction = getFaction(other)
    if not otherFaction then
        return RETURNVALUE_NOERROR
    end
    if playerFaction.id == otherFaction.id then
        return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
    end
    if playerFaction.allowPvp and otherFaction.allowPvp then
        return RETURNVALUE_NOERROR
    end
    return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
end

ec:register(-1)

local function getLastDamagers(player)
    local lastDamagers = {}
    local timeNow = os.mtime()
    local inFightTicks = configManager.getNumber(configKeys.PZ_LOCKED)
    for uid, cb in pairs(player:getDamageMap()) do
        local otherPlayer = Player(uid)
        if otherPlayer and otherPlayer:getId() ~= player:getId() then
            if timeNow - cb.ticks <= inFightTicks then
                lastDamagers[#lastDamagers + 1] = otherPlayer
            end
        end
    end
    return lastDamagers
end

local creatureEvent = CreatureEvent("FactionDeaths")

function creatureEvent.onDeath(player, corpse, lastHitKiller, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    local playerFaction = getFaction(player)
    if not playerFaction then
        return true
    end
    local lastDamagers = getLastDamagers(player)
    if not next(lastDamagers) then
        return true
    end
    local killedByOtherFaction = false
    for _, damager in ipairs(lastDamagers) do
        local damagerFaction = getFaction(damager)
        if damagerFaction and damagerFaction.id ~= playerFaction.id then
            damager.storage[config.storageCount] = damager.storage[config.storageCount] + 1
            damager:sendTextMessage(MESSAGE_INFO_DESCR, "You received 1 faction kill point for killing " .. player:getName() .. ".")
            killedByOtherFaction = true
        end
    end
    if killedByOtherFaction then
        player.storage[config.storageDeaths] = player.storage[config.storageDeaths] + 1
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You received 1 faction death point for being killed by another faction.")
    end
    return true
end

creatureEvent:register()

local creatureEvent = CreatureEvent("FactionLogin")

function creatureEvent.onLogin(player)
    local playerFaction = getFaction(player)
    if not playerFaction then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You have to join a faction first, please choose one by typing '!faction red' or '!faction blue'.")
        return true
    end
    player:registerEvent("FactionDeaths")
    return true
end

creatureEvent:register()

When a player has no faction then they will be prompted to choose one when they log in.
The factions can`t deal damage to each other same faction.
The player description will show the faction you belong to and the deaths and kills.
View attachment 68815
Post automatically merged:


I'm not sure if I understood what you wanted, but here I did this for you, I hope it helps.
I've tried to test this script, but I Got this error when trying to login for the first time with the script active.
(im using tfs 1.4, not sure if that's why)
1661333776585.png

i've checked the code, and noticed a couple things, the combat check is done in targetCombat, does that mean that area spells without a target (like UE, gfb, avalanche, etc) will be able to do damage to the same faction?

Also, players will get skull when attacking someone from other faction?
 
โ„‹๐’พ @Stanos โ„ ๐’ฝ๐‘œ๐“…๐‘’ ๐“Ž๐‘œ๐“Š ๐’ถ๐“‡๐‘’ ๐“‹๐‘’๐“‡๐“Ž ๐“Œ๐‘’๐“๐“, ๐“ˆ๐‘œ๐“‡๐“‡๐“Ž ๐’ป๐‘œ๐“‡ ๐“‰๐’ฝ๐‘’ ๐’น๐‘’๐“๐’ถ๐“Ž, โ„ ๐“€๐“ƒ๐‘œ๐“Œ ๐“Ž๐‘œ๐“Š ๐“‚๐’ถ๐“Ž ๐“ƒ๐‘œ๐“‰ ๐“ƒ๐‘’๐‘’๐’น ๐’พ๐“‰ ๐’ถ๐“ƒ๐“Ž๐“‚๐‘œ๐“‡๐‘’ ๐’ท๐“Š๐“‰ โ„'๐“๐“ ๐“๐‘’๐’ถ๐“‹๐‘’ ๐’พ๐“‰ ๐’ฝ๐‘’๐“‡๐‘’ ๐’ถ๐“ƒ๐“Ž๐“Œ๐’ถ๐“Ž:

โ„›๐‘’๐“ˆ๐“Š๐“๐“‰:
data/scripts/predictions.lua
Lua:
local config = {
    talkAction = "/predict",
    talkActionAnswer = "/answer",
    timeout = 5, -- default timeout in minutes
    answersTimeout = 2, -- timeout for answers in minutes
    minimumBet = 100, -- 100 gp
    maximumBet = 1000000, -- 1kk
    multiplierBet = 2, -- You win double(x2) bet if you win.
    rewardBag = 1993 -- reward bag id
}

local predictions = {}

local function formatTime(seconds)
    local hours = math.floor(seconds / 3600)
    local minutes = math.floor((seconds / 60) % 60)
    local seconds = seconds % 60
    return string.format("%02d:%02d:%02d", hours, minutes, seconds)
end

local function timeout(prediction)
    local rewardBag = Game.createItem(config.rewardBag, 1)
    for _, rewardInfo in pairs(prediction.rewards) do
        rewardBag:addItem(rewardInfo.itemId, rewardInfo.count)
    end

    for pid, vote in pairs(prediction.votes) do
        local player = Player(pid)
        if player then
            if vote.answer == prediction.answer then
                player:setBankBalance(player:getBankBalance() + vote.bet * config.multiplierBet)
                player:addItemEx(rewardBag:clone())
                player:sendTextMessage(MESSAGE_LOOT, string.format("You have won: %s.\nYour balance: +%d gold coins.", rewardBag:getContentDescription(), vote.bet * config.multiplierBet))
                player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
            else
                player:sendTextMessage(MESSAGE_INFO_DESCR, "You have lost your bet and rewards.")
            end
        end
    end

    rewardBag:remove()
    predictions[prediction.name] = nil
end

local function start(seconds, prediction)
    if seconds == 0 then
        Game.broadcastMessage(string.format("[Prediction %s] finish.\nThe answer was: %s", prediction.name, prediction.answer), MESSAGE_INFO_DESCR)
        timeout(prediction)
        return
    end

    if seconds ~= prediction.rawTimeout then
        if seconds % math.ceil(prediction.rawTimeout / 6) == 0 then
            local votePercentAnswer1 = prediction.votePercents[prediction.answer1]
            local votePercentAnswer2 = prediction.votePercents[prediction.answer2]
            local totalPercent = votePercentAnswer1 + votePercentAnswer2
            Game.broadcastMessage(string.format("[Prediction %s] %s left to finish.\nVotes: %d%% (%s) | %d%% (%s)", prediction.name, formatTime(seconds), math.ceil(votePercentAnswer1 / totalPercent * 100), prediction.answer1, math.ceil(votePercentAnswer2 / totalPercent * 100), prediction.answer2), MESSAGE_INFO_DESCR)
        end
    end

    if seconds > 0 then
        addEvent(start, 1000, seconds - 1, prediction)
    end
end

local talkAction = TalkAction(config.talkAction)

function talkAction.onSay(player, words, param, type)
    local split = param:splitTrimmed(",")
    local command = split[1]
    if not command or command == "" then
        player:sendCancelMessage("Invalid command paramter.")
        return false
    end

    if command == "create" then
        local predictionName = split[2]
        if not predictionName or predictionName == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local question = split[3]
        if not question or question == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local answer1 = split[4]
        if not answer1 or answer1 == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local answer2 = split[5]
        if not answer2 or answer2 == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local prediction = {
            name = predictionName,
            question = question,
            answer1 = answer1,
            answer2 = answer2,
            rewards = {}
        }

        for i = 6, #split, 2 do
            local reward = ItemType(split[i])
            if not reward or reward:getId() == 0 then
                reward = ItemType(tonumber(split[i]))
                if not reward or reward:getId() == 0 then
                    player:sendCancelMessage("Invalid command paramter.")
                    return false
                end
            end

            local count = tonumber(split[i + 1]) or 1
            if count < 1 then
                player:sendCancelMessage("Invalid command paramter.")
                return false
            end

            prediction.rewards[#prediction.rewards + 1] = {itemId = reward:getId(), count = count}
        end

        predictions[predictionName] = prediction
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Prediction '%s' created.", predictionName))
        return false
    elseif command == "list" then
        local text = "Predictions:\n\n"
        for predictionName, prediction in pairs(predictions) do
            local timeout = (prediction.rawTimeout or config.timeout) * 60
            local answersTimeout = (prediction.answersTimeout or config.answersTimeout) * 60
            text = text .. string.format("> '%s' - timeout: %s - vote: %s\n", predictionName, formatTime(timeout), formatTime(answersTimeout))
        end

        player:popupFYI(text)
        return false
    elseif command == "setanswer" then
        local predictionName = split[2]
        if not predictionName or predictionName == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local prediction = predictions[predictionName]
        if not prediction then
            player:sendCancelMessage("Prediction not found.")
            return false
        end

        local answer = split[3]
        if not answer or answer ~= prediction.answer1 and answer ~= prediction.answer2 then
            player:sendCancelMessage(string.format("Invalid answer, must be %s or %s.", prediction.answer1, prediction.answer2))
            return false
        end

        prediction.answer = answer
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Prediction '%s' set answer to %s.", predictionName, answer))
        return false
    elseif command == "start" then
        local predictionName = split[2]
        if not predictionName or predictionName == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local prediction = predictions[predictionName]
        if not prediction then
            player:sendCancelMessage("Prediction not found.")
            return false
        end

        if not prediction.answer then
            player:sendCancelMessage("Prediction answer not set.")
            return false
        end

        prediction.started = true
        prediction.rawTimeout = (prediction.rawTimeout or config.timeout) * 60
        prediction.rawAnswersTimeout = (prediction.rawAnswersTimeout or config.answersTimeout) * 60
        prediction.timeout = os.time() + prediction.rawTimeout
        prediction.answersTimeout = os.time() + prediction.rawAnswersTimeout
        prediction.votes = {}
        prediction.votePercents = {
            [prediction.answer1] = 0,
            [prediction.answer2] = 0
        }

        local text = string.format("Prediction '%s' started.\n\n%s\n\n%s", predictionName, prediction.question, prediction.answer1)
        if prediction.answer2 ~= prediction.answer1 then
            text = text .. string.format("\n%s", prediction.answer2)
        end
        Game.broadcastMessage(text)
        start(prediction.rawTimeout, prediction)
        return false
    elseif command == "settimeout" then
        local predictionName = split[2]
        if not predictionName or predictionName == "" then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local prediction = predictions[predictionName]
        if not prediction then
            player:sendCancelMessage("Prediction not found.")
            return false
        end

        local timeout = tonumber(split[3])
        if not timeout or timeout < 1 then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        local answersTimeout = tonumber(split[4])
        if not answersTimeout or answersTimeout < 1 then
            player:sendCancelMessage("Invalid command paramter.")
            return false
        end

        if timeout <= answersTimeout then
            player:sendCancelMessage("Timeout must be greater than answers timeout.")
            return false
        end

        prediction.rawTimeout = timeout
        prediction.rawAnswersTimeout = math.min(timeout, answersTimeout)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Prediction '%s' set timeout to %s minutes and answers timeout to %s minutes.", predictionName, timeout, answersTimeout))
        return false
    end
    return false
end

talkAction:access(true)
talkAction:separator(" ")
talkAction:register()

local talkAction = TalkAction(config.talkActionAnswer)

function talkAction.onSay(player, words, param, type)
    local split = param:splitTrimmed(",")
    if #split < 2 then
        player:sendCancelMessage("Invalid command paramter.")
        return false
    end

    local predictionName = split[1]
    if not predictionName or predictionName == "" then
        player:sendCancelMessage("Invalid command paramter.")
        return false
    end

    local prediction = predictions[predictionName]
    if not prediction then
        player:sendCancelMessage("Prediction not found.")
        return false
    end

    if not prediction.started then
        player:sendCancelMessage("Prediction not started.")
        return false
    end

    if os.time() > prediction.answersTimeout then
        player:sendCancelMessage("Prediction answers timeout.")
        return false
    end

    local answer = split[2]
    if not answer or answer ~= prediction.answer1 and answer ~= prediction.answer2 then
        player:sendCancelMessage("Invalid answer.")
        return false
    end

    local bet = tonumber(split[3]) or 0
    if bet < config.minimumBet then
        player:sendCancelMessage(string.format("You must bet at least %d gold coins.", config.minimumBet))
        return false
    elseif bet > config.maximumBet then
        player:sendCancelMessage(string.format("You can bet a maximum of %d gold coins.", config.maxmiumBet))
        return false
    end

    local vote = prediction.votes[player:getGuid()]
    if not vote then
        local bankBalance = player:getBankBalance()
        local money = player:getMoney()
        if bet > bankBalance + money then
            player:sendCancelMessage("You do not have enough money.")
            return false
        end

        if money >= bet then
            player:removeMoney(bet)
        else
            player:removeMoney(bet)
            player:setBankBalance(bankBalance + (bet - money))
        end

        prediction.votes[player:getGuid()] = {
            answer = answer,
            bet = bet
        }
        prediction.votePercents[answer] = prediction.votePercents[answer] + 1
    else
        local diffBet = bet - vote.bet
        if diffBet > 0 then
            local bankBalance = player:getBankBalance()
            local money = player:getMoney()
            if diffBet > bankBalance + money then
                player:sendCancelMessage("You do not have enough money.")
                return false
            end

            if money >= diffBet then
                player:removeMoney(diffBet)
            else
                player:removeMoney(diffBet)
                player:setBankBalance(bankBalance + (diffBet - money))
            end
        else
            player:setBankBalance(player:getBankBalance() - diffBet)
        end

        prediction.votePercents[vote.answer] = prediction.votePercents[vote.answer] - 1
        vote.answer = answer
        vote.bet = bet
        prediction.votePercents[answer] = prediction.votePercents[answer] + 1
    end
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You voted.")
    return false
end

talkAction:separator(" ")
talkAction:register()
โ„ ๐“‰๐’ฝ๐’พ๐“ƒ๐“€ โ„ ๐’น๐’พ๐’น ๐“ƒ๐‘œ๐“‰ ๐’ป๐‘œ๐“๐“๐‘œ๐“Œ ๐“‰๐’ฝ๐‘’ ๐“‡๐‘’๐“†๐“Š๐’พ๐“‡๐‘’๐“‚๐‘’๐“ƒ๐“‰๐“ˆ ๐“Ž๐‘œ๐“Š ๐“‚๐‘’๐“ƒ๐“‰๐’พ๐‘œ๐“ƒ๐‘’๐’น ๐“‰๐‘œ ๐“‰๐’ฝ๐‘’ ๐“๐‘’๐“‰๐“‰๐‘’๐“‡, โ„ ๐“‰๐’ฝ๐’พ๐“ƒ๐“€ โ„ ๐’น๐’พ๐’น ๐“ƒ๐‘œ๐“‰ ๐“Š๐“ƒ๐’น๐‘’๐“‡๐“ˆ๐“‰๐’ถ๐“ƒ๐’น ๐‘’๐“‹๐‘’๐“‡๐“Ž๐“‰๐’ฝ๐’พ๐“ƒ๐‘”. โ„ฌ๐“Š๐“‰ โ„ ๐“Œ๐’พ๐“๐“ ๐‘’๐“๐“…๐“๐’ถ๐’พ๐“ƒ ๐’ฝ๐‘œ๐“Œ ๐“Ž๐‘œ๐“Š ๐’ธ๐’ถ๐“ƒ ๐“Š๐“ˆ๐‘’ ๐“‰๐’ฝ๐’พ๐“ˆ ๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰.

๐’œ๐’น๐“‚๐’พ๐“ƒ ๐’ž๐‘œ๐“‚๐“‚๐’ถ๐“ƒ๐’น๐“ˆ:
* Create a prediction: /predict create,predictName,Question,Answer1,Answer2,Rewards...
example: /predict create,baby,You are a baby?,yes,no,crystal coin,10,fire axe,1,gold coin,50

* Set Answer: /predict setanswer,predictName,Answer1 or /predict setanswer,predictName,Answer2
example: /predict setanswer,baby,yes or /predict setanswer,baby,no

* Set Timeout: /predict settimeout,predictName,Timeout,VoteTimeOut in minutes.
example: /predict settimeout,baby,10,5 then the prediction ends in 10 minutes and you have 5 minutes to vote for an answer.

* Start Prediction: /predict start,predictName
example: /predict start,baby

๐’ซ๐“๐’ถ๐“Ž๐‘’๐“‡๐“ˆ ๐’ž๐‘œ๐“‚๐“‚๐’ถ๐“ƒ๐’น๐“ˆ:
* Vote and bet for a answer: /answer predictName,Answer,Bet
example: /answer baby,no,1000

View attachment 70063

๐’ฉ๐‘œ๐“‰๐‘’๐“ˆ:
โ„๐“ƒ ๐’ธ๐’ถ๐“ˆ๐‘’ ๐“Ž๐‘œ๐“Š ๐’ฝ๐’ถ๐“‹๐‘’๐“ƒ'๐“‰ ๐“ƒ๐‘œ๐“‰๐’พ๐’ธ๐‘’๐’น ๐“‰๐’ฝ๐’พ๐“ˆ ๐“‹๐‘’๐“‡๐“ˆ๐’พ๐‘œ๐“ƒ ๐’ถ๐“๐“๐‘œ๐“Œ๐“ˆ ๐“Ž๐‘œ๐“Š ๐“‰๐‘œ ๐’ธ๐“‡๐‘’๐’ถ๐“‰๐‘’ ๐“ˆ๐‘’๐“‹๐‘’๐“‡๐’ถ๐“ ๐“…๐“‡๐‘’๐’น๐’พ๐’ธ๐“‰๐’พ๐‘œ๐“ƒ๐“ˆ ๐’ถ๐“ƒ๐’น ๐’ถ๐’ธ๐“‰๐’พ๐“‹๐’ถ๐“‰๐‘’ ๐“‰๐’ฝ๐‘’๐“‚ ๐“Œ๐’ฝ๐‘’๐“ƒ ๐“ƒ๐‘’๐’ธ๐‘’๐“ˆ๐“ˆ๐’ถ๐“‡๐“Ž, ๐“‡๐‘’๐“๐‘œ๐’ถ๐’น๐’พ๐“ƒ๐‘” ๐“‰๐’ฝ๐‘’ ๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰๐“ˆ ๐“Œ๐’พ๐“๐“ ๐“‡๐‘’๐“‚๐‘œ๐“‹๐‘’ ๐‘’๐“‹๐‘’๐“‡๐“Ž๐“‰๐’ฝ๐’พ๐“ƒ๐‘”, ๐“Ž๐‘œ๐“Š ๐“ˆ๐’ฝ๐‘œ๐“Š๐“๐’น๐“ƒ'๐“‰ ๐“‡๐‘’๐“๐‘œ๐’ถ๐’น ๐“ˆ๐’ธ๐“‡๐’พ๐“…๐“‰๐“ˆ ๐’พ๐“ƒ ๐“‰๐’ฝ๐‘’ ๐“‚๐’พ๐’น๐’น๐“๐‘’ ๐‘œ๐’ป ๐“…๐“‡๐‘’๐’น๐’พ๐’ธ๐“‰๐’พ๐‘œ๐“ƒ ๐“…๐“‡๐‘œ๐‘”๐“‡๐‘’๐“ˆ๐“ˆ.
Good stuff my queen
 
I need help or if someone knows how to fix it, when I do the tasks and kill the 5000 minotaurs, grizzly adams tells me to go to a certain place to kill the boss, on my server it has that disabled, and they can enter the boss's teleport without doing the tasks task, how do I fix that?
 
Hello sarah, could you try making a !invite, !join talkaction for party invites? dont know if its hardcoded or not tbh. :)
data/scripts/party.lua
Lua:
local talkAction = TalkAction("!party")

function talkAction.onSay(player, words, param, type)
    local split = param:splitTrimmed(",")
    local action = split[1] and split[1]:lower() or ""
    if action == "" then
        player:sendCancelMessage("Command param required.\nOptions: create, join, leave, invite, kick, leader, disband.")
        return false
    end

    local party = player:getParty()
    if action == "create" then
        if party then
            player:sendCancelMessage("You are already in a party.")
            return false
        end

        party = Party(player)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have created a party.")
    elseif action == "join" then
        if party then
            player:sendCancelMessage("You are already in a party.")
            return false
        end

        local target = Player(split[2])
        if not target then
            player:sendCancelMessage("Player not found.")
            return false
        end

        local targetParty = target:getParty()
        if not targetParty then
            player:sendCancelMessage("Player is not in a party.")
            return false
        end

        for _, invitee in pairs(targetParty:getInvitees()) do
            if invitee == player then
                targetParty:addMember(player)
                return false
            end
        end

        player:sendCancelMessage("You have not been invited to this party.")
    elseif action == "leave" then
        if not party then
            player:sendCancelMessage("You are not in a party.")
            return false
        end

        party:removeMember(player)
    elseif action == "invite" then
        local target = Player(split[2])
        if not target then
            player:sendCancelMessage("Player not found.")
            return false
        end

        if target:getParty() then
            player:sendCancelMessage("Player is already in a party.")
            return false
        end

        if not party then
            party = Party(player)
        end

        party:addInvite(target)
    elseif action == "kick" then
        if not party then
            player:sendCancelMessage("You are not in a party.")
            return false
        end

        local target = Player(split[2])
        if not target then
            player:sendCancelMessage("Player not found.")
            return false
        end

        if target:getParty() ~= party then
            player:sendCancelMessage("Player is not in your party.")
            return false
        end

        party:removeMember(target)
    elseif action == "leader" then
        if not party then
            player:sendCancelMessage("You are not in a party.")
            return false
        end

        local target = Player(split[2])
        if not target then
            player:sendCancelMessage("Player not found.")
            return false
        end

        if target:getParty() ~= party then
            player:sendCancelMessage("Player is not in your party.")
            return false
        end

        party:setLeader(target)
    elseif action == "disband" then
        if not party then
            player:sendCancelMessage("You are not in a party.")
            return false
        end

        party:disband()
    else
        player:sendCancelMessage("Invalid option.")
        return false
    end
    return false
end

talkAction:separator(" ")
talkAction:register()
 
would it be possible to make a revscript of a SPELLS
like mordekai's ultimate attack of league of legends on tibia.
context.

spells when targeting another creature, both are teleported to a certain area for approximately 10 seconds, where the caster gains a buff from his abilities.

When 10 seconds have passed since the teleportation, they both return to their previous cast spell location.

what would happen if 2 player in different locations cast spells almost at the same time? would they stay in the same area? or if the area is occupied they would go to another area
 
Hello, I am interested in a cumulative addon system that checks how many full addons the player has and gives a bonus accordingly.
For example: 1 full addon gives the player 1% protection all, 2 full addons gives the player 2% protection all + 1 magic level etc.
(This bonus should always be active after a player unlocks a new full addon set)
TFS 1.5
Thanks :)
 
hey sarah u can help me ?
 
Hello Sarah Wesker,

I would like to request a Skill stage script, Vocation based.
For an Example:
Sorc below Magic Level 20 gains 10x Multiplier and over 20 gains 8x Multiplier

Same for Dist/Club/Axe/Fist, Fishing isnt that important
If its possible would be nice to have if its not possible in REVscript let me know and I will try to find an other solution

But thanks anyway for doing such an impressive work :)

data/scripts/skillmultiplier.lua
Lua:
local vocations = {
    [1] = { -- Sorcerer
        [{1, 19}] = { -- Level 1-19
            [SKILL_MAGLEVEL] = 10
        },
        [{20, 100}] = { -- Level 20-100
            [SKILL_MAGLEVEL] = 8
        }
    },
    [2] = { -- Druid
        [{1, 19}] = { -- Level 1-19
            [SKILL_MAGLEVEL] = 10
        },
        [{20, 100}] = { -- Level 20-100
            [SKILL_MAGLEVEL] = 8
        }
    },
    [3] = { -- Paladin
        [{1, 100}] = { -- Level 1-100
            [SKILL_FIST] = 10,
            [SKILL_CLUB] = 10,
            [SKILL_SWORD] = 10,
            [SKILL_AXE] = 10,
            [SKILL_DISTANCE] = 10,
            [SKILL_SHIELD] = 10,
            [SKILL_FISHING] = 10
        }
    },
    [4] = { -- Knight
        [{1, 100}] = { -- Level 1-100
            [SKILL_FIST] = 10,
            [SKILL_CLUB] = 10,
            [SKILL_SWORD] = 10,
            [SKILL_AXE] = 10,
            [SKILL_DISTANCE] = 10,
            [SKILL_SHIELD] = 10,
            [SKILL_FISHING] = 10
        }
    }
}

local ec = EventCallback

function ec.onGainSkillTries(player, skill, tries)
    local vocation = vocations[player:getVocation():getBase():getId()]
    if not vocation then
        return true
    end

    local level = player:getLevel()
    for range, skills in pairs(vocation) do
        if level >= range[1] and level <= range[2] then
            local multiplier = skills[skill]
            if multiplier then
                return tries * multiplier
            end
            break
        end
    end
    return tries
end

ec:register(--[[0]])
Remember to activate the event onGainSkillTries on data/events/events.xml
 
good night sara it is possible to grant permanent critical to the premium player.

If that were the case, I would like a script that complies with that, giving the premium player a permanent critical to the premium player.

1666835294703.png

an extra in the critical +10 in total would be +20 being premium
 
Back
Top