Jump to content

Let a NPC do a command


Recommended Posts

Posted

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

Posted

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

Posted
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?

Archived

This topic is now archived and is closed to further replies.

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