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

Free Scripting. TFS [1.2]

Status
Not open for further replies.

Mkalo

ボーカロイド
Senator
Joined
Jun 1, 2011
Messages
1,118
Solutions
55
Reaction score
946
Location
Japan
Rules:
  1. ONLY TFS 1.2 ONLY TFS 1.2 ONLY TFS 1.2
  2. Don't ask for fix/convert/copy a script.
  3. Provide enough information about your request (you may provide a video as long its made by you). I may not answer you if you don't.
  4. Ask only for advanced and complex scripts/systems. You may ask for simple stuff but the chances of me being interested to do it is low.
  5. If your request require heavy source modification I won't do it.
  6. Anyone can do the requests if you feel like doing it.
  7. Be nice.

I don't have much time to do lots of scripts, so I'll make this work by placing the requests in a list and I'll do them in order of request. I'll try to do 1~3/week.
If I like your post it means I'm going to do it and it will be added to the list. If I don't like or I don't put it in the list, don't ask again because I'm not doing it.
Most likely I will post the requests in a different thread and link the thread here.

I will also stream while doing all requests, so if you feel like "learning"(watching) the process you can check it at http://www.twitch.tv/mkalo

Cya.
 
Last edited:
Could you make a shop that requires items rather then money in the same window as normal trade for npc?
 
Could you make a shop that requires items rather then money in the same window as normal trade for npc?
@Printer already has this function out here in Forum.
With slight modification you can trade items for items.

However it wont be possible for npc window to tell what items he requires, because its client thing.
 
Code:
-- Let it be clear that container MUST have 2 or more available slots (obviously) and there is no recursion.
function Player:addItems(containerid, items)
    local itype = ItemType(containerid)
    if not itype:isContainer() or itype:getCapacity() < 2 then
        return false
    end

    local cap = self:getFreeCapacity()
    local maincontainer = Game.createItem(containerid)
    local container = maincontainer
    local totalcap = container:getWeight()
    for i = 1, #items do
        if container:getCapacity() == container:getSize()+1 and #items-i > 0 then
            container = container:addItem(containerid)
            totalcap = totalcap + container:getWeight()
        end
        local item = Game.createItem(items[i][1], items[i][2])
        totalcap = totalcap + item:getWeight()
        container:addItemEx(item)
    end
    local ret = self:addItemEx(maincontainer, false)
    return ret, totalcap
end

Usage:
Code:
function onSay(player)
    local ret, cap = player:addItems(1987, {
        {2160, 10},
        {2400, 1},
    })

    if ret == RETURNVALUE_NOTENOUGHCAPACITY then
        player:sendCancelMessage("You need " .. cap / 100 .. " of cap to hold this item.")
    elseif ret ~= RETURNVALUE_NOERROR then
        player:sendCancelMessage(ret)
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You got items.")
    end

    return false
end

This will only add extra backpacks when needed (unlikely my previous code.) so if you have 8 items and the bag size is 8 it wont add a new bag to put the 8th item inside, but if you have 9 items it will create a bag and put 2 items inside it.
Thanks a lot!
 
Could you make a shop that requires items rather then money in the same window as normal trade for npc?
@Printer already has this function out here in Forum.
With slight modification you can trade items for items.

However it wont be possible for npc window to tell what items he requires, because its client thing.
And me too:

But it was for 0.3.6 and idk if i should do it for 1.2.
 
Nah don't do it... these people are making you their slave.. its nice to make 1 or 2 scripts for someone but this is just ridiculous.. people will not learn anything if you do everything for them.
 
Nah don't do it... these people are making you their slave.. its nice to make 1 or 2 scripts for someone but this is just ridiculous.. people will not learn anything if you do everything for them.
I learned a lot these days, lot of lua and go :oops: do not hit me pls
 
Mainly waiting for someone to do a flat map for me cause this tfs default map is annoying me.
 
Yea why are there no threads.. Free map custom made.. something someone made from scratch all we get is these recycled maps.
 
Monster level system for TFS 1.2:
- You will be able to configure the appear levels with a custom monster flag, like <startingLevel=1 finishingLevel=2>, if the monster doesn't have the flag on the xml it will appear level 1.
- Custom nick like the pokemon servers, is just like Demon [90]
- Each level will multiply the melee and spells rate, like each level is a 10% more of power.
- Custom functions to detect the level of a monster and a function to detect the actual level of a monster, something like creature:getLevel() and creature:setLevel(1).

Nothing else.
 
Monster level system for TFS 1.2:
- You will be able to configure the appear levels with a custom monster flag, like <startingLevel=1 finishingLevel=2>, if the monster doesn't have the flag on the xml it will appear level 1.
- Custom nick like the pokemon servers, is just like Demon [90]
- Each level will multiply the melee and spells rate, like each level is a 10% more of power.
- Custom functions to detect the level of a monster and a function to detect the actual level of a monster, something like creature:getLevel() and creature:setLevel(1).

Nothing else.
Not possible to set level because it would require changing the name of the creature and it doesn't work on cipsoft client. The only option would be to disspawn the monster and spawn again with a different level and update the health but that would be kinda shitty.
 
Not possible to set level because it would require changing the name of the creature and it doesn't work on cipsoft client. The only option would be to disspawn the monster and spawn again with a different level and update the health but that would be kinda shitty.
A setLevel working just on creating the monster? I'm looking it for a Pet system anyway
 
Help me finish this lib?

Its for guild wars. Multiple guilds can enter. The winning guild gets reward.

Code:
local storage_participent = 1000
local level_min = 20 --Level to participate in event

local areas = {
[1] = {x = 1000, y = 1000, z = 7},
[2] = {x = 1000, y = 1000, z = 7},
[3] = {x = 1000, y = 1000, z = 7},
[4] = {x = 1000, y = 1000, z = 7}
}

function addGuildToWars(id)
    return db.storeQuery("INSERT INTO `guild_wars_event` (`id`) VALUES ('"..id.."');")
end

function isInGuildWars(id)
    local resultr, ret = db.storeQuery("SELECT `id` FROM `guild_wars_event` WHERE `id` = "..id..";")
        ret = result.getDataInt(resultr,'id')
        result.free(resultr)
    if ret ~= nil then
    return true
    else
    return false
end
end  

function sendGuildWarsMessage(player)
    for i, v in ipairs(Game.getPlayers()) do
        guild_player = Player(v)
            if guild_player:getGuildName() == player:getGuildName() and guild_player:getLevel() >= level_min then
                guild_player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Your guild leader has entered your guild into guild wars. Type !join to participate.")
            end
    end
end

function addPlayerToGuildWars(player)
    return player:setStorageValue(storage_participent, 1)
end

function removePlayerFromGuildWars(player)
    return player:setStorageValue(storage_participent, 0)
end

function teleportParticipantsToGuildWarsArena()
local table_guilds = {}
local table_guilds_name = {}
    for i, v in ipairs(Game.getPlayers()) do
        leader = Player(v)
            if leader:getGuildRank() == "Leader" then
                if isInGuildWars(leader:getGuildId()) then
                    table.insert(table_guilds, leader:getGuildId())
                    table.insert(table_guilds_name, leader:getGuildName())
                end
            end
    end
  
    count = 1
    for i, v in ipairs(Game.getPlayers()) do
        guild_member = Player(v)
            if isInArray(table_guilds, guild_member:getGuildId()) and guild_member:getStorageValue(storage_participent) == 1 then
                if guild_member:isPzLocked() then
                return guild_member:sendTextMessage(MESSAGE_EVENT_ORANGE, "You are unable to join the event because you are pz locked.")
                end
                    guild_member:teleportTo(areas[count]) --Need to find out how to teleport players to a new position when its a new guild.
                    guild_member:sendTextMessage(MESSAGE_EVENT_ORANGE, "The event has started. Good luck!")
                    guild_member:setStorageValue(storage_participent, 0)
            end
    end
    text = ""
    for i = 1, #table_guilds_name do
    text = text..""..table_guilds_name[i]..", "
    end
    broadcastGuildWarsMsg(text)
end

function broadcastGuildWarsMsg(text)
    return Game.broadcastMessage("Guild wars has started. Participating guilds are: "..text)
end

I only need help with the part to teleport different guilds to different locations.
 
Last edited:
Help me finish this lib?

Its for guild wars. Multiple guilds can enter. The winning guild gets reward.

Code:
local storage_participent = 1000
local level_min = 20 --Level to participate in event

local areas = {
[1] = {x = 1000, y = 1000, z = 7},
[2] = {x = 1000, y = 1000, z = 7},
[3] = {x = 1000, y = 1000, z = 7},
[4] = {x = 1000, y = 1000, z = 7}
}

function addGuildToWars(id)
    return db.storeQuery("INSERT INTO `guild_wars_event` (`id`) VALUES ('"..id.."');")
end

function isInGuildWars(id)
    local resultr, ret = db.storeQuery("SELECT `id` FROM `guild_wars_event` WHERE `id` = "..id..";")
        ret = result.getDataInt(resultr,'id')
        result.free(resultr)
    if ret ~= nil then
    return true
    else
    return false
end
end 

function sendGuildWarsMessage(player)
    for i, v in ipairs(Game.getPlayers()) do
        guild_player = Player(v)
            if guild_player:getGuildName() == player:getGuildName() and guild_player:getLevel() >= level_min then
                guild_player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Your guild leader has entered your guild into guild wars. Type !join to participate.")
            end
    end
end

function addPlayerToGuildWars(player)
    return player:setStorageValue(storage_participent, 1)
end

function removePlayerFromGuildWars(player)
    return player:setStorageValue(storage_participent, 0)
end

function teleportParticipantsToGuildWarsArena()
local table_guilds = {}
local table_guilds_name = {}
    for i, v in ipairs(Game.getPlayers()) do
        leader = Player(v)
            if leader:getGuildRank() == "Leader" then
                if isInGuildWars(leader:getGuildId()) then
                    table.insert(table_guilds, leader:getGuildId())
                    table.insert(table_guilds_name, leader:getGuildName())
                end
            end
    end
 
    count = 1
    for i, v in ipairs(Game.getPlayers()) do
        guild_member = Player(v)
            if isInArray(table_guilds, guild_member:getGuildId()) and guild_member:getStorageValue(storage_participent) == 1 then
                if guild_member:isPzLocked() then
                return guild_member:sendTextMessage(MESSAGE_EVENT_ORANGE, "You are unable to join the event because you are pz locked.")
                end
                    guild_member:teleportTo(areas[count]) --Need to find out how to teleport players to a new position when its a new guild.
                    guild_member:sendTextMessage(MESSAGE_EVENT_ORANGE, "The event has started. Good luck!")
                    guild_member:setStorageValue(storage_participent, 0)
            end
    end
    text = ""
    for i = 1, #table_guilds_name do
    text = text..""..table_guilds_name[i]..", "
    end
    broadcastGuildWarsMsg(text)
end

function broadcastGuildWarsMsg(text)
    return Game.broadcastMessage("Guild wars has started. Participating guilds are: "..text)
end

I only need help with the part to teleport different guilds to different locations.
Go to the support boards.
 
For a second I thought you were the boss of something. Then I remember your only the boss of your thoughts.
 
Could some one help me with this script please?
Code:
function onSay(cid, words, param)
    local storage = 4500
    local players = getPlayersOnline()
    local ptable = {}
{name, value}
    for i=1,#players,1 do
        ptable[i] = {getCreatureName(players[i]), getPlayerStorageValue(players[i], storage)}
    end
    table.sort(ptable, function(a,b) return a[2]>b[2] end)
    for i=1,#ptable,1 do
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Name: -Prestige:"..ptable[i][1].."
    end
end
and help me make this one use 200 crystal coins to enter
Code:
local config = {

storageq = XXXX, --quest storage

storaget = xxxx, --timer storage

pos = {x= , y= , z= } --teleport position after using the door

}




function onUse(cid, fromPosition, item, toPosition)




if getPlayerStorageValue(cid, config.storageq) > 0 then

doPlayerSendTextMessage(cid, 19, "You already tried this Quest.")

return false

else

setPlayerStorageValue(cid, config.storageq, 1)

setPlayerStorageValue(cid, config.storaget, os.time())

doTeleportThing(cid, config.pos)

end

return true

end
 
Status
Not open for further replies.
Back
Top