• 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:
waiting for you babe
7T3vHQ0.jpg
Is that an 8 track i see?
 
Town guard NPC like WoW. You can talk to him and get directions to each place. Will give a map marker. Also, if you pay the guard he will take you there (teleport you there)
Here you go:

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

local marks = {
    [1] = {
            {Position(150, 443, 7), MAPMARK_EXCLAMATION, "somewhere"},
    },
}

local locations = {
    ["somewhere"] = {pos = Position(150, 443, 7), price = 500, pzcheck = true, marks = marks[1]},
}
local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

      local player = Player(cid)
    if msgcontains(msg, "location") then
        local ret = "I can tell you the locations of "
        for place, _ in pairs(locations) do
            ret = ret .. ("{%s}"):format(place) .. ", "
        end
        ret = ret:sub(1, #ret-2) .. "."
        npcHandler:say(ret, cid)
        npcHandler.topic[cid] = 1
    elseif locations[msg:lower()] then
        local info = locations[msg:lower()]
        if npcHandler.topic[cid] == 1 or not info.pos then
            npcHandler:say("There you go, look at your mini map.", cid)
            npcHandler.topic[cid] = 0
            for i = 1, #info.marks do
                player:addMapMark(info.marks[i][1], info.marks[i][2], info.marks[i][3])
            end
        else
            npcHandler:say("I can take you to " .. msg:lower() .. " for " .. info.price .. " gold coins. Would you like to go?", cid)
            npcHandler.topic[cid] = msg:lower()
        end
    elseif msgcontains(msg, "yes") and locations[npcHandler.topic[cid]] then
        local info = locations[npcHandler.topic[cid]]
        if info.pzcheck and player:isPzLocked() then
            npcHandler:say("Get out of there with this blood.", cid)
            npcHandler.topic[cid] = 0
            return true
        end
        if info.price and not player:removeMoney(info.price) then
            npcHandler:say("You don't have enough money.", cid)
            npcHandler.topic[cid] = 0
            return true
        end

        npcHandler:say("Here we go.", cid)
        player:teleportTo(info.pos)
        info.pos:sendMagicEffect(CONST_ME_TELEPORT)
        npcHandler.topic[cid] = 0
    end
    return true
end

local function greetCallback(cid)
    return true
end

local function onAddFocus(cid)
    npcHandler.topic[cid] = 0
end

npcHandler:setCallback(CALLBACK_ONADDFOCUS, onAddFocus)

npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "How rude!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:addModule(FocusModule:new())
 
ty sir, I dont mess with npcs to much so I will use this template for future. I know it wasn't a hard script but as I said that wasn't the initial focus. Thank you again :) I appreciate your time.
 
When I try to use this method for npcs the npc wont even talk to me. Any ideas?
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Eldin" script="eldin.lua" walkinterval="3000" floorchange="0">
    <health now="100" max="100" />
    <look type="153" head="0" body="76" legs="76" feet="76" addons="3" />
    <parameters>
    <parameter key="message_greet" value="Ahh, your awake and it looks like you have made a full recovery. What in the world were you doing snooping around the {sacred tombs}?" />
    </parameters>
</npc>


Here is the first line it should register but it doesn't:

Code:
if msgcontains(msg, "hi") and player:getStorageValue(storage) <= 0 then
        npcHandler:say("blah", cid)
 
Last edited:
Hi, I try to throw my request here, it is gonna be used for bitaac store.
I want to be able to do something like:
Code:
player:addItems({
    {2160, 10}
    {2400, 1}
})
The items should be added inside a shopping bag (ID: 23782) and then added to the player.
If the shopping bag runs out of empty spaces, it just create a new inside the current one and start add items into it instead.
If the player not can cap the bag, it should just send a cancel message to the player with some info how much cap he should free up.

Hope someone wants to do it, your name will be mention in credits once I release. Thanks :D
 
Hi, I try to throw my request here, it is gonna be used for bitaac store.
I want to be able to do something like:
Code:
player:addItems({
    {2160, 10}
    {2400, 1}
})
The items should be added inside a shopping bag (ID: 23782) and then added to the player.
If the shopping bag runs out of empty spaces, it just create a new inside the current one and start add items into it instead.
If the player not can cap the bag, it should just send a cancel message to the player with some info how much cap he should free up.

Hope someone wants to do it, your name will be mention in credits once I release. Thanks :D
I already did something similar to this: https://otland.net/threads/tfs-1-2-...ened-container-to-player.240824/#post-2328941

I will put this in a function soon(going to eat) you can wait or just use the code in that thread :3

But that one doesn't say the cap needed instead it adds the items that the player can carry. And you would need to change some things
 
Hi, I try to throw my request here, it is gonna be used for bitaac store.
I want to be able to do something like:
Code:
player:addItems({
    {2160, 10}
    {2400, 1}
})
The items should be added inside a shopping bag (ID: 23782) and then added to the player.
If the shopping bag runs out of empty spaces, it just create a new inside the current one and start add items into it instead.
If the player not can cap the bag, it should just send a cancel message to the player with some info how much cap he should free up.

Hope someone wants to do it, your name will be mention in credits once I release. Thanks :D
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.
 
Hello @MatheusMkalo
If you can, create one teleport when each player can acess 1x every 14 days.
Hugs!
Code:
local destination = Position(100, 100, 7)
local storage = 12345
local interval = 14 * 60 * 60 * 24
function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() then
        if creature:getStorageValue(storage) + interval < os.time() then
            creature:teleportTo(destination)
            creature:setStorageValue(storage, os.time())
            destination:sendMagicEffect(CONST_ME_TELEPORT)
            return true
        else
            creature:sendCancelMessage("You can't enter here.")
        end
    end
 
    creature:teleportTo(fromPosition, true)
    return true
end
 
Daily quest system with modal windows.

Talk to NPC who asks you if you would like to do your dailies
Brings up a modal window with choices for difficulty (Easy, Medium, Hard)
When you select a difficulty another window pops up telling you how many of what monster you must kill to complete the daily (Then saves it into your quest log which is deleted after 24 hours)
Once completed talk to NPC again to claim reward.
When you ask for a daily again (on same day) which ever difficulty you just completed is no longer available.

I been meaning to do this for ages but been too busy (and lazy) lol
 
Okay, lets say it looks like this. The Npc says nothing.

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

local storage = 1000

function onCreatureSay(cid, type, msg)
 if not npcHandler:isFocused(cid) then
        return false
    end
   
    local player = Player(cid)
   
    if msgcontains(msg, "hi") and player:getStorageValue(storage) <= 0 then
        npcHandler:say("Ahh, your awake and it looks like you have made a full recovery. What in the world were you doing snooping around the {sacred tombs}?", cid)
    end
end

local function greetCallback(cid)
    return true
end

local function onAddFocus(cid)
    npcHandler.topic[cid] = 0
end

npcHandler:setCallback(CALLBACK_ONADDFOCUS, onAddFocus)

npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "How rude!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:addModule(FocusModule:new())
 
Okay, lets say it looks like this. The Npc says nothing.

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

local storage = 1000

function onCreatureSay(cid, type, msg)
if not npcHandler:isFocused(cid) then
        return false
    end
  
    local player = Player(cid)
  
    if msgcontains(msg, "hi") and player:getStorageValue(storage) <= 0 then
        npcHandler:say("Ahh, your awake and it looks like you have made a full recovery. What in the world were you doing snooping around the {sacred tombs}?", cid)
    end
end

local function greetCallback(cid)
    return true
end

local function onAddFocus(cid)
    npcHandler.topic[cid] = 0
end

npcHandler:setCallback(CALLBACK_ONADDFOCUS, onAddFocus)

npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "How rude!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:addModule(FocusModule:new())
you have 2 function onCreatureSay(cid, type, msg).

The second should be creatureSayCallback because:
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

Look at my npc again.
 
Status
Not open for further replies.
Back
Top