Can NPCs cast GM commands? menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can NPCs cast GM commands?

    Hey guys, I wanted to make it so that an NPC in my custom city will do the .advanceallskills ___ thing to the players, so I was wondering if that's even possible, and if it is, how to do it. It's just so that the GMs have one less thing to do.

    Can NPCs cast GM commands?
  2. #2
    Power of Illuminati's Avatar Contributor
    Reputation
    179
    Join Date
    May 2008
    Posts
    1,410
    Thanks G/R
    6/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    C++ scripting.

    As all GM commands are built up using C++, there must be some way to make this with c++ =P

  3. #3
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need my friendly neighborhood Spidey

    I'll message him and ask him, thanks for helping me narrow it down though Illuminati!

  4. #4
    Gastricpenguin's Avatar Legendary
    Reputation
    980
    Join Date
    Feb 2007
    Posts
    2,236
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup, I have a "welcoming" npc which advances your skills to 350 and will teach you max professions. This is accomplished through C++
    Life Puzzler WoW - Website | Forums

  5. #5
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you show or explain how you did it so I might have a shot at making my own?

    Along with that, can I make a object port someone when they click it, but I want the object to do .start, so it always sends them back to their starting location?

  6. #6
    doublehex's Avatar Member
    Reputation
    34
    Join Date
    Mar 2007
    Posts
    385
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can find the commands and how they work in level0.cpp, level1.cpp, level2.cpp, and level3.cpp in src/ascent-world


  7. #7
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, but then how do I translate that over to an NPC or a gameobject? Sorry that I'm new to LUA/C++.

  8. #8
    doublehex's Avatar Member
    Reputation
    34
    Join Date
    Mar 2007
    Posts
    385
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well you can edit a npc gossip script (somthing like a warp npc) or jsut make a gameobject script. you can search for either, get the source and edit the case


  9. #9
    novaprosp3kt's Avatar Member
    Reputation
    23
    Join Date
    May 2008
    Posts
    133
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Without a knowledge of C++ and how it works, its highly unlikely you could script this mate, sorry.

  10. #10
    doublehex's Avatar Member
    Reputation
    34
    Join Date
    Mar 2007
    Posts
    385
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no its not highly unlikely, he just needed some help, unfortunately im busy atm and cant assist him. its not like if you dont know all of C++ that you wont be able to do anything.


  11. #11
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, I understand what I need to do with the LUA script (or I have a fairly good idea of it) from reading up and practicing by making a few boss scrpits and gossip scripts. I went searching through the level stuff and found the .start command from there.
    bool ChatHandler::HandleStartCommand(const char* args, WorldSession *m_session)
    {
    std::string race;
    uint32 raceid = 0;

    Player *m_plyr = getSelectedChar(m_session, false);

    if (m_plyr && args && strlen(args) < 2)
    {
    raceid = m_plyr->getRace();
    switch (raceid)
    {
    case 1:
    race = "human";
    break;
    case 2:
    race = "orc";
    break;
    case 3:
    race = "dwarf";
    break;
    case 4:
    race = "nightelf";
    break;
    case 5:
    race = "undead";
    break;
    case 6:
    race = "tauren";
    break;
    case 7:
    race = "gnome";
    break;
    case 8:
    race = "troll";
    break;
    case 10:
    race = "bloodelf";
    break;
    case 11:
    race = "draenei";
    break;
    default:
    return false;
    break;
    }
    }
    else if (m_plyr && args && strlen(args) > 2)
    {
    race = args;
    ASCENT_TOLOWER(race);

    // Teleport to specific race
    if(race == "human")
    raceid = 1;
    else if(race == "orc")
    raceid = 2;
    else if(race == "dwarf")
    raceid = 3;
    else if(race == "nightelf")
    raceid = 4;
    else if(race == "undead")
    raceid = 5;
    else if(race == "tauren")
    raceid = 6;
    else if(race == "gnome")
    raceid = 7;
    else if(race == "troll")
    raceid = 8;
    else if(race == "bloodelf")
    raceid = 10;
    else if(race == "draenei")
    raceid = 11;
    else
    {
    RedSystemMessage(m_session, "Invalid start location! Valid locations are: human, dwarf, gnome, nightelf, draenei, orc, troll, tauren, undead, bloodelf");
    return true;
    }
    }
    else
    {
    return false;
    }

    // Try to find a class that works
    PlayerCreateInfo *info = NULL;
    for(uint32 i=1;i<11;i++)
    {
    info = objmgr.GetPlayerCreateInfo(raceid, i);
    if(info != NULL) break;
    }

    if(info == NULL)
    {
    RedSystemMessage(m_session, "Internal error: Could not find create info.");
    return false;
    }


    GreenSystemMessage(m_session, "Telporting %s to %s starting location.", m_plyr->GetName(), race.c_str());

    m_session->GetPlayer()->SafeTeleport(info->mapId, 0, LocationVector(info->positionX, info->positionY, info->positionZ));
    return true;
    }
    From that info, what would I put into my script, which from Spidey's tutorial on GameObject scripts would look similar too:
    #include "StdAfx.h"
    #include "Setup.h"

    class GONAME : public GameObjectAIScript
    {
    public:
    GONAME(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
    static GameObjectAIScript *Create(GameObject * GO) { return new GONAME(GO); }

    void OnActivate(Player * pPlayer)
    {
    //do stuff here
    }
    };

    void SetupGONAME(ScriptMgr * mgr)
    {
    mgr->register_gameobject_script(ENTRY, &GONAME::Create);
    }
    EDIT: Actually, refrain from answering, I think I understand this, it kinda looks similar to Java in some ways (with the boolean and the if ___ else ___). Let me try this myself and I'll see if I can do it.
    Last edited by guitargod218; 05-28-2008 at 04:38 PM.

  12. #12
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's a hint - C&P the code from .advanceallskills to //do stuff here

  13. #13
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, my friendly neighborhood Spidey, I'll try it out later once I get back from dinner.

  14. #14
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, I input my C++ script into my scripts folder, but nothing happens when I click on it. The name of the object is "Globe of Translocation" (Crappy name , I know), and here is the script:
    #include "StdAfx.h"
    #include "Setup.h"

    class Globe_of_Translocation : public GameObjectAIScript
    {
    public:
    Globe_of_Translocation(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
    static GameObjectAIScript *Create(GameObject * GO) { return new Globe_of_Translocation(GO); }

    void OnActivate(Player * pPlayer)
    {
    bool ChatHandler::HandleStartCommand(const char* args, WorldSession *m_session)
    {
    std::string race;
    uint32 raceid = 0;

    Player *m_plyr = getSelectedChar(m_session, false);

    if (m_plyr && args && strlen(args) < 2)
    {
    raceid = m_plyr->getRace();
    switch (raceid)
    {
    case 1:
    race = "human";
    break;
    case 2:
    race = "orc";
    break;
    case 3:
    race = "dwarf";
    break;
    case 4:
    race = "nightelf";
    break;
    case 5:
    race = "undead";
    break;
    case 6:
    race = "tauren";
    break;
    case 7:
    race = "gnome";
    break;
    case 8:
    race = "troll";
    break;
    case 10:
    race = "bloodelf";
    break;
    case 11:
    race = "draenei";
    break;
    default:
    return false;
    break;
    }
    }
    else if (m_plyr && args && strlen(args) > 2)
    {
    race = args;
    ASCENT_TOLOWER(race);

    // Teleport to specific race
    if(race == "human")
    raceid = 1;
    else if(race == "orc")
    raceid = 2;
    else if(race == "dwarf")
    raceid = 3;
    else if(race == "nightelf")
    raceid = 4;
    else if(race == "undead")
    raceid = 5;
    else if(race == "tauren")
    raceid = 6;
    else if(race == "gnome")
    raceid = 7;
    else if(race == "troll")
    raceid = 8;
    else if(race == "bloodelf")
    raceid = 10;
    else if(race == "draenei")
    raceid = 11;
    else
    {
    RedSystemMessage(m_session, "Invalid start location! Valid locations are: human, dwarf, gnome, nightelf, draenei, orc, troll, tauren, undead, bloodelf");
    return true;
    }
    }
    else
    {
    return false;
    }

    // Try to find a class that works
    PlayerCreateInfo *info = NULL;
    for(uint32 i=1;i<11;i++)
    {
    info = objmgr.GetPlayerCreateInfo(raceid, i);
    if(info != NULL) break;
    }

    if(info == NULL)
    {
    RedSystemMessage(m_session, "Internal error: Could not find create info.");
    return false;
    }


    GreenSystemMessage(m_session, "Telporting %s to %s starting location.", m_plyr->GetName(), race.c_str());

    m_session->GetPlayer()->SafeTeleport(info->mapId, 0, LocationVector(info->positionX, info->positionY, info->positionZ));
    return true;
    }
    }
    };

    void SetupGlobe_of_Translocation(ScriptMgr * mgr)
    {
    mgr->register_gameobject_script(910000, &Globe_of_Translocation::Create);
    }
    Does it not work because in the script it's Globe_of_Translocation instead of GlobeofTranslocation?

    EDIT: Oh yeah, I made the object a 10 (goober) in my database, is that what it should be?
    Last edited by guitargod218; 05-28-2008 at 07:13 PM.

  15. #15
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suggest you read some C++ tutorials.

Page 1 of 2 12 LastLast

Similar Threads

  1. [question] how to make an custom npc cast spells?
    By INS4N3K1LL in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 05-18-2008, 07:45 AM
  2. LUA help, how to make npc cast a spell at a certain HP???
    By pioneer1337 in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 03-30-2008, 06:27 PM
  3. I'd like to ask if there is a website where I can find all /script commands
    By Loaril in forum WoW UI, Macros and Talent Specs
    Replies: 3
    Last Post: 01-04-2008, 08:27 AM
  4. [Guide] NPC factions and commands
    By Denelly in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 11-02-2007, 09:03 PM
  5. Can't use GM commands. (Broken)
    By Saridormi in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 10-30-2007, 09:06 AM
All times are GMT -5. The time now is 07:29 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search