Dress NPCs

Usually you need a patch to make new NPC models and such.

Through some core editing and the mage spell “mirror image” (not actually using the spell, but the packet and flags), I made it possible to dress NPCs with gear.

Its a rather simple idea.

This does not require ANY client modification or addons or anything.

About

You can make an NPC, set the displays or items you want him to have and his race and gender (defines displayID) as well as facial features and skin color. All this is done in the database. The values for skins and features range from 0 to 12 or something … not quite sure how many there are. (it varies for races)

Note The items can use positive value as item entry and negative for displayid.

Get it: http://rochet2.github.io/Dress-NPCs.html

Amazing patch /emoticons/default_smile.png

http://www.confectionaffection.net/ekmps/shops/canet/images/milk-chocolate-no.1-medal-669-p.jpg

This should be an offical option imo. Super cool.

Nice. I think what trip people up are the displayids of the items instead of id’s…

Very Very nice, thx Rochet2 <3

Very nice !!!/emoticons/default_smile.png

Thanks guys :3

Hmm?

patch does not apply :confused:

Helpful comment, we can read minds and know the exact issue.

I Fixed the patch

https://docs.google.com/file/d/0Bwi9wHHnPK8VSXJnOV9jUmd3VE0/edit

Please try it /emoticons/default_smile.png

Fantastic! I love you dude!

The patch needed some fixes but this is fucking awesome.

And you don’t need to clear your cache, just reload the table then delete and respawn your creature.

here’s a fix to use item_entry when you specify a positive number and displayid when negative :

(ObjectMgr.cpp, LoadCreatureOutfits())

for (uint32 j = 0; j < MAX_CREATURE_OUTFIT_DISPLAYS; j++)
{
int32 displayInfo = fields[i+j].GetInt32();
if(displayInfo >= 0)
{// >= 0 item entry
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(displayInfo);
if(proto)
co.outfit[j] = proto->DisplayInfoID;
else
co.outfit[j] = 0;
}
else
{// < 0 displayid
co.outfit[j] = -displayInfo;
}
}

Of course you need to modify the table as well, just remove the “unsigned” flag from the required column and you’re good to go!

Thank you again!

Nice nice, didnt think of that.

/home/compil/src/server/scripts/Commands/cs_reload.cpp: In member function ‘virtual ChatCommand* reload_comman        dscript::GetCommands() const’:
/home/compil/src/server/scripts/Commands/cs_reload.cpp:88:48: error: ‘RBAC_PERM_COMMAND_RELOAD_CREATURE_TEMPLA        TE_OUTFITS’ is not a member of ‘rbac’
make[2]: *** [src/server/scripts/CMakeFiles/scripts.dir/Commands/cs_reload.cpp.o] Ошибка 1
make[1]: *** [src/server/scripts/CMakeFiles/scripts.dir/all] Ошибка 2
make: *** [all] Ошибка 2
root@tdog:/home/compil# /home/compil/src/server/scripts/Commands/cs_reload.cpp: In member function ‘virtual Ch        atCommand* reload_commandscript::GetCommands() const’:
-bash: syntax error near unexpected token `('
root@tdog:/home/compil# /home/compil/src/server/scripts/Commands/cs_reload.cpp: In member function ‘virtual Ch        atCommand* reload_commandscript::GetCommands() const’:
-bash: syntax error near unexpected token `('
root@tdog:/home/compil# GetCommands

This is awesome, I love the idea; however, I’m getting errors and I’m not 100% sure what to add. I did git apply --reject DressNPCs.diff.

After I type the command:

[SPOILER]
Checking patch src/server/game/Globals/ObjectMgr.cpp…

Hunk #1 succeeded at 7785 (offset 76 lines).
Checking patch src/server/game/Globals/ObjectMgr.h…
Hunk #3 succeeded at 1182 (offset 6 lines).
Hunk #4 succeeded at 1328 (offset 6 lines).
Checking patch src/server/game/Handlers/SpellHandler.cpp…
Hunk #1 succeeded at 567 (offset -2 lines).
Checking patch src/server/game/World/World.cpp…
error: while searching for:
TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, “Loading Creature templates…”);
sObjectMgr->LoadCreatureTemplates();

TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, “Loading Equipment templates…”);
// must be after LoadCreatureTemplates
sObjectMgr->LoadEquipmentTemplates();

error: patch failed: src/server/game/World/World.cpp:1414
Checking patch src/server/scripts/Commands/cs_reload.cpp…
error: while searching for:
{ “creature_queststarter”, SEC_ADMINISTRATOR, true, &HandleR
eloadCreatureQuestStarterCommand, “”, NULL },
{ “creature_summon_groups”, SEC_ADMINISTRATOR, true, &HandleR
eloadCreatureSummonGroupsCommand, “”, NULL },
{ “creature_template”, SEC_ADMINISTRATOR, true, &HandleR
eloadCreatureTemplateCommand, “”, NULL },
//{ “db_script_string”, SEC_ADMINISTRATOR, true, &Handl
eReloadDbScriptStringCommand, “”, NULL },
{ “disables”, SEC_ADMINISTRATOR, true, &HandleR
eloadDisablesCommand, “”, NULL },
{ “disenchant_loot_template”, SEC_ADMINISTRATOR, true, &HandleR
eloadLootTemplatesDisenchantCommand, “”, NULL },

error: patch failed: src/server/scripts/Commands/cs_reload.cpp:90
Hunk #2 succeeded at 194 (offset -8 lines).
error: while searching for:
return true;
}

static bool HandleReloadCreatureQuestStarterCommand(ChatHandler* handler, co
nst char* /args/)
{
TC_LOG_INFO(LOG_FILTER_GENERAL, “Loading Quests Relations… (creature_ queststarter)”);

error: patch failed: src/server/scripts/Commands/cs_reload.cpp:534
Applied patch src/server/game/Globals/ObjectMgr.cpp cleanly.
Applied patch src/server/game/Globals/ObjectMgr.h cleanly.
Applied patch src/server/game/Handlers/SpellHandler.cpp cleanly.
Applying patch src/server/game/World/World.cpp with 1 reject…
Rejected hunk #1.
Applying patch src/server/scripts/Commands/cs_reload.cpp with 2 rejects…
Rejected hunk #1.
Hunk #2 applied cleanly.
Rejected hunk #3.[/SPOILER]

World.cpp.rej file:

[SPOILER]
diff a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp (rejected hunks)

@@ -1414,6 +1414,9 @@ void World::SetInitialWorldSettings()
TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, “Loading Creature templates…”);
sObjectMgr->LoadCreatureTemplates();

  • TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, “Loading Creature template outfits…”); // must be after LoadCreatureTemplates
  • sObjectMgr->LoadCreatureOutfits();

TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, “Loading Equipment templates…”); // must be after LoadCreatureTemplates
sObjectMgr->LoadEquipmentTemplates();[/SPOILER]

cs_reload.cpp.rej file:

diff a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp (rejected hunks)

@@ -90,6 +90,7 @@ public:
{ “creature_queststarter”, SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestStarterCommand, “”, NULL },
{ “creature_summon_groups”, SEC_ADMINISTRATOR, true, &HandleReloadCreatureSummonGroupsCommand, “”, NULL },
{ “creature_template”, SEC_ADMINISTRATOR, true, &HandleReloadCreatureTemplateCommand, “”, NULL },

  • { “creature_template_outfits”, SEC_ADMINISTRATOR, true, &HandleReloadCreatureTemplateOutfitsCommand, “”, NULL },
    //{ “db_script_string”, SEC_ADMINISTRATOR, true, &HandleReloadDbScriptStringCommand, “”, NULL },
    { “disables”, SEC_ADMINISTRATOR, true, &HandleReloadDisablesCommand, “”, NULL },
    { “disenchant_loot_template”, SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesDisenchantCommand, “”, NULL },
    @@ -534,6 +536,14 @@ public:
    return true;
    }

  • static bool HandleReloadCreatureTemplateOutfitsCommand(ChatHandler* handler, const char* /args/)

  • {

  • TC_LOG_INFO(LOG_FILTER_GENERAL, “Loading Creature Outfits… (creature_template_outfits)”);

  • sObjectMgr->LoadCreatureOutfits();

  • handler->SendGlobalGMSysMessage(“DB table creature_template_outfits reloaded.”);

  • return true;

  • }

static bool HandleReloadCreatureQuestStarterCommand(ChatHandler* handler, const char* /args/)
{
TC_LOG_INFO(LOG_FILTER_GENERAL, “Loading Quests Relations… (creature_queststarter)”);

Any help would be great, thank you. /emoticons/default_smile.png

Well, pretty simple.

Open up the file the .rej file name suggests, for example World.cpp.

Look for the code mentioned around, for example:

TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, “Loading Creature templates…”);
sObjectMgr->LoadCreatureTemplates();
Add in the code marked with + at the start of the line in the .rej file.

(remove the + marks at the start of each line)

Do this to all rej files and you should be ready.

Next will probably be a few compile errors, since the logging may have changed or some other things.

I added those in and I’m re-compiling now. I also made a new diff file to check back and I received a warning for whitespace, which I think is okay? We’ll see after the re-compile.

Update:

I get the following errors:

[SPOILER]6>…DeadBytesrcservergameGlobalsObjectMgr.cpp(7801): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

6>…DeadBytesrcservergameGlobalsObjectMgr.cpp(7801): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

6>…DeadBytesrcservergameGlobalsObjectMgr.cpp(7816): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

6>…DeadBytesrcservergameGlobalsObjectMgr.cpp(7816): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

6>…DeadBytesrcservergameGlobalsObjectMgr.cpp(7825): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

6>…DeadBytesrcservergameGlobalsObjectMgr.cpp(7825): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

6>…DeadBytesrcservergameGlobalsObjectMgr.cpp(7835): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

6>…DeadBytesrcservergameGlobalsObjectMgr.cpp(7835): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

6>…DeadBytesrcservergameGlobalsObjectMgr.cpp(7857): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

6>…DeadBytesrcservergameGlobalsObjectMgr.cpp(7857): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

[/SPOILER]

and

[SPOILER]6>…DeadBytesrcservergameWorldWorld.cpp(1446): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

6>…DeadBytesrcservergameWorldWorld.cpp(1446): error C2065: ‘LOG_FILTER_SERVER_LOADING’ : undeclared identifier

[/SPOILER]

Would this be a result to the whitespace warning I received when I applied my newer diff?

[COLOR=rgb(40,40,40)]Would this be a result to the whitespace warning I received when I applied my newer diff?

[COLOR=rgb(40,40,40)]No, whitespace doesnt cause compile errors.

[COLOR=rgb(40,40,40)]Also, whitespace can be fixed when applying the patch with --whitespace=fix [COLOR=rgb(40,40,40)](if I remember correctly)

Try changing [COLOR=rgb(40,40,40)]LOG_FILTER_SERVER_LOADING to “server.loading”

Thank you for the reply; however, for the ObjectMgr.cpp would I not use “sql.sql” if it’s referring to the database? For example, the first spoiler was already in the file – I did not add it.

[SPOILER]TC_LOG_ERROR(“sql.sql”, “AreaId %u defined in skill_fishing_base_level does not exist”, entry);

[/SPOILER]

Now, this next spoiler is one that was added after I applied the patch.

[SPOILER]TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, “>> Loaded 0 creature outfits. DB table creature_template_outfits is empty!”);

[/SPOILER]

See it refers to the DB, but I will try your option first. If anything, I can go back and change it. /emoticons/default_tongue.png

UPDATE:

========== Build: 5 succeeded, 0 failed, 11 up-to-date, 0 skipped ==========

I will be testing it out now. I will do another update if all is well. Rochet, I love this patch, and I appreciate the effort and time you put forth in helping me. Also, I’m sorry to have taken so much space up on your thread – hopefully my questions come to use for others.

UPDATE 2:

It works… big thanks! /emoticons/default_smile.png

what program did you use to customize the character? /emoticons/default_ohmy.png