NPCs created using .npc add #id are not properly added to 'creature' table menu

User Tag List

Results 1 to 2 of 2
  1. #1
    Stenberg's Avatar Member
    Reputation
    1
    Join Date
    Jun 2019
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    NPCs created using .npc add #id are not properly added to 'creature' table

    I'm currently running the TrinityCore 3.3.5a repack created by Bretti1993.

    Everything seems to work somewhat fine, but when I create new (custom) npcs using the command .npc add #id, they don't seem to be added properly to the 'creature' table. I need them in this table to change some of their data individually, and doing .npc info for each NPC and plot them manually seems... unfun.

    Is this expected behaviour, or is the GM command bugged, and is there a way for me to modify the GM command if this is the case?

    NPCs created using .npc add #id are not properly added to 'creature' table
  2. #2
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Stenberg View Post
    I'm currently running the TrinityCore 3.3.5a repack created by Bretti1993.

    Everything seems to work somewhat fine, but when I create new (custom) npcs using the command .npc add #id, they don't seem to be added properly to the 'creature' table. I need them in this table to change some of their data individually, and doing .npc info for each NPC and plot them manually seems... unfun.

    Is this expected behaviour, or is the GM command bugged, and is there a way for me to modify the GM command if this is the case?
    TrinityCore/cs_npc.cpp#L276
    Code:
    { "add",       rbac::RBAC_PERM_COMMAND_NPC_ADD,       false, nullptr,              "", npcAddCommandTable },
    Code:
        //add spawn of creature
        static bool HandleNpcAddCommand(ChatHandler* handler, char const* args)
        {
            if (!*args)
                return false;
    
            char* charID = handler->extractKeyFromLink((char*)args, "Hcreature_entry");
            if (!charID)
                return false;
    
            uint32 id  = atoul(charID);
            if (!sObjectMgr->GetCreatureTemplate(id))
                return false;
    
            Player* chr = handler->GetSession()->GetPlayer();
            Map* map = chr->GetMap();
    
            if (Transport* trans = chr->GetTransport())
            {
                ObjectGuid::LowType guid = map->GenerateLowGuid<HighGuid::Creature>();
                CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
                data.id = id;
                data.posX = chr->GetTransOffsetX();
                data.posY = chr->GetTransOffsetY();
                data.posZ = chr->GetTransOffsetZ();
                data.orientation = chr->GetTransOffsetO();
                /// @todo: add phases
    
                Creature* creature = trans->CreateNPCPassenger(guid, &data);
    
                creature->SaveToDB(trans->GetGOInfo()->moTransport.SpawnMap, { map->GetDifficultyID() });
    
                sObjectMgr->AddCreatureToGrid(guid, &data);
                return true;
            }
    
            Creature* creature = Creature::CreateCreature(id, map, chr->GetPosition());
            if (!creature)
                return false;
    
            PhasingHandler::InheritPhaseShift(creature, chr);
            creature->SaveToDB(map->GetId(), { map->GetDifficultyID() });
    
            ObjectGuid::LowType db_guid = creature->GetSpawnId();
    
            // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells()
            // current "creature" variable is deleted and created fresh new, otherwise old values might trigger asserts or cause undefined behavior
            creature->CleanupsBeforeDelete();
            delete creature;
    
            creature = Creature::CreateCreatureFromDB(db_guid, map);
            if (!creature)
                return false;
    
            sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid));
            return true;
        }
    It looks like '.npc add <creature_template_id>' should work and persist it to the database.

    TC documents it as TrinityCore GM commands
    Code:
    Syntax: .npc add #creatureid Spawn a creature by the given template id of #creatureid
    It might be a consequence of using a repack. Bugs can exist and if they do it is almost impossible for you to fix them because the code is pre-compiled.

    Have a look at compiling it yourself; the process is quite well documented and we can help if you get stuck. TrinityCore How to compile
    Last edited by stoneharry; 06-06-2019 at 10:55 AM.

Similar Threads

  1. [Question] How can I create new NPC Display IDs for 1.12.1?
    By ram3n in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 09-10-2018, 06:01 AM
  2. How do you make NPC'S stealthwalk using waypoints and/or NPC emote id?
    By Jameswow123 in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 07-29-2010, 04:55 PM
  3. Trainers are not giving option to reset talents!
    By metehan in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 05-31-2008, 08:22 AM
  4. Antrix/ascent ID search 4.0. Updated to have ALL GO and NPC IDs for ascent.
    By Equ1N0X in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 11-02-2007, 07:28 PM
  5. [Ascent] List of Class Trainers and Weapon Masters NPC spawn ID's
    By mkenzi in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 10-21-2007, 11:41 AM
All times are GMT -5. The time now is 07:46 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search