Jump to content
  • 0

Let a NPC do a command


Graxo

Question

Hi,

Maybe this is on the right way, but i cant seem it find how i can search on this website or on the forums.
But i want to let a NPC do a command, like talk to the NPC and be lvled to 70.. i have no clue how to do this.

 

Hope you guys can help me.

 

Kind regrads,

Graxo

Edited by Graxo
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

You can do this through a gossip script

local NpcId = 123 -- Entry ID of your gossip creature
local MenuId = 123 -- Unique ID to recognice player gossip menu among others

local function OnGossipHello(event, player, object)
    player:GossipClearMenu()
    player:GossipMenuAddItem(0, "Level me to 70", 1, 1)
    player:GossipMenuAddItem(0, "Nevermind", 1, 0)
    player:GossipSendMenu(1, object, MenuId)
end

local function OnGossipSelect(event, player, object, sender, intid, code, menuid)
    if (intid == 1) then
        player:SetLevel(70)
    end
    
    player:GossipComplete()
end

RegisterCreatureGossipEvent(NpcId, 1, OnGossipHello)
RegisterCreatureGossipEvent(NpcId, 2, OnGossipSelect)

Very rudimentary script, you probably want to add some more checks like whether the player is already 70 etc, but I'll leave that up to you :)

Link to comment
Share on other sites

  • 0
14 hours ago, Foereaper said:

You can do this through a gossip script


local NpcId = 123 -- Entry ID of your gossip creature
local MenuId = 123 -- Unique ID to recognice player gossip menu among others

local function OnGossipHello(event, player, object)
    player:GossipClearMenu()
    player:GossipMenuAddItem(0, "Level me to 70", 1, 1)
    player:GossipMenuAddItem(0, "Nevermind", 1, 0)
    player:GossipSendMenu(1, object, MenuId)
end

local function OnGossipSelect(event, player, object, sender, intid, code, menuid)
    if (intid == 1) then
        player:SetLevel(70)
    end
    
    player:GossipComplete()
end

RegisterCreatureGossipEvent(NpcId, 1, OnGossipHello)
RegisterCreatureGossipEvent(NpcId, 2, OnGossipSelect)

Very rudimentary script, you probably want to add some more checks like whether the player is already 70 etc, but I'll leave that up to you :)

I am very new to this.. How do i run a gossip script?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use