• 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.3

Status
Not open for further replies.

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,809
Solutions
432
Reaction score
3,946
Please request
actions / creatureevents / globalevents / npcs / movements / talkactions

Do not request
spells / weapons / monsters / source editing / database queries

My goal of this thread is to learn TFS 1.3 scripting.

------------------------------------
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 neccesary information it's impossible to help you.

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

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.

I'm here to learn how to script better.
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 publically, 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

----

Completed Scripts

DPS Dummy -> using RevScripts
!playerinfo character name -> using RevScripts
Positional Text talkaction -> using RevScripts
||--> Updated version that can use text & effects
Vocational Item Bonus's -> using RevScripts
||--> Updated version with easier config.
Simple damge buff potion -> using Revscripts
Kill monster in specific area, remove stone for x seconds -> using RevScripts
Training Room Teleporter -> using RevScripts
Lever that removes/adds/transforms objects or ground tiles -> using RevScripts
Loot from monster goes into single backpack, no matter how much loot there is.
Extra loot in monsters, based on chance and tier list -> using RevScripts
||--> Updated version that allows specific monsters to have their own loot table
Random Item chest that disappears after use, and respawns after x time -> using RevScripts
Multiple players required to open passageway.
Monster Arena Lever (x amount of waves, complete all waves, teleport appears) -> using RevScripts
Daily Boosted Creatures (experience & loot chance of items)
||--> Updated main file of boosted creatures, so that it triggers at midnight, instead of when the server starts up.
Reward Chest - Extremely simple. -> using Revscripts
Simple Npc that can sell an item, via text.

----

Extremely useful libs that I use quite often.

data/lib/core/player.lua
Give player items by table

data/lib/core/container.lua
getContainerFreeSlots

----

To-Do List

Shalaby - Player death counter. (Movement and talkaction)
Shalaby - Npc kill monster task, with item reward.
Shalaby - Boss respawn after x time.

-------

Last spot I've read messages
 
Last edited:
OP
OP
Xikini

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,809
Solutions
432
Reaction score
3,946
to your answer if an actionid that gives you a pokemon I mean that it gives you an item
I think he means that I have no idea what a 'pokemon' is or entails.

If it's just a simple item.. then use this.
 

Kabo Flow

New Member
Joined
May 17, 2020
Messages
50
Reaction score
4
Location
Mexico
Twitch
KaboFlow18
I think he means that I have no idea what a 'pokemon' is or entails.

If it's just a simple item.. then use this.

local reward1 = {2160, 1} -- {itemid, amount}
local reward2 = {2160, 1} -- {itemid, amount}
local reward3 = {2160, 1} -- {itemid, amount}

It works for me, but even though I'm looking for a pokemon, but that helps me to implement a quest to the server, even though it could be more than 1 item?
that you also have experience
and I teleport you
Post automatically merged:

and Done. :)
Note: don't trap your players. 😋

View attachment 49241


Put this into any monster you want the script to activate for.
XML:
<script>
    <event name="onDeath_open_passageway" />
</script>

data\scripts\ onDeath_open_passageway.lua
Lua:
local config = {
    positionCheck = {north_west = Position(99, 99, 7), south_east = Position(101, 101, 7)},
    item = {Position(103, 100, 7), 1285}, -- {item_position, itemid}
    timer = 20, -- timer is how long until the 'stone' aka: item, is replaced.
    discoveryText = "A passageway has opened nearby!\nQuickly, get inside!"
}

local toggle = 0
local function changePassageway()
    local item = Tile(config.item[1]):getItemById(config.item[2])
    if item then
        item:remove()
        return true
    end
    config.item[1]:sendMagicEffect(CONST_ME_BIGPLANTS)
    Game.createItem(config.item[2], 1, config.item[1])
    toggle = 0
end

local creatureevent = CreatureEvent("onDeath_open_passageway")

function creatureevent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    if toggle == 1 then
        return true
    end
    local deathPosition = creature:getPosition()
    if not deathPosition:isInRange(config.positionCheck.north_west, config.positionCheck.south_east) then
        return true
    end
    toggle = 1
    config.item[1]:sendMagicEffect(CONST_ME_POFF)
    changePassageway()
    addEvent(changePassageway, config.timer * 1000)
    creature:say(config.discoveryText, TALKTYPE_MONSTER_SAY, false, nil, deathPosition)   
    return true
end

creatureevent:register()

sorry for my ignorance but where do I add it to make the system work
 
Last edited:

Kabo Flow

New Member
Joined
May 17, 2020
Messages
50
Reaction score
4
Location
Mexico
Twitch
KaboFlow18
@Nokturno Your "Random Item chest that disappears after use, and respawns after x time" script is finished.

I was semi-absent for awhile soo... sorry if you no longer need this.

View attachment 54293

data\scripts\ disappearingLootChest.lua
Lua:
--[[

Install this
https://otland.net/threads/tfs-1-x-give-player-items-by-table.260702/#post-2643954

]]--

--[[
__  __     _      _        _               _   
\ \/ /    (_)    | |__    (_)    _ _      (_)  
  >  <     | |    | / /    | |   | ' \     | |  
/_/\_\   _|_|_   |_\_\   _|_|_  |_||_|   _|_|_ 
_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'

]]--

local rewardsTable = {
    [45000] = {
        containerId = 10522, -- itemid of bag/backpack that holds items
        chestReturnTime = 10, -- in seconds.
        magicEffect = CONST_ME_TELEPORT,
        {2173, 5, 5, 2500},
        {2160, 1, 5, 10000}  --{itemid, amount_min, amount_max, chance/10000}
    },
    [45001] = {
        containerId = 1988,
        chestReturnTime = 5, -- 5 * 60 would be 5 minutes
        magicEffect = CONST_ME_TELEPORT,
        {2173, 5, 5, 2500},
        {2152, 1, 5, 10000}
    },
    [45002] = {
        containerId = 1987,
        chestReturnTime = 2,
        magicEffect = CONST_ME_TELEPORT,
        {2148, 1, 5, 10000},
        {2148, 1, 5, 10000},
        {2173, 5, 5, 2500},  -- 25% chance
        {2148, 1, 5, 10000}, -- 100% chance
        {2148, 1, 5, 10000}
    },
}

local function lootChestDeAndReappear(position, chestId, actionId, effect, timer)
    position:sendMagicEffect(effect)
    if timer > 0 then
        -- remove chest
        Tile(position):getItemById(chestId):remove()
        addEvent(lootChestDeAndReappear, timer, position, chestId, actionId, effect, 0)
    else
        -- reAdd chest with actionid
        local chest = Game.createItem(chestId, 1, position)
        chest:setActionId(actionId)
    end
end

local disappearingLootChest = Action()

function disappearingLootChest.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    -- confirm index exists
    local actionId = item:getActionId()
    local index = rewardsTable[actionId]
    if not index then
        print("LUA error: ActionId not in table." .. item:getActionId())
        return true
    end
   
    -- check chances and create rewardItems table
    local rewardItems = {}
    local amount = 0
    for i = 1, #index do
        if math.random(10000) <= index[i][4] then
            amount = math.random(index[i][2], index[i][3])
            table.insert(rewardItems, {index[i][1], amount})
        end
    end

    -- give rewardItems if any exist
    if #rewardItems > 0 then
        player:giveItems(rewardItems, index.containerId and index.containerId > 0 and index.containerId or 1987)
    end
   
    -- remove and reAdd the chest
    lootChestDeAndReappear(toPosition, item:getId(), actionId, index.magicEffect, index.chestReturnTime * 1000)
    return true
end

for actionid, _ in pairs(rewardsTable) do
    disappearingLootChest:aid(actionid) -- adds all actionid's from rewardsTable
end
disappearingLootChest:register()

Hey, add this and the other one that you told me, but on the server when you click it, it doesn't give anything, it just opens the box and I already have to add the quest in another place apart from actionid?
Post automatically merged:

duda.png

yes lose but when doing it as well as in the TFS 1
They do not pull example the item quest adds it to the actionid and in the RME and when entering the server I open the box and it does not pull it does not give me anything
Post automatically merged:



error poke.png
 
Last edited:
OP
OP
Xikini

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,809
Solutions
432
Reaction score
3,946
Hey, add this and the other one that you told me, but on the server when you click it, it doesn't give anything, it just opens the box and I already have to add the quest in another place apart from actionid?
Post automatically merged:

View attachment 56301

yes lose but when doing it as well as in the TFS 1
They do not pull example the item quest adds it to the actionid and in the RME and when entering the server I open the box and it does not pull it does not give me anything
Post automatically merged:



View attachment 56302
looks like your server doesn't have revscripts.
You'd have to convert the script into regular actions
 

Weteran

New Member
Joined
Sep 13, 2020
Messages
13
Reaction score
3
hi i looking for revscript multi reward chest like anihilator or demon oak.
example:
player can pick up only one chest from 4 chest
i need this script with addon, exp, item, mount
 

rexgandi

Member
Joined
Oct 22, 2011
Messages
170
Reaction score
9
I need script for TFS 0.3.7 - Addon Lever.
You had to put needed addon items for any addon on a table and pull a lever -> %&^#$&POOF -> addon unlocked) :)

Can you do this for me? :)
 
Status
Not open for further replies.
Top