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

Xikini's Free Scripting Service. [0.3.7 & (0.3.6/0.4)]

Status
Not open for further replies.

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,812
Solutions
582
Reaction score
5,372
Doing quick (30 min or less) scripts for [0.3.7 & (0.3.6/0.4)]
I am not here to fix your broken scripts, although I will give advice if requested.
I am here for script requests of scripts not already available on the forum.
If you require support for your scripting issues please make a thread in the support section.

For clarity's sake,
I will script actionscripts, creaturescripts, globalevents, talkactions, movements, npcs for you.
I will not script spells, weapons, raids or monster scripts.
Additionally, source editing, websites and database queries are a no go as well.

Code:
How to make shorter links to posts.
https://otland.net/threads/234306/page-14#post-2330703
 
Last edited:
If you have teamviewer, I can help. Pm me your details, and I'll install it for you.
 
what if I told u I needed xenobot 10.87 scrpit to mine them? you will mute me?
Not at all. I'd simply tell you I script for TFS 0.3.7 mostly. An XenoBot Script is entirely different and you should try on the XenoBot forums for guidance instead of here.
The script I provided is for the stone and pickaxe to work. Creating a script to use the pickaxe on the stones is what you seek, and what I cannot provide.
 
Okay, This is the script
Code:
local c = {
        tp = { x = 1035, y = 895, z = 9 }, -- Change XXXX to the location you want.
        text = {
                pos = { x = 1035, y = 895, z = 9 },
                say = "Prepare for round "
        },
        area = {
            from = { x = 1031, y = 891,z = 9 }, -- the first north-west tile pos
            to = { x = 1039, y = 898, z = 9 } -- the last south-east tile pos
        },
        monsterSpawnPoints = {
            [1] = { x = 1032, y = 892, z = 9 }, -- spawn point 1
            [2] = { x = 1037, y = 897, z = 9 }, -- spawn point 1
            [3] = { x = 1038, y = 892, z = 9 }, -- spawn point 1
            [4] = { x = 1032, y = 898, z = 9 } -- spawn point 1
        },
        rounds = {
            [1] = { -- round 1
                    [1] = { name = "morgaroth" }, -- will spawn at spawn point 1
                    [2] = { name = "ghazbaran" }, -- will spawn at spawn point 2
                    [3] = { name = "apocalypse" }, -- will spawn at spawn point 3
                    [4] = { name = "zugurosh" } -- will spawn at spawn point 4
                },
            [2] = { -- round 2
                    [1] = { name = "morgaroth" },
                    [2] = { name = "ghazbaran" },
                    [3] = { name = "cobra" },
                    [4] = { name = "cobra" }
                }
        },
        textColor = 6,
        creatures = {},
        storage = 10000, -- change this to an unused storage value
        SpawnTime = 5 -- how much time should you wait to spawn the creatures in seconds
    }
    -- since we only have 2 rounds setup this will be the max
    local maxRounds = #c.rounds

    function spawnCreatures(c, round)
        for point, creature in ipairs(c.rounds[round]) do
            -- summon the creatures and store the cid of each one summoned
            c.creatures[point] = doSummonCreature(creature.name, c.monsterSpawnPoints[point])
        end
    end

    function countCreatures(c)
        local count = 0
        -- incase we haven't summoned any monsters yet
        if #c.creatures < 1 then
            return count, true
        end
        for i in ipairs(c.creatures) do
            -- make sure all the creatures are monsters
            if isMonster(c.creatures[i]) then
                -- and if they are within range or the area, if they are count them
                if isInRange(getCreaturePosition(c.creatures[i]), c.area.from, c.area.to) then
                    count = count + 1
                end
            else
                -- what is the value of c.creatures[i] in the console
                print(c.creatures[i])
            end
        end
        -- return amount of creatures
        return count, (count == 0)
    end
    function doAnimatedAllText(pos, text, color)
        local textTable = {}
        text:gsub("[0-9a-zA-Z]+", function(str) table.insert(textTable, str) end)
        for i in ipairs(textTable) do
            addEvent(doSendAnimatedText, i * 1000, pos, textTable[i], color)
        end
    end

    function initiate(cid, c, round)
        doTeleportThing(cid, c.tp)
        doAnimatedAllText(c.text.pos, c.text.say..round, c.textColor)
        addEvent(spawnCreatures, c.SpawnTime * 1000, c, round)
    end

    function onUse(cid, item, frompos, item2, topos)
        --local round = ( getPlayerStorageValue(cid, c.storage) <= 0 ) and 1 or getPlayerStorageValue(cid, c.storage)
        local round = 1 -- we will fix this later
        if(item.itemid == 1946 or item.itemid == 1945) then
            doTransformItem(item.uid, (item.itemid == 1946) and item.itemid - 1 or item.itemid + 1) -- transform the switch
            local creatureCount, summonCreature  = countCreatures(c)
            if summonCreature and round ~= maxRounds then
                initiate(cid, c, round)
                setPlayerStorageValue(cid, c.storage, round + 1)
            else
                doTransformItem(item.uid, (item.itemid == 1945) and item.itemid + 1 or item.itemid - 1) -- transform the switch back
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, "..getPlayerName(cid).." but there are still "..creatureCount.." creature(s) left to kill.")
            end
        end
        return true
    end

CodexNG maked the part of the script for me (btw not that CodexNG did a bad job he helped me really much :p). And this is how it works currently:

But I actually want it to be with 3 rounds and when you finished those rounds it spawns a TP that teleports you to the quest room I made. And ofc after you have been teleported the tp disappears again.

Hope you can help me ;)

Cya,

~~~ Edit ~~~

Version 0.3.6
 
Last edited by a moderator:
Okay, This is the script
Code:
local c = {
        tp = { x = 1035, y = 895, z = 9 }, -- Change XXXX to the location you want.
        text = {
                pos = { x = 1035, y = 895, z = 9 },
                say = "Prepare for round "
        },
        area = {
            from = { x = 1031, y = 891,z = 9 }, -- the first north-west tile pos
            to = { x = 1039, y = 898, z = 9 } -- the last south-east tile pos
        },
        monsterSpawnPoints = {
            [1] = { x = 1032, y = 892, z = 9 }, -- spawn point 1
            [2] = { x = 1037, y = 897, z = 9 }, -- spawn point 1
            [3] = { x = 1038, y = 892, z = 9 }, -- spawn point 1
            [4] = { x = 1032, y = 898, z = 9 } -- spawn point 1
        },
        rounds = {
            [1] = { -- round 1
                    [1] = { name = "morgaroth" }, -- will spawn at spawn point 1
                    [2] = { name = "ghazbaran" }, -- will spawn at spawn point 2
                    [3] = { name = "apocalypse" }, -- will spawn at spawn point 3
                    [4] = { name = "zugurosh" } -- will spawn at spawn point 4
                },
            [2] = { -- round 2
                    [1] = { name = "morgaroth" },
                    [2] = { name = "ghazbaran" },
                    [3] = { name = "cobra" },
                    [4] = { name = "cobra" }
                }
        },
        textColor = 6,
        creatures = {},
        storage = 10000, -- change this to an unused storage value
        SpawnTime = 5 -- how much time should you wait to spawn the creatures in seconds
    }
    -- since we only have 2 rounds setup this will be the max
    local maxRounds = #c.rounds

    function spawnCreatures(c, round)
        for point, creature in ipairs(c.rounds[round]) do
            -- summon the creatures and store the cid of each one summoned
            c.creatures[point] = doSummonCreature(creature.name, c.monsterSpawnPoints[point])
        end
    end

    function countCreatures(c)
        local count = 0
        -- incase we haven't summoned any monsters yet
        if #c.creatures < 1 then
            return count, true
        end
        for i in ipairs(c.creatures) do
            -- make sure all the creatures are monsters
            if isMonster(c.creatures[i]) then
                -- and if they are within range or the area, if they are count them
                if isInRange(getCreaturePosition(c.creatures[i]), c.area.from, c.area.to) then
                    count = count + 1
                end
            else
                -- what is the value of c.creatures[i] in the console
                print(c.creatures[i])
            end
        end
        -- return amount of creatures
        return count, (count == 0)
    end
    function doAnimatedAllText(pos, text, color)
        local textTable = {}
        text:gsub("[0-9a-zA-Z]+", function(str) table.insert(textTable, str) end)
        for i in ipairs(textTable) do
            addEvent(doSendAnimatedText, i * 1000, pos, textTable[i], color)
        end
    end

    function initiate(cid, c, round)
        doTeleportThing(cid, c.tp)
        doAnimatedAllText(c.text.pos, c.text.say..round, c.textColor)
        addEvent(spawnCreatures, c.SpawnTime * 1000, c, round)
    end

    function onUse(cid, item, frompos, item2, topos)
        --local round = ( getPlayerStorageValue(cid, c.storage) <= 0 ) and 1 or getPlayerStorageValue(cid, c.storage)
        local round = 1 -- we will fix this later
        if(item.itemid == 1946 or item.itemid == 1945) then
            doTransformItem(item.uid, (item.itemid == 1946) and item.itemid - 1 or item.itemid + 1) -- transform the switch
            local creatureCount, summonCreature  = countCreatures(c)
            if summonCreature and round ~= maxRounds then
                initiate(cid, c, round)
                setPlayerStorageValue(cid, c.storage, round + 1)
            else
                doTransformItem(item.uid, (item.itemid == 1945) and item.itemid + 1 or item.itemid - 1) -- transform the switch back
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, "..getPlayerName(cid).." but there are still "..creatureCount.." creature(s) left to kill.")
            end
        end
        return true
    end

CodexNG maked the part of the script for me (btw not that CodexNG did a bad job he helped me really much :p). And this is how it works currently:

But I actually want it to be with 3 rounds and when you finished those rounds it spawns a TP that teleports you to the quest room I made. And ofc after you have been teleported the tp disappears again.

Hope you can help me ;)

Cya,

The way it was suppose to function aside from other issues is that the storage value is suppose to determine the current round, there also wasn't a check to see if there was a player already in the area either, and the script could use an onKill Event to execute the next round of creatures...

I write 95% of the scripts for people without actually testing the scripts because I can not run a server on my home computer, at work its np but I am swamped at work til november :(

The other 5% i use a lua interpreter to test the logic.

So if you could help this person out that would be awesome :)
 
I don't remember if anyone requested this or not, or if was simply a small side project.
If you did request it, just tell me and I'll add your name to the request.

Simple script.
Two players use a switch at the same time, and get teleported to a new location.

I don't think it needs more explanation then that.

Image to illustrate how it should be set-up. You can set it up many many tiles apart if you wish.
For instance, if you made the lever and stand positions farther apart, you could require 2 people to push the levers to teleport two people on the tiles.


nviOyry.png



And the scripts.

data/actions/actions.xml

Code:
<action actionid="45001" event="script" value="DoubleLeverTeleport.lua"/>
data/actions/scripts/DoubleLeverTeleport.lua
Code:
local lever_pos = {
   [1] = {x = 1387, y = 1426, z = 7, stackpos=1}, -- First Lever Position
   [2] = {x = 1390, y = 1426, z = 7, stackpos=1}  -- Second Lever Position
}
local current_player_pos =   {
   [1] = {x = 1390, y = 1425, z = 7, stackpos=1}, -- First Lever Stand Location
   [2] = {x = 1387, y = 1425, z = 7, stackpos=1}  -- Second Lever Stand Location
}
local new_player_pos =   {
   [1] = {x = 1389, y = 1423, z = 7, stackpos=1}, -- First Lever Teleport Location
   [2] = {x = 1388, y = 1423, z = 7, stackpos=1}  -- Second Lever Teleport Location
}

-- Everything below here doesn't need to be touched.

local function resetLever1()
  doTransformItem(getTileItemById(lever_pos[1], 1946).uid, 1945)
end
local function resetLever2()
  doTransformItem(getTileItemById(lever_pos[2], 1946).uid, 1945)
end

function onUse(cid, item, frompos, item2, topos)

   count = 0
   lever_check = 0
   
   -- transform lever 1
   if item.itemid == 1945 and (frompos.x == lever_pos[1].x and frompos.y == lever_pos[1].y and frompos.z == lever_pos[1].z) then
     doTransformItem(item.uid, 1946)
     addEvent(resetLever1, 200)
     lever_check = lever_check + 2
   -- transform lever 2
   elseif item.itemid == 1945 and (frompos.x == lever_pos[2].x and frompos.y == lever_pos[2].y and frompos.z == lever_pos[2].z) then
     doTransformItem(item.uid, 1946)
     addEvent(resetLever2, 200)
     lever_check = lever_check + 1
   end

   -- if other lever is activated
   local leverCheck = getTileThingByPos(lever_pos[lever_check])
   if leverCheck.itemid == 1946 then
     -- check if players on squares
     for i = 1, #current_player_pos do
       thing = getThingfromPos(current_player_pos[i])
       if isPlayer(thing.uid) == true then
         count = count + 1
       end
     end
     -- if players on squares, teleport them
     if count == #current_player_pos then
       for i = 1, #current_player_pos do
         cid = getThingfromPos(current_player_pos[i])
         doTeleportThing(cid.uid, new_player_pos[i], FALSE)
       end
     end
   end
   
   -- return onUse function
   return true
end
 
Well do u have any version of this npc for my server? :p

Thank you anyway! :D
No unfortunately. I'm not sure what TFS crystalserver is, and the npc itself isn't all that hard.
As long as you have talkstates, and basic storage values.. it's just a basic npc. Albeit a bit longer then most, as it is a long on-going quest from the looks of it, but quite simple nonetheless.
 
No unfortunately. I'm not sure what TFS crystalserver is, and the npc itself isn't all that hard.
As long as you have talkstates, and basic storage values.. it's just a basic npc. Albeit a bit longer then most, as it is a long on-going quest from the looks of it, but quite simple nonetheless.

I am programing it by myself :'( Thank you anyway :D
 
if player:getStorageValue(10554) < 1 and
player:getStorageValue(10501) < 1 then

player:setStorageValue(10501,1)
player:setStorageValue(10554,1)
player:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
doPlayerSetVocation(cid, 4)
doPlayerRemoveItem(cid, 2456, 1)
doPlayerRemoveItem(cid, 23719, 1)
doPlayerRemoveItem(cid, 23721, 1)
doPlayerRemoveItem(cid, 23771, 1)
Player(cid):addItem(2512, 1, false, CONST_SLOT_RIGHT)
Player(cid):addItem(2379, 1, false, CONST_SLOT_LEFT)
Player(cid):addItem(2666, 1, false, CONST_SLOT_BACKPACK)
Player(cid):addItem(8704, 10, false)
Player(cid):addItem(7620, 2, false)

doPlayerSendTextMessage(cid, 19, "As this is your first time as a knight, you received a few extra items. As a knight, you can use the following spells: Bruise Bane")
How i can Delete all the items
(
doPlayerRemoveItem(cid, 2456, 1)
doPlayerRemoveItem(cid, 23719, 1)
doPlayerRemoveItem(cid, 23721, 1)
doPlayerRemoveItem(cid, 23771, 1) ) i Want delete All items not olny 1 But if i use doPlayerRemoveItem(cid, 2456, 100) Dont remove nothing S:
 
if player:getStorageValue(10554) < 1 and
player:getStorageValue(10501) < 1 then

player:setStorageValue(10501,1)
player:setStorageValue(10554,1)
player:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
doPlayerSetVocation(cid, 4)
doPlayerRemoveItem(cid, 2456, 1)
doPlayerRemoveItem(cid, 23719, 1)
doPlayerRemoveItem(cid, 23721, 1)
doPlayerRemoveItem(cid, 23771, 1)
Player(cid):addItem(2512, 1, false, CONST_SLOT_RIGHT)
Player(cid):addItem(2379, 1, false, CONST_SLOT_LEFT)
Player(cid):addItem(2666, 1, false, CONST_SLOT_BACKPACK)
Player(cid):addItem(8704, 10, false)
Player(cid):addItem(7620, 2, false)

doPlayerSendTextMessage(cid, 19, "As this is your first time as a knight, you received a few extra items. As a knight, you can use the following spells: Bruise Bane")
How i can Delete all the items
(
doPlayerRemoveItem(cid, 2456, 1)
doPlayerRemoveItem(cid, 23719, 1)
doPlayerRemoveItem(cid, 23721, 1)
doPlayerRemoveItem(cid, 23771, 1) ) i Want delete All items not olny 1 But if i use doPlayerRemoveItem(cid, 2456, 100) Dont remove nothing S:
I don't quickly know the answer, and this is TFS 1.x script.
Generally I would check what is in each slot of the player, then remove that itemID.. then remove the backpack as well.
You should really post this in support for better help.
 
Status
Not open for further replies.
Back
Top