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

Lua Xikini's Free Scripting Service TFS 1.4.2

Status
Not open for further replies.

Xikini

I whore myself out for likes
Senator
Premium User
Joined
Nov 17, 2010
Messages
6,798
Solutions
581
Reaction score
5,361
Request whatever you want, within reason.

Please do not request for things that require source editing or database queries.

------------------------------------
If I've reacted to your post, it means I've read it. 👍😍🤣😲🙁😡🤔😉

------------------------------------
Completed Requests

A boss that randomly creates effects on tiles, that when stepped on, gives the player increased damage/mitigation to that boss.
Kill monster and gain X% extra loot chance or Y% extra experience for Z minutes
A pack of 6 useful simple scripts.
-> (1) Simple quest npc
-> (2,3,4,5) use levers in specific order / stand with 4 players / use 4 objects / place items -> to open wall
-> (6) use lever to add/remove/replace objects
Wave type spell, with multiple effects
-> Same spell, but with default combat system
House market system. (owner places price on blackboard and object on the ground, other players buy with a lever)
Respawn System (closest anchor (like darks souls bonfire) / tavern / temple)
Vocation Death Protection (protect the noobs!)
Spell that shows area it will damage, before it strikes.
RAID SYSTEM - rebuilt in Lua, with some more features.
Modal Window - Teleport Item with saving/deleting of positions
Show top 3 Online Players (outfit, name, level) (as monsters, in set positions)
onLook function showing kill count of player.
Modal Window - Use Item -> choose reward.
Talkaction - !backpacks - to buy backpacks (or single items) anywhere. uses bank & current money on players
Quest/Event? Turn a bunch of objects with a monster, spawn portal.
Spawn Monsters, after they've all been killed, give global increased experience/loot in specific area's
Evolving Weapons - Kill X amount of specific creatures, evolve weapon and gain extra damage to those creatures.
Random Portals spawn at XX:XX time(s). (can exit 'off' portals, if you have the storage.)
Monster that adjusts speed based on target
Monster that increases damage output based on # of players nearby
Experience recovery Item. Die -> Use Item -> gain % of lost experience
Character Snapshot - Keeps track of all skills & level, for resetting later.
Fire Dagger - Physical Damage Melee Weapon, with % added damage
Players in specific level ranges don't lose skills/loot/experience, when they die.
Multiclient Limit Check - with admin account not being counted towards limit
Capacity Increasing Items
Upgradeable Protection Amulet - 10% to all elements
-> upgrade amulet, but for all items.
onKill - give reward to all players who dealt damage
-> example: give reward based on damage contribution
Quest Book - Record your quest progress into a book.
Stat System, using modal windows
Holy Tible (POI) - Require Item to use teleport tiles
Item Upgrade System
Skill Stages
-> individual stages for each skill type
-> talkaction to check rates (by @Extrodus)
Random Reward Item - gives different rewards based on vocation
Bounty Hunter System
NPC & Player Walk System (Follow Nodes to destination)
Health/Mana gain permanent - limited use items

------------------------------------
Support

If you have an issue with one of my scripts, I will attempt to help you, but not in this thread.
Make a thread in the support board.
Ensure to follow all rules of the support board.
Without all necessary information it's impossible to help you.

------------------------------------
I will only be scripting for TFS 1.4.2

Not TFS 1.1 / 1.2
Not OTServBR / OTX
and certainly not TFS 0.4

When requesting a script, don't ask for "this script I saw on super popular OT".

I don't care where the idea came from.
I don't want to see a video of the script in action.

Just describe what the script is supposed to do, and I'll try to make it.

Any script that I make in response to a request from this thread will be shared publicly, here, in this thread.

I'm not going to make anything in private, so post your request in this thread only.
Please, for the love of god, don't pm me asking to make a script.
I will actually add you to my ignore list if you do that.
--------------

Anyways!

Thanks for coming by and checking the thread out.
If you think there is a better way to script something, feel free to let me know.
I'm here to learn.

Cheers,

Xikini
---------

P.S.
I've been doing free scripting service's on/off for awhile.
And if you want to see the previous threads, go check them here.

 
Last edited by a moderator:
Probably needs more features added, such as limits to each stat, and possibly restrictions per vocation..
But the base system is there.

View attachment 82140
You are amazing! I will further expand your script now. I have received error at the start but code bellow fixed it. Thanks AGAIN!
Lua:
local function createStatWindow(playerId)
    local player = Player(playerId)
    if not player then
        return
    end

    -- Removed hasEvent check and directly registering the event
    player:registerEvent(config.modalWindow.eventText)
 
    local storageValue = player:getStorageValue(config.statStorageKey)
    local modalWindow = ModalWindow(config.modalWindow.id, config.modalWindow.title, "You have " .. (storageValue > 0 and storageValue or 0) .. " stat points to spend.")
 
    for id, button in ipairs(config.modalWindow.buttons) do
        modalWindow:addButton(id, button.text)
        if button.defaultEscapeButton then
            modalWindow:setDefaultEscapeButton(id)
        elseif button.defaultEnterButton then
            modalWindow:setDefaultEnterButton(id)
        end
    end
 
    for id, stat in ipairs(choiceDictionary) do
        local storageValue = player:getStorageValue(stat.storageKey)
        storageValue = storageValue > 0 and storageValue or 0
        modalWindow:addChoice(id, "[" .. storageValue .. "] " .. stat.statType)
    end
 
    modalWindow:hasPriority()
    modalWindow:sendToPlayer(player)
end
 
You are amazing! I will further expand your script now. I have received error at the start but code bellow fixed it. Thanks AGAIN!
Lua:
local function createStatWindow(playerId)
    local player = Player(playerId)
    if not player then
        return
    end

    -- Removed hasEvent check and directly registering the event
    player:registerEvent(config.modalWindow.eventText)
 
    local storageValue = player:getStorageValue(config.statStorageKey)
    local modalWindow = ModalWindow(config.modalWindow.id, config.modalWindow.title, "You have " .. (storageValue > 0 and storageValue or 0) .. " stat points to spend.")
 
    for id, button in ipairs(config.modalWindow.buttons) do
        modalWindow:addButton(id, button.text)
        if button.defaultEscapeButton then
            modalWindow:setDefaultEscapeButton(id)
        elseif button.defaultEnterButton then
            modalWindow:setDefaultEnterButton(id)
        end
    end
 
    for id, stat in ipairs(choiceDictionary) do
        local storageValue = player:getStorageValue(stat.storageKey)
        storageValue = storageValue > 0 and storageValue or 0
        modalWindow:addChoice(id, "[" .. storageValue .. "] " .. stat.statType)
    end
 
    modalWindow:hasPriority()
    modalWindow:sendToPlayer(player)
end
mm that's dangerous.

I forgot to tell about the libs.

data/lib/core/core.lua -- add
Lua:
dofile('data/lib/core/xikiniCustomFunctions.lua')
data/lib/core/xikiniCustomFunctions.lua -- add
Lua:
--[[ quick reference of events

    CREATURE_EVENT_NONE
    CREATURE_EVENT_LOGIN
    CREATURE_EVENT_LOGOUT
    CREATURE_EVENT_THINK
    CREATURE_EVENT_PREPAREDEATH
    CREATURE_EVENT_DEATH
    CREATURE_EVENT_KILL
    CREATURE_EVENT_ADVANCE
    CREATURE_EVENT_MODALWINDOW
    CREATURE_EVENT_TEXTEDIT
    CREATURE_EVENT_HEALTHCHANGE
    CREATURE_EVENT_MANACHANGE
    CREATURE_EVENT_EXTENDED_OPCODE
]]--

function Player:hasEvent(type, name)
    for k, v in pairs(self:getEvents(type)) do
        if v == name then
            return true
        end
    end
    return false
end
 
Hey man! here goes 2 request. Feel free to ask if you feel there's more info needed.

1. Chain Quest system.
- 1 or more NPCs that give you different quest, each quests chains with another quests. Quests should be from turning in items, killing X monter(s), using X item (storage or similar in the world), visit a place (onStep get storage, etc etc). Once finished each part of the chain you get the choice in modals to get 1 item from X offered. (This could be even more advanced if added some kind of protection or scort quest function)

2. Go further on the stats system to introduce 2 functionalities.
  • Add the option to use storages (or similar) to add different kind of stats like more damage, or fire damage, etc.
  • Add the option of multiple layers of stats with restrictions. (For example, if you put 1 points in Life, you cannot put points in Mana. Or To put points in Fire Damage, you need 5 points in "Magic Damage") Basically, turn the stat system into a talent tree system.

Keep it up! Great work as always! (Feel free to decline if they are not worth the work)
 
mm that's dangerous.

I forgot to tell about the libs.

data/lib/core/core.lua -- add
Lua:
dofile('data/lib/core/xikiniCustomFunctions.lua')
data/lib/core/xikiniCustomFunctions.lua -- add
Lua:
--[[ quick reference of events

    CREATURE_EVENT_NONE
    CREATURE_EVENT_LOGIN
    CREATURE_EVENT_LOGOUT
    CREATURE_EVENT_THINK
    CREATURE_EVENT_PREPAREDEATH
    CREATURE_EVENT_DEATH
    CREATURE_EVENT_KILL
    CREATURE_EVENT_ADVANCE
    CREATURE_EVENT_MODALWINDOW
    CREATURE_EVENT_TEXTEDIT
    CREATURE_EVENT_HEALTHCHANGE
    CREATURE_EVENT_MANACHANGE
    CREATURE_EVENT_EXTENDED_OPCODE
]]--

function Player:hasEvent(type, name)
    for k, v in pairs(self:getEvents(type)) do
        if v == name then
            return true
        end
    end
    return false
end
I have modified this script for some weird reason I was not able to modify stats to vocations but no worries I only added stats that all vocations can use. I mean sorcerer will not add melee XD anyway I have added requirements to reset function and removed remove button. But except that everything works perfectly fine, until somebody finds some issue XD. Anyhow I also added scrolls and now all seems to be working fine THANKS AGAIN!
 
Is it possible to create a script for a spell? For example, called 'Stop Time,' where basically when a player uses it, the opposing player cannot use anything for a certain period of time; they are 'silenced.'

It works perfectly if the player doesn't die while under the effect of this spell, if they don't die 'silenced.' However, if the player still dies under the effect, they respawn at the temple indefinitely silenced; time passes, and they still can't use magic, potions, etc. please 🥺
 
i will try but i think i will make mistakes in movement tp check and globalevent tp appear on winner rewards or storages to check joined players
@Xikini, i have tried with ai and it shows many bugs
Post automatically merged:

.

Use some AI and get it done.
if it's easy with ai do it and paste here?
 
@Xikini, i have tried with ai and it shows many bugs
Post automatically merged:


if it's easy with ai do it and paste here?
I'll try to help with this (always liked bomberman from 0.4). Considering that:
Can you make bomberman event? it's a known event tell me if i need to explain it
Here's some params from the game.

Controls:
1. Use bomberman in any of the four cardinal directions (this mean you can walk).
2. Press a button to drop a bomb on tile that the bomberman is currently standing on (spell, talkaction).
3. Be able to detonate the oldest bomb you placed if you get a power-up called "detonator power-up" (with this is assumed that player can get power-ups steping on a random spawning item -during the event-).

Character:
You must kill every enemy to reveal the exit of the event. Every match contains at least 1 power up during the event (would be nice to have a variable to set how many power-ups will spawn per match). Players begins the event with ability to produce one bomb with a range of one square (like an exori).

Enemies:
The game has enemies with the following variables: name, points, speed, smart, wallpass and appearance. The link has more information about it if you wish to try but I think this will be really complicated to achieve.

Powerups
Can be collected to increase number of bombs that can be dropped, and to increase the range of the explosions. An enemy touched by an explosion is out of the game event. Bombs detonate on their own after a couple of second of being dropped (except by usage of detonator power-up). Player's bombs can detonate other bombs if the explosion touch them.

1708064409775.png

Ranking system:
I mentioned on enemies that they have points, if you wish to include this feature, there should be a storage key or something that holds player's points per killing, winning event, getting power-ups, idk. This is better explain in the bonus items sections of the link.

I think that everything that should be mentioned for bomberman, hope this helps!
------------------------------------------------------------------
Also #inanothertopic

I had this error with raid event @Xikini this happened when the second (or third? )wave tried to spawn:
1708064728559.png

Wondering if there's no space to spawn the monsters due the first waves?. Then it sent an infinite loop of:
1708064756210.png

Here's the code of THAT SPECIFIC raid:
Lua:
    {    raid = {
            name = "Minotauros", -- must be unique to this raid, or it'll show error in console
            specificTimes = {
                -- "hh:mm:ss", -- start raid at specified times, based on local computer clock (ignores startDelay/interval/chance et cetera.)
                -- "07:00:00", -- 7am
                -- "19:00:00", -- 7pm
                -- "20:30:24" -- 8h 30m 24s pm
            }, 
            startDelay = 1, -- minutes -- how long after starting server before the raid can execute
            interval = 1, -- minutes -- how long inbetween attempts at spawning the raid.
            chance = 10000, -- chance / 10000 -- so 100 chance = 1% | 1 chance = 0.01%
            forceAfterAttempts = 20, -- if raid is unlucky, force the raid to start after x attempts.
            --> (5 minutes * 20 attempts -> 100 minutes of attempts. force on attempt 21)
            --> -1 = never force -- so it is completely random chance
            --> 0 = force on first attempt (aka: every x minutes)
            cooldown = 120, -- minutes -- how long before this raid can be triggered again
            forceNewRaidInstance = 1 -- -1 = ignore 0 = false, 1 = true
            --> if true, and raid attempts to execute again, will remove all previous raid monsters.
            --> if false, will not attempt to execute until all previous raid monsters have been eliminated
            --> if ignore, will not remove previous raid monsters, and will just proceed as if raid was occurring for the first time.
        },        
        nonSpawnableAreas = { -- for any areas you don't want raid monsters to spawn
            {from = Position(1118, 981, 7), to = Position(1120, 983, 7)}, -- from = top left corner | to = bottom right corner
            --{from = Position(966, 986, 7), to = Position(978, 996, 7)}
        },
        waves = {
            {
                broadcast = {messageType = MESSAGE_STATUS_WARNING, text = "Raid is starting soon in some place"},
                nextWaveTimer = 10 -- seconds (if not included, defaults to 60 seconds)
            },
            { -- wave 1 (example with RANDOM monsters only)
                randomMonsters = {
                    {
                        amount = {min = 5, max = 20},
                        monsterList = {"minotauro", "lobo", "trasgo"},
                        spawnAreas = {
                            {from = Position(1107, 979, 7), to = Position(1121, 992, 7)}
                        }
                    },
                    {
                        amount = {min = 20, max = 20},
                        monsterList = {"gusano"},
                        spawnAreas = {
                            {from = Position(1107, 979, 7), to = Position(1121, 992, 7)}, -- from = top left corner | to = bottom right corner
                            {from = Position(1107, 979, 6), to = Position(1121, 992, 6)}  -- having 2 different z positions, allows for multiple floor spawning
                        }
                    },
                },
                nextWaveTimer = 10 -- seconds
            },
            { -- wave 2 (example with STATIC monsters only)
                staticMonsters = {
                    {position = Position(1111, 986, 7), name = "ciclope"}, -- since these are setup manually, we don't do additional checks. We assume it's a good spawn location and force it
                    {position = Position(1119, 986, 7), name = "dragon"}
                },
                nextWaveTimer = 10 -- seconds
            },
            { -- wave 3 (example with both STATIC & RANDOM monsters)
                staticMonsters = {
                    {position = Position(1115, 991, 7), name = "dragon lord"}
                },
                randomMonsters = {
                    {
                        amount = {min = 20, max = 20},
                        monsterList = {"avispa", "lobo", "oso"},
                        spawnAreas = {
                            {from = Position(1107, 979, 7), to = Position(1121, 992, 7)},
                            {from = Position(1107, 979, 6), to = Position(1121, 992, 6)}
                        }
                    }
                },
                nextWaveTimer = 10 -- seconds
            },
            { -- wave 4 (example Boss?)
                staticMonsters = {
                    {position = Position(1107, 986, 7), name = "demon"}
                }
            }
        }
    },
Thanks in advance!
 
Last edited:
Found and fixed a few more bugs in the Lua raid system

Added a !executeRaid raidName, check command to check the status of raids. (gm only)
Added consumable items, that allow players to force specific raids to spawn.
 
Is it possible to create script for items that, if they are used with mage type, the magic level increases, if they are used with paladin type, distacne increases, and if they are used with knight type, sword/clup/axe increases?
It's just an idea that came to my mind I don't know if that is possible or not
 
Is it possible to create script for items that, if they are used with mage type, the magic level increases, if they are used with paladin type, distacne increases, and if they are used with knight type, sword/clup/axe increases?
It's just an idea that came to my mind I don't know if that is possible or not
Made long ago by me already. lol


example
Lua:
    [2222] = {
        slot = "armor",
        {
            [{1, 5}] = {
                ["statMain"] = {{"magic", 5}}
            },
            [{2, 6}] = {
                ["statMain"] = {{"magic", 5}}
            },
            [{3, 7}] = {
                ["statMain"] = {{"distance", 5}}
            },
            [{4, 8}] = {
                ["statMain"] = {{"melee", 5}}
            }
        }
    },
 
can you make
player kills npc task with money and exp and item rewards. can only start 1 player kill task at time.
like this
task to kill 400 players with money and exp and item rewards
when finished choose next task with 600 to kill 600 players with money and exp and item rewards
task kills are counted in channel with orange msg so player can know how many left and when finished
thank you
 
Is it possible to create a script for a spell? For example, called 'Stop Time,' where basically when a player uses it, the opposing player cannot use anything for a certain period of time; they are 'silenced.'

It works perfectly if the player doesn't die while under the effect of this spell, if they don't die 'silenced.' However, if the player still dies under the effect, they respawn at the temple indefinitely silenced; time passes, and they still can't use magic, potions, etc. please 🥺
Post automatically merged:

https://private-user-images.githubusercontent.com/41605307/283493591-2e4d6796-0286-47da-8058-55e3fe49bbf4.mp4?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDgxMDk3NjMsIm5iZiI6MTcwODEwOTQ2MywicGF0aCI6Ii80MTYwNTMwNy8yODM0OTM1OTEtMmU0ZDY3OTYtMDI4Ni00N2RhLTgwNTgtNTVlM2ZlNDliYmY0Lm1wND9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjE2VDE4NTEwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ3YTgzYjI0OGYzMjQyYjBlMGQ2YWFjZGZiNWJhY2JkZDZmYTJlY2U3NzNiNmU3MDNmYTEyOGU4YmI3ZGVkNDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.QxvqPbqA2fmB9-1uEvteLzF7VoBwqV_5v1SncBD6Lkk
 
Last edited:
I've edited quite a few things to get it to work. xD

Copy everything again.

View attachment 82072
Post automatically merged:


Soo here's the thing..

monster that looks east/west/south/north
monster that looks south always and never changes direction

In both these scenario's, the monster auto-looking in a player direction and while walking, would have the animation of looking in a different direction.

If the monsters cannot be moved, and non-hostile.. it might work?
I'll give it a try, but no promises. lol
Post automatically merged:


support board.
Found out a new bug, doesnt do anything for no vocations :>
 
Found out a new bug, doesnt do anything for no vocations :>
change lib xikini custom functions.

from
Lua:
function parseFormulaAttributes(xmlContent)
    local formulas = {}

    local pattern = "<formula%s+meleeDamage=\"(.-)\"%s+distDamage=\"(.-)\"%s+defense=\"(.-)\"%s+armor=\"(.-)\"%s*/>"
  
    for meleeDamage, distDamage, defense, armor in xmlContent:gmatch(pattern) do
        table.insert(formulas, {
            meleeDamage = meleeDamage,
            distDamage = distDamage,
            defense = defense,
            armor = armor
        })
    end

    return formulas
end


local filePath = "data/XML/vocations.xml"
local xmlContent = readXmlFile(filePath)
GLOBAL_vocationMultipliers = parseFormulaAttributes(xmlContent)
to
Lua:
function parseVocationFormulas(xmlContent)
    local vocations = {}

    local pattern = "<vocation%s+id=\"(.-)\".-<formula%s+meleeDamage=\"(.-)\"%s+distDamage=\"(.-)\"%s+defense=\"(.-)\"%s+armor=\"(.-)\"%s*/>"
  
    for id, meleeDamage, distDamage, defense, armor in xmlContent:gmatch(pattern) do
        vocations[tonumber(id)] = {
            meleeDamage = meleeDamage,
            distDamage = distDamage,
            defense = defense,
            armor = armor
        }
    end

    return vocations
end


local filePath = "data/XML/vocations.xml"
local xmlContent = readXmlFile(filePath)
GLOBAL_vocationMultipliers = parseVocationFormulas(xmlContent)
 
@Xikini, what you do is insane, hope that you don't get any threats from scripters that get paid for such job :p

Yes Xikini does a great codes! You know if @Xikini needs some help just let us know.

With the progress of AI in a year or two you won't have to teach AI anymore. I tell you something without AI what I have done with my server would be imposible without it. I am no codder but have better understanding of lua now. Always wanted to have server but only managed to have one 10 years back tib 7.6 lol.
 
Status
Not open for further replies.
Back
Top