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

[Help] How to get ID of an NPC ?

SaLeM

New Member
Joined
Oct 14, 2007
Messages
97
Reaction score
0
Location
Spain
[SOLVED] How to get ID of an NPC ?

Yes, I need to know the ID of an NPC, but I don't know how. I tried using something like "Self", "Self.id" and that stuff, but do not work.

ty
 
Last edited:
Of course:

PHP:
function creatureSayCallback(cid, type, msg)
  msg = string.lower(msg)
    if(npcHandler.focus ~= cid) then
      return FALSE
    end
    if (msg == 'name') then
      selfSay(getCreatureName(NPCid))
    end
  return TRUE
end

The plan is to make the NPC say its own name, so I need its uid.
 
Last edited:
Hmm, i think NPC have somethink like players have "cid" so NPC must have too but other.

Actually i don't know what is uid of NPC, but you can try by getThingfromPos:
Code:
npcpos = {x.....
getnpc = getThingfromPos(npcpos)
So we will get - getnpc.uid

But if your NPC is auto moving, then i don't know how ;)
 
As far as I have read out there, the getThingfromPos funcion is bugged. Anyway I don't need it anymore, I finally found the function that gives NPC uid.

Thanks.

--SOLVED--
 
Last edited:
Back
Top