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

[8.60/8.00/7.72] Clean TFS 1.5 Downport

Status
Not open for further replies.

Landera

Veteran OT User
Joined
Nov 24, 2011
Messages
871
Solutions
1
Reaction score
283
Not sure if I did something wrong but my npcs wont take money from me anymore
also when selling for example a mace he takes the mace away from me but wont give me money.

The spells bug in my previous message have been fixed with this update :)
 

VagosClubTM

Member
Joined
Aug 16, 2019
Messages
121
Reaction score
15
Location
Chile
hello, is it possible for an NPC to exchange 1 item for another? at 7.72? don't use gold just use that trade item
 

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
978
Solutions
24
Reaction score
503
Location
Santiago - Chile
hello, is it possible for an NPC to exchange 1 item for another? at 7.72? don't use gold just use that trade item

You should open a support thread for this I guess ;p
Anyways here is a clear sample, you only need to modifiy tables

Lua:
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 talkState = {}
local chosenOffer = {}

function creatureSayCallback(cid, type, msg)
  if(not npcHandler:isFocused(cid)) then
    return false
  end

  local offers = {
     ["obsidian knife"] = {
      askConfirmationMsg = "You bringing me draconian steel and obsidian lance in exchange for obsidian knife?",
      requirements = {
        {5889,1}, {2425,1}
      },
      reward = {
        {5887,1}
      }
    },
    ["piece of royal steel"] = {
      askConfirmationMsg = "I can forge a piece of royal steel if you bring me a crown armor. Want to trade?",
      requirements = {
        {2487,1}
      },
      reward = {
        {5887,1}
      }
    },
    ["piece of hell steel"] = {
      askConfirmationMsg = "I can forge a piece of hell steel if you bring me a devil helmet. Want to trade?",
      requirements = {
        {2462,1}
      },
      reward = {
        {5888,1}
      }
    },
    ["piece of draconian steel"] = {
      askConfirmationMsg = "I can forge a piece of draconian steel if you bring me a dragon shield. Want to trade?",
      requirements = {
        {2516,1}
      },
      reward = {
        {5889,1}
      }
    },
    ["huge chunk of crude iron"] = {
      askConfirmationMsg = "I can forge a huge chunk of crude iron if you bring me a giant sword. Want to trade?",
      requirements = {
        {2393,1}
      },
      reward = {
        {5892,1}
      }
    },
    ["infernal bolt"] = {
      askConfirmationMsg = "I can forge 3 infernal bolts if you bring me a soul orb. Want to trade?",
      requirements = {
        {5944,1}
      },
      reward = {
        {6529,3}
      }
    }
  }

  if msgcontains(msg, 'offer') then
    -- Create the offer list message of the NPC based on entries in `offers` table.
    local response = ""
    local count = 0
    for itemname, _ in pairs(offers) do
      count = count + 1
      response = response .. "{" .. itemname .. "}, "
    end
    if count > 0 then
      response = "Here you can forge the following items: " .. string.sub(response, 1, -3) .. "."
      talkState[cid] = "offering_to_craft"
    else
      response = "I have nothing to offer."
    end
    selfSay(response, cid)
    return true
  end
 
  local lowerMsg = string.lower(msg) -- We will store a lowercase version of the player's message here and use that for comparison. So if they write back "Crown Armor" with capital letters, it will still work.

  if talkState[cid] == "offering_to_craft" then
    if offers[lowerMsg] then
        npcHandler:say(offers[lowerMsg].askConfirmationMsg, cid)
        talkState[cid] = "asking_to_confirm_to_craft"
        chosenOffer[cid] = lowerMsg
    else
      npcHandler:say("I don't {offer} that.", cid)
      talkState[cid] = nil
    end
    return true
  end

  if talkState[cid] == "asking_to_confirm_to_craft" then
    if lowerMsg == "yes" then
      local offer = offers[chosenOffer[cid]]
      local hasRequiredMaterials = true
      local missingMaterials = ""
      for _,requirement in pairs(offer.requirements) do
        if getPlayerItemCount(cid, requirement[1]) < requirement[2] then
          if hasRequiredMaterials then
            hasRequiredMaterials = false
          end
          missingMaterials = missingMaterials .. math.abs(getPlayerItemCount(cid, requirement[1]) - requirement[2]) .. "x " .. getItemNameById(requirement[1]) .. ", "
        end
      end
      if hasRequiredMaterials then
        talkState[cid] = string.lower(msg)
        npcHandler:say("Cling clang!", cid)
        for _,requirement in pairs(offer.requirements) do
          doPlayerRemoveItem(cid, requirement[1], requirement[2])
        end
        for _,reward in pairs(offer.reward) do
          doPlayerAddItem(cid, reward[1], reward[2])
        end
        talkState[cid] = nil
      else
        missingMaterials = "You no have " .. string.sub(missingMaterials, 1, -3) .. "."
        npcHandler:say(missingMaterials, cid)
      end
    else
      npcHandler:say("Pity. Some other time.", cid)
      talkState[cid] = nil
    end
    chosenOffer[cid] = nil
    return true
  end

  return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 

VagosClubTM

Member
Joined
Aug 16, 2019
Messages
121
Reaction score
15
Location
Chile
You should open a support thread for this I guess ;p
Anyways here is a clear sample, you only need to modifiy tables

Lua:
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 talkState = {}
local chosenOffer = {}

function creatureSayCallback(cid, type, msg)
  if(not npcHandler:isFocused(cid)) then
    return false
  end

  local offers = {
     ["obsidian knife"] = {
      askConfirmationMsg = "You bringing me draconian steel and obsidian lance in exchange for obsidian knife?",
      requirements = {
        {5889,1}, {2425,1}
      },
      reward = {
        {5887,1}
      }
    },
    ["piece of royal steel"] = {
      askConfirmationMsg = "I can forge a piece of royal steel if you bring me a crown armor. Want to trade?",
      requirements = {
        {2487,1}
      },
      reward = {
        {5887,1}
      }
    },
    ["piece of hell steel"] = {
      askConfirmationMsg = "I can forge a piece of hell steel if you bring me a devil helmet. Want to trade?",
      requirements = {
        {2462,1}
      },
      reward = {
        {5888,1}
      }
    },
    ["piece of draconian steel"] = {
      askConfirmationMsg = "I can forge a piece of draconian steel if you bring me a dragon shield. Want to trade?",
      requirements = {
        {2516,1}
      },
      reward = {
        {5889,1}
      }
    },
    ["huge chunk of crude iron"] = {
      askConfirmationMsg = "I can forge a huge chunk of crude iron if you bring me a giant sword. Want to trade?",
      requirements = {
        {2393,1}
      },
      reward = {
        {5892,1}
      }
    },
    ["infernal bolt"] = {
      askConfirmationMsg = "I can forge 3 infernal bolts if you bring me a soul orb. Want to trade?",
      requirements = {
        {5944,1}
      },
      reward = {
        {6529,3}
      }
    }
  }

  if msgcontains(msg, 'offer') then
    -- Create the offer list message of the NPC based on entries in `offers` table.
    local response = ""
    local count = 0
    for itemname, _ in pairs(offers) do
      count = count + 1
      response = response .. "{" .. itemname .. "}, "
    end
    if count > 0 then
      response = "Here you can forge the following items: " .. string.sub(response, 1, -3) .. "."
      talkState[cid] = "offering_to_craft"
    else
      response = "I have nothing to offer."
    end
    selfSay(response, cid)
    return true
  end
 
  local lowerMsg = string.lower(msg) -- We will store a lowercase version of the player's message here and use that for comparison. So if they write back "Crown Armor" with capital letters, it will still work.

  if talkState[cid] == "offering_to_craft" then
    if offers[lowerMsg] then
        npcHandler:say(offers[lowerMsg].askConfirmationMsg, cid)
        talkState[cid] = "asking_to_confirm_to_craft"
        chosenOffer[cid] = lowerMsg
    else
      npcHandler:say("I don't {offer} that.", cid)
      talkState[cid] = nil
    end
    return true
  end

  if talkState[cid] == "asking_to_confirm_to_craft" then
    if lowerMsg == "yes" then
      local offer = offers[chosenOffer[cid]]
      local hasRequiredMaterials = true
      local missingMaterials = ""
      for _,requirement in pairs(offer.requirements) do
        if getPlayerItemCount(cid, requirement[1]) < requirement[2] then
          if hasRequiredMaterials then
            hasRequiredMaterials = false
          end
          missingMaterials = missingMaterials .. math.abs(getPlayerItemCount(cid, requirement[1]) - requirement[2]) .. "x " .. getItemNameById(requirement[1]) .. ", "
        end
      end
      if hasRequiredMaterials then
        talkState[cid] = string.lower(msg)
        npcHandler:say("Cling clang!", cid)
        for _,requirement in pairs(offer.requirements) do
          doPlayerRemoveItem(cid, requirement[1], requirement[2])
        end
        for _,reward in pairs(offer.reward) do
          doPlayerAddItem(cid, reward[1], reward[2])
        end
        talkState[cid] = nil
      else
        missingMaterials = "You no have " .. string.sub(missingMaterials, 1, -3) .. "."
        npcHandler:say(missingMaterials, cid)
      end
    else
      npcHandler:say("Pity. Some other time.", cid)
      talkState[cid] = nil
    end
    chosenOffer[cid] = nil
    return true
  end

  return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Hello friend, thank you very much I had already created a thread but nobody looked at it, thank you very much I will try it and tell you how it goes.
 

Extrodus

One day at a time <3
Joined
Dec 22, 2008
Messages
2,344
Solutions
2
Reaction score
331
Location
Canada, Eh?
Whats going on with the depot saving items issue? Im able to dupe items just by throwing an item on the floor from my depot, logging out and then logging back in just to find the item reloaded into my depot. Also getting client debugs for objects.cpp 277 for client 8.6.

Was seriously excited to upgrade, but now I'm baffled by how these small issues could even be present. Apparently the debug has something to do with potions or containers. Checked for the fix on github, and the changes already are applied to the source but the issue is still present.
 
OP
OP
Nekiro

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,560
Solutions
119
Reaction score
1,867
Whats going on with the depot saving items issue? Im able to dupe items just by throwing an item on the floor from my depot, logging out and then logging back in just to find the item reloaded into my depot. Also getting client debugs for objects.cpp 277 for client 8.6.

Was seriously excited to upgrade, but now I'm baffled by how these small issues could even be present. Apparently the debug has something to do with potions or containers. Checked for the fix on github, and the changes already are applied to the source but the issue is still present.
How comes that totally free project that I have absolutely nothing for has any kind of bugs????
I'm getting sick of all of that, I'm wasting my time to help all of you, but you gotta complain like you are paying for that.
 

Extrodus

One day at a time <3
Joined
Dec 22, 2008
Messages
2,344
Solutions
2
Reaction score
331
Location
Canada, Eh?
How comes that totally free project that I have absolutely nothing for has any kind of bugs????
I'm getting sick of all of that, I'm wasting my time to help all of you, but you gotta complain like you are paying for that.
I said what's going on with these issues.. I've browsed the git and found fixes that don't fix it and I'm genuinely confused because I was excited to upgrade from 0.4 and this is the response I get? Maybe you should just close down the repo if it's too much for you.. sorry for asking legitimate questions without any negative feedback; didn't realize it would hurt anyone's feelings. If you feel like you are wasting your time, stop wasting it.. nobody is forcing you to do anything. Sincerely, grow up.
 
OP
OP
Nekiro

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,560
Solutions
119
Reaction score
1,867
I said what's going on with these issues.. I've browsed the git and found fixes that don't fix it and I'm genuinely confused because I was excited to upgrade from 0.4 and this is the response I get? Maybe you should just close down the repo if it's too much for you.. sorry for asking legitimate questions without any negative feedback; didn't realize it would hurt anyone's feelings. If you feel like you are wasting your time, stop wasting it.. nobody is forcing you to do anything. Sincerely, grow up.
Sometimes silence is the better option, you have chosen wrong.
Thanks for the tip, maybe I'll close it down like you want!
 

Landera

Veteran OT User
Joined
Nov 24, 2011
Messages
871
Solutions
1
Reaction score
283
I said what's going on with these issues.. I've browsed the git and found fixes that don't fix it and I'm genuinely confused because I was excited to upgrade from 0.4 and this is the response I get? Maybe you should just close down the repo if it's too much for you.. sorry for asking legitimate questions without any negative feedback; didn't realize it would hurt anyone's feelings. If you feel like you are wasting your time, stop wasting it.. nobody is forcing you to do anything. Sincerely, grow up.

I think there is nothing wrong by posting a bug but you should leave it there.

The "Was seriously excited to upgrade, but now I'm baffled by how these small issues could even be present. Apparently the debug has something to do with potions or containers. Checked for the fix on github, and the changes already are applied to the source but the issue is still present."

Was not necessary to post, just wait if he wanted to fix or try fix it yourself.

No hate to both of ya tho :)
 
OP
OP
Nekiro

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,560
Solutions
119
Reaction score
1,867
I think there is nothing wrong by posting a bug but you should leave it there.

The "Was seriously excited to upgrade, but now I'm baffled by how these small issues could even be present. Apparently the debug has something to do with potions or containers. Checked for the fix on github, and the changes already are applied to the source but the issue is still present."

Was not necessary to post, just wait if he wanted to fix or try fix it yourself.

No hate to both of ya tho :)
A note about that "fluid issue" though. Fix was tested on cip client and worked fine, so no idea what's the problem, maybe dude is using otc or he is too lazy to add required flag (like in the commit to all of the fluid items)
 

Extrodus

One day at a time <3
Joined
Dec 22, 2008
Messages
2,344
Solutions
2
Reaction score
331
Location
Canada, Eh?
A note about that "fluid issue" though. Fix was tested on cip client and worked fine, so no idea what's the problem, maybe dude is using otc or he is too lazy to add required flag (like in the commit to all of the fluid items)
Using default CIP client, not OTC - the flag is already commited - but thank you for the assumptions. Also with the depot saving bug, using latest commits and even browsed the git and found the cherrypicked fixes and went to apply them just to realize they are already implemented but the bug persists but I must just be too lazy.

@Landera - Yeah I guess it was just bad wording, but I'm genuinely baffled how depots got broken in the downgrade. Wasn't a shot at anyone, was just excited to get moving on the upgrade from 0.4 then realized there's these issues that haven't fully been addressed. But I can partly see why now.
 
OP
OP
Nekiro

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,560
Solutions
119
Reaction score
1,867
Using default CIP client, not OTC - the flag is already commited - but thank you for the assumptions. Also with the depot saving bug, using latest commits and even browsed the git and found the cherrypicked fixes and went to apply them just to realize they are already implemented but the bug persists but I must just be too lazy.

@Landera - Yeah I guess it was just bad wording, but I'm genuinely baffled how depots got broken in the downgrade. Wasn't a shot at anyone, was just excited to get moving on the upgrade from 0.4 then realized there's these issues that haven't fully been addressed. But I can partly see why now.
You are shittalking though. Depot issue is not present in latest 8.60 downgrade. Just checked it.
vpZkUXnw6q.gif

Vials are working too.
1641289863295.png

So no idea what are we talking about.
 
Last edited:
Status
Not open for further replies.
Top