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

Lua How to make NPC give you a certain key

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
I tried

Code:
if(msgcontains(msg, 'key')) then
doPlayerAddItem(cid, 2088, 1)
doItemSetAttribute(getTileItemById(cid, 2088).uid, "uid", 1004)
end

And he gives you a key, but it has no unique ID and is number 0. So how do I make the npc give you a numbered key?
 
okay I figured that out...., but how do I add the key to the player, then set its action ID to 1004 when it is on the player?
 
I am honestly not quite sure because I'm not so familiar with adding a function within another function as a parameter.
I've done it before, it's just I don't know if it applies to everything.

LUA:
doItemSetAttribute(doPlayerAddItem(cid, 2088, 1).uid, "aid", 1004)

or

LUA:
doSetItemActionId(doPlayerAddItem(cid, 2088, 1).uid, 1004)

Depending on your TFS version
 
Both of them just give me a plain key with no action id

and I get this error:

Code:
[25/09/2012 16:11:36] data/npc/scripts/sewerquest.lua:69: attempt to index a number value

on both of them when I get the key
 
Back
Top