doka2trade
doka2trade

Reputation: 47

ElunaLuaEngine need help wi-th script

I would like to create a script using the Eluna Lua Engine that implements the following:

If a player has an item 192021 in his inventory, then he will be able to talk to npc 202020 and take quest 36004. And if a player doesn't have an item 192021, then there is no dialogue.

Upvotes: 1

Views: 230

Answers (2)

iThorgrim
iThorgrim

Reputation: 101

I think it's better to do in SQL instead of LUA

It is possible to do it with the table conditions

    SET
        @QUESTID := ,
        @ITEMID := ,
        @ITEMCOUNT := ,
        @COMMENT := 'My Super Condition!';
    INSERT INTO `conditions` (SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionValue1, ConditionValue2)
        VALUES
        (19, 0, @QUESTID, 0, 0, 2, @ITEMID, @ITEMCOUNT, @COMMENT);

Upvotes: 3

VhiperDEV
VhiperDEV

Reputation: 11

You can add an item restriction in any menu by simply adding it to the GossipHello function.

For Lua Script engines.

if(player:HasItem(192021)) then
 player:GossipMenuAddItem(6,"QUEST ITEM NPC",0, 1)

Thus the option "QUEST ITEM NPC" is only available if the player has item 192021

Upvotes: 1

Related Questions