ElunaLuaEngine need help wi-th script

223 Views Asked by At

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.

2

There are 2 best solutions below

0
iThorgrim On BEST ANSWER

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);

0
VhiperDEV On

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