• 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:
Why you even waste this mans time with shit systems like this. FFS -.-
Post automatically merged:

[/URL]

I will quote tibiawiki:

Then


In order to start the ceremony, both players must give their marriage items to the NPC:


After both players give their items, now the ceremony can start:


Now have your fiancee speak to her, saying the following:


There's also a second NPC, a drunken priest that let you divorce.


He will only grant you a divorce if you have 5,000 gold.
If you do not have 5,000 gold pieces Brewster will say:


More information about the system based on the otland post I attached before:
Items: Players who get married receive a Wedding ring with your names and wedding date.

ID of rings:
  1. 10510 for broken weeding ring (i think this one will be challenging because you need to check if player is married so the ring can stay as engraved weeding ring, or something like that)
  2. 10502 for engraved weeding ring (you can see on description who is married to who)
  3. 2121 weeding ring (the 2 ones that are needed to start all this)
  4. 10503 weeding outfit box
View attachment 82451

While the couple is married, they are allowed to use "Newly Wed Outfits". If they divorse, they loose the outfits. No gender is needed for marriage, just two players. Maybe just to add more stuff into it, don't allow players to marry again if they divorce 3 times.

Look: the look shows who is married
w9R0p.png


Combat: The player can not attack your patner
commands:


It's a really big system. I hope you like the idea, regards! :)
 
hey @Xikini how about remaking marriage system in .lua? It used to have mysql insertions, but I think this can be done in .lua nowdays.

I will quote tibiawiki:

Then


In order to start the ceremony, both players must give their marriage items to the NPC:


After both players give their items, now the ceremony can start:


Now have your fiancee speak to her, saying the following:


There's also a second NPC, a drunken priest that let you divorce.


He will only grant you a divorce if you have 5,000 gold.
If you do not have 5,000 gold pieces Brewster will say:


More information about the system based on the otland post I attached before:
Items: Players who get married receive a Wedding ring with your names and wedding date.

ID of rings:
  1. 10510 for broken weeding ring (i think this one will be challenging because you need to check if player is married so the ring can stay as engraved weeding ring, or something like that)
  2. 10502 for engraved weeding ring (you can see on description who is married to who)
  3. 2121 weeding ring (the 2 ones that are needed to start all this)
  4. 10503 weeding outfit box
View attachment 82451

While the couple is married, they are allowed to use "Newly Wed Outfits". If they divorse, they loose the outfits. No gender is needed for marriage, just two players. Maybe just to add more stuff into it, don't allow players to marry again if they divorce 3 times.

Look: the look shows who is married
w9R0p.png


Combat: The player can not attack your patner
commands:


It's a really big system. I hope you like the idea, regards! :)

The SQL part is nessesary to be able to check who is married to who even when players are offline. Storage value only works to check if you are online, hense the marriage status in the DB.
 
hey @Xikini how about remaking marriage system in .lua? It used to have mysql insertions, but I think this can be done in .lua nowdays.

I will quote tibiawiki:

Then


In order to start the ceremony, both players must give their marriage items to the NPC:


After both players give their items, now the ceremony can start:


Now have your fiancee speak to her, saying the following:


There's also a second NPC, a drunken priest that let you divorce.


He will only grant you a divorce if you have 5,000 gold.
If you do not have 5,000 gold pieces Brewster will say:


More information about the system based on the otland post I attached before:
Items: Players who get married receive a Wedding ring with your names and wedding date.

ID of rings:
  1. 10510 for broken weeding ring (i think this one will be challenging because you need to check if player is married so the ring can stay as engraved weeding ring, or something like that)
  2. 10502 for engraved weeding ring (you can see on description who is married to who)
  3. 2121 weeding ring (the 2 ones that are needed to start all this)
  4. 10503 weeding outfit box
View attachment 82451

While the couple is married, they are allowed to use "Newly Wed Outfits". If they divorse, they loose the outfits. No gender is needed for marriage, just two players. Maybe just to add more stuff into it, don't allow players to marry again if they divorce 3 times.

Look: the look shows who is married
w9R0p.png


Combat: The player can not attack your patner
commands:


It's a really big system. I hope you like the idea, regards! :)

Whyy, you can just add them to the existing script, shouldn't be that hard, the script you linked I use aswell and works perfectly 🤔

I think adjusting this script with the things you want would be a good lesson!
 
The SQL part is nessesary to be able to check who is married to who even when players are offline. Storage value only works to check if you are online, hense the marriage status in the DB.
Yeah, pheraps. But it's 2024 and i'm quite sure the could be other solutions. Xikini is smart af and i'm sure he will find a way.

Here's some Nimbus ideas: To store player status where a player is married to another player in Lua without using SQL queries, you can utilize the player's storage system. Here's an example of how you can achieve this:

Lua:
-- Function to set player's marital status in storage
function setMarriedStatus(player, partnerName)
player:setStorageValue("marriedTo", partnerName)
end

Lua:
-- Function to get player's marital status from storage
function getMarriedStatus(player)
return player:getStorageValue("marriedTo")
end

In this example, the setMarriedStatus function sets the player's marital status by storing their partner's name in the player's storage under the key "marriedTo". The getMarriedStatus function retrieves the player's marital status from the storage. As for creating a function that adds a player description on Look if they have a specific storage, you can do something like this:

Lua:
-- Function to add player description on Look if they have specific storage
function addDescriptionOnLook(player)
    if player:getStorageValue("hasDescription") == 1 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "This player has a special description.")
    end
end

Then asked 'can I check on login if the players are still married, and if they're not delete the description'
Lua:
-- Function to check and update player's description on login
function checkMaritalStatusOnLogin(player)
    local partnerName = getMarriedStatus(player) -- Get the player's partner name from storage
    if partnerName then
        local partner = Player(partnerName) -- Get the partner player object
        if not partner or partner:getStorageValue("marriedTo") ~= player:getName() then
            -- If the partner player doesn't exist or is not married to the player anymore
            player:setStorageValue("marriedTo", nil) -- Clear the player's marital status
            player:setStorageValue("hasDescription", nil) -- Clear the player's description
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Your marital status has been updated.")
        end
    else
        player:setStorageValue("hasDescription", nil) -- Clear the player's description if they are not married
    end
end

This marriage system is a pretty good script to excercise with descriptions and multiple player checks, could also work for other enviroments (quests, systems, etc) that requieres a duo.

Whyy, you can just add them to the existing script, shouldn't be that hard, the script you linked I use aswell and works perfectly 🤔

I think adjusting this script with the things you want would be a good lesson!
There's multiple ways of scripting this. Xikini has the cleanest syntax on lua, why not asking him this? as long as he is willing to make it
 
The SQL part is nessesary to be able to check who is married to who even when players are offline. Storage value only works to check if you are online, hense the marriage status in the DB.
Yeah, pheraps. But it's 2024 and i'm quite sure the could be other solutions. Xikini is smart af and i'm sure he will find a way.
Had a debate with your nimbus bot.

Nimbus
45884f223879616daa675e884fb697aa.webp
BOTToday at 9:01 AM​

Yes, you are correct. In a scenario where direct database queries are not allowed, and the system must rely solely on in-game storage and mechanisms, handling complex player relationships and status changes, such as divorces without both players being online simultaneously, can indeed present significant challenges that may not have a feasible solution within those constraints. Thank you for pointing that out.
 
Had a debate with your nimbus bot.

Nimbus
45884f223879616daa675e884fb697aa.webp
BOTToday at 9:01 AM​

Yes, you are correct. In a scenario where direct database queries are not allowed, and the system must rely solely on in-game storage and mechanisms, handling complex player relationships and status changes, such as divorces without both players being online simultaneously, can indeed present significant challenges that may not have a feasible solution within those constraints. Thank you for pointing that out.
Saw the message just before seeing the post on otland. Guess this is a GG. Jajajaja. Thanks for trying!
 
Another idea ^^ @Xikini

How about auto-casting spells if you have an item on your ammo slot? There's a lot of golden rune emblem, and silver rune emblem that has no use on Tibia (from id 12559 to id 12606). Would be nice if for example, I equip ID 12559 silver rune emblem (with description of ultimate healing rune) on my ammo slot. and then, my character will start casting 'adura vita' to automatically create ultimate healing runes.

Also only allow to equip this silver rune emblems while you stand on tile with AID or UID 10000 (this to only accept this automatic runemaking on training zones).

Thanks in advance!
 
Another idea ^^ @Xikini

How about auto-casting spells if you have an item on your ammo slot? There's a lot of golden rune emblem, and silver rune emblem that has no use on Tibia (from id 12559 to id 12606). Would be nice if for example, I equip ID 12559 silver rune emblem (with description of ultimate healing rune) on my ammo slot. and then, my character will start casting 'adura vita' to automatically create ultimate healing runes.

Also only allow to equip this silver rune emblems while you stand on tile with AID or UID 10000 (this to only accept this automatic runemaking on training zones).

Thanks in advance!
No way to do this without source edits, ironically.
 
No way to do this without source edits, ironically.
I just wanted to try but for some reason I am not able to XD anyhow this is what I end up with. The problem is how can I get this working

Lua:
    if creature:isPlayer() and type == TALKTYPE_SAY and message:lower() == "adura vita" then

Code:
local AUTO_CAST_SPELL_ITEM_ID = 23541
local AUTO_CAST_SPELL_WORDS = "adura vita"
local CHECK_INTERVAL = 5 * 1000

local autoCastSpellArea = {
    fromPos = Position(2498, 2499, 7),
    toPos = Position(2502, 2502, 7)
}

local function hasAutoCastSpellItem(player)
    local ammoSlotItem = player:getSlotItem(CONST_SLOT_AMMO)
    return ammoSlotItem and ammoSlotItem:getId() == AUTO_CAST_SPELL_ITEM_ID
end

local autoCastSpellEvent = GlobalEvent("AutoCastSpellEvent")
function autoCastSpellEvent.onThink()
    local playersInArea = Game.getSpectators(autoCastSpellArea.fromPos, false, true, autoCastSpellArea.toPos.x - autoCastSpellArea.fromPos.x, autoCastSpellArea.toPos.x - autoCastSpellArea.fromPos.x, autoCastSpellArea.toPos.y - autoCastSpellArea.fromPos.y, autoCastSpellArea.toPos.y - autoCastSpellArea.fromPos.y)

    for i = 1, #playersInArea do
        local player = playersInArea[i]
        if hasAutoCastSpellItem(player) then
            player:say(AUTO_CAST_SPELL_WORDS, TALKTYPE_SAY, false, player, player:getPosition())
        end
    end
    return true
end

autoCastSpellEvent:interval(CHECK_INTERVAL)
autoCastSpellEvent:register()

Well I tried XD
 
Well I tried XD
Everyone's initial reaction. xD

What!? How is this not possible?
Just make the players say the words. Easy. Why the fuck would this need a source edit?
This guy's an idiot!

Okay. Okay. okay. Let's prove this motherfucker wrong.
This is so fucking easy.

5 hours later
Well.. fuck.

---
My actual thought process when I first tried this like 2-3 years ago. xD
 
Everyone's initial reaction. xD

What!? How is this not possible?
Just make the players say the words. Easy. Why the fuck would this need a source edit?
This guy's an idiot!

Okay. Okay. okay. Let's prove this motherfucker wrong.
This is so fucking easy.

5 hours later
Well.. fuck.

---
My actual thought process when I first tried this like 2-3 years ago. xD

It was not like that I mean to some extend but I was not calling you an idiot XD
 
Hi @Xikini

Can you do a boost exp revscript?

I need an action revscript, where it will have 3 items, itemID 1500, 15001, 15002;

ItemID 1500 Will add 10% more experience for X amount of time
ItemID 1502 Will add 20% more experience for X amount of time
ItemID 1503 Will add 30% more experience for X amount of time

If one of the items is being used, you will not be able to use another item until X time has elapsed.
 
Hi @Xikini

Can you do a boost exp revscript?

I need an action revscript, where it will have 3 items, itemID 1500, 15001, 15002;

ItemID 1500 Will add 10% more experience for X amount of time
ItemID 1502 Will add 20% more experience for X amount of time
ItemID 1503 Will add 30% more experience for X amount of time

If one of the items is being used, you will not be able to use another item until X time has elapsed.
I'm just learning about TFS 1.x and hope to one day be as talented as THE SUPER GENIUS Xikini, xD... So since there's nothing to do at work, I decided to make a basic script... Or wait for Xikkini to make a better script, lol.

Lua:
-- Configuration table
local config = {
    boostItems = {
        { itemId = 1500, percentage = 10 }, --10% more experience
        { itemId = 1501, percentage = 20 }, --20% more experience
        { itemId = 1502, percentage = 30 } --30% more experience
    },
    duration = 3600 -- in seconds (1 hour)
}

local playerCooldowns = {}
local playerBoostPercentages = {}

function boostExp(player, boostPercentage)
    if playerCooldowns[player] and playerCooldowns[player] > os.time() then
        player:sendCancelMessage("You are still under the effect of a boost item.")
        return
    end

    local currentExp = player:getExperience()
    local newExp = currentExp * (1 + boostPercentage / 100)
    player:setExperience(newExp)

    playerCooldowns[player] = os.time() + config.duration
    playerBoostPercentages[player] = boostPercentage

    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have activated a " .. boostPercentage .. "% experience boost for " .. config.duration/60 .. " minutes.")
end

local boostExpAction = Action()

function boostExpAction.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local itemId = item:getId()
    for _, boostItem in ipairs(config.boostItems) do
        if itemId == boostItem.itemId then
            boostExp(player, boostItem.percentage)
            return true
        end
    end
    return false
end

for _, boostItem in ipairs(config.boostItems) do
boostExpAction:id(boostItem.itemId)
end

boostExpAction:register()

local ec = EventCallback

ec.onGainExperience = function(self, source, exp, rawExp)
    if not source:isMonster() then
        local player = Player(source)
        local boostPercentage = playerBoostPercentages[player]
        if boostPercentage then
            return exp * (1 + boostPercentage / 100)
        end
    end
    return exp
end

ec:register()
 
Last edited:
I've decided to improve item descriptions in Xikini's protection upgrade script, because it was removing all the existing additional descriptions that upgradable item previously had, like those from XML file or custom descriptions from another scripts/systems as well.

View attachment 82363

In Xikini's script do the following changes:
in line 2
Lua:
local maximumUpgradePercent
change to:
Code:
maximumUpgradePercent

remove
setProtectionDescription(target)

and remove whole setProtectionDescription function.

open data/scripts/eventcallbacks/player/default_onLook.lua and before return description paste:
Lua:
if thing:isItem() then
    local text = ""
    local isMaxUpgraded = true
    local upgrades = false
    local order = {"physical", "energy", "earth", "fire", "ice", "holy", "death"}
    for _, element in ipairs(order) do
        local attributeValue = thing:getCustomAttribute(element) or 0
        if attributeValue > 0 then
            if text ~= "" then
                text = text .. ", "
            end
            text = text .. element .. " +" .. attributeValue .. "%"
        end
        if attributeValue ~= maximumUpgradePercent then
            isMaxUpgraded = false
        end

        if attributeValue > 0 then
            upgrades = true
        end
     
    end

    if isMaxUpgraded then
        text = "[Additional Protections: All Damage Types +" .. maximumUpgradePercent .. "%]"
    else
        text = "[Additional Protections: " .. text .. "]"
    end
 
    if upgrades then
    description = description ..  "\n\n" .. text
    else
    description = description
    end

end

Big <3 Xikini!

It is possible to change this system to use a special blacksmith's hammer if you have the necessary amount of the item?

You put the item on the anvil, use the item - if you have the right items in the BP for the upgrade, then the weapon is upgraded?
Possibly still a restriction that the mana leech can receive, for example, only knight or paladin?
 
Hi @Xikini

I wanted to make this script for a long time:

It is when the player kills any monster he has the possibility of leaving an effect (CONST_ME_TUTORIALARROW and CONST_ME_TUTORIALSQUARE) on the body and passing over it will give him a random attribute, it can be speed, more life, more mana, experience bonus, loot bonus, etc. The effect will only last a few seconds (10 seconds). It can also grant defense, physics, fire, death, ice, etc. Also an attribute that you do more damage with the weapon you carry for a few seconds, etc.

The effect can be stored, that is, if you get a 12% exp bonus and when you kill another monster you get a 24% exp bonus.

The effect on the monster's body can last for 5 seconds.

Something crazy about the defenses would be that if I'm in a zone so to speak killing Frost Dragon, I have a chance of it being protection ice, if I'm on demon then it's protection fire and so on.

Luck!
 
Last edited:
Hello, I would like an script that when u step in a sqm or talk with an Npc, you reset all your chest rewards or quests (storages) opened.
 
Hi @Xikini

Can you do a boost exp revscript?

I need an action revscript, where it will have 3 items, itemID 1500, 15001, 15002;

ItemID 1500 Will add 10% more experience for X amount of time
ItemID 1502 Will add 20% more experience for X amount of time
ItemID 1503 Will add 30% more experience for X amount of time

If one of the items is being used, you will not be able to use another item until X time has elapsed.
this sounds like a good idea, could you also add faster resp, skills to it but i want with a command only for gms?

ex /addbonus resp,2,24. resp means respawn xd 2 means double resp and 24 means hrs
 
Alright well, I spent a good chunk of time on this thread, so will be stopping to work on my game again.

I got to do the couple of things I wanted to do (learn modal windows, npc path finding).

It's been fun.

Sorry to the rest of the requests, but I don't have the interest to keep going.

Thread closed!
Good luck out there.
 
Status
Not open for further replies.
Back
Top