NPC ON USE GUIDE!!!
I was looking around forever and couldnt find it so i just decided to figure it out so im going to share how to make an NPC trigger an event on click. This guide is a little more advanced than beginner Lua so it may be confusing to some so feel free to msn me at
[email protected]
This actually is a VERY simple script but can get complicated dfepending on the uses
K lets get started!!!!
To start you want to make your NPC a gossip NPC, i know weird but you want to
You want to start with a gossip function such as
function bike_use(pUnit, event, player)
now you put your commands under it
function npc_use(pUnit, event, player)
pUnit:SendChatMessage(12, 0, "LOLZ")
end
now that you have that you need to register it and this is what makes it on right click or on use
function npc_use(pUnit, event, player)
pUnit:SendChatMessage(12, 0, "LOLZ")
end
RegisterUnitGossipEvent(NPC ID, 7, "npc_use")
-- 7 is on gossip talk
The registering says the NPC will start the event on gossip talk so once you right click it i would change its flags to 2 and it will seem very realistic!!
that is it and please feel free to comment and please if this isnt corect please tell me and i will correct it thanks
BYE!!!!