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

TFS 1.X+ npc structure

poe6man3

Member
Joined
Aug 6, 2020
Messages
87
Solutions
1
Reaction score
12
hello just got a quick question how can i check all the info about npc inside npc.lua script
I want to have the same npc but have different responds depending on the npc position.
 
why don't you use multiple NPCs with each their own script but just give them the same name/outfit in their .xml file
 
Lua:
local positions = { ["stageOne"] = Position(1056, 1028, 4)}

function greetChecks(cid)
local creature = Creature(cid)
local thisNpc = Npc(getNpcCid())

    if creature:getStorageValue(obliteration) == 1 and thisNpc:getPosition() == positions["stageOne"] then
        print("hehe")
    end
end
Ok ill make it work but im completly not understanding what Npc() is but it is working like i want, if somebody could explain the Npc() it would be cool
 
Lua:
local positions = { ["stageOne"] = Position(1056, 1028, 4)}

function greetChecks(cid)
local creature = Creature(cid)
local thisNpc = Npc(getNpcCid())

    if creature:getStorageValue(obliteration) == 1 and thisNpc:getPosition() == positions["stageOne"] then
        print("hehe")
    end
end
Ok ill make it work but im completly not understanding what Npc() is but it is working like i want, if somebody could explain the Npc() it would be cool
It's the same as Player(playerId) Creature(creatureId) Monster(monsterId) Npc(npcId) Item(itemId) Position(x, y, z) Tile(position) et cetera.

You're creating the npc object using the npc's Id.
 
Back
Top