PDA

View Full Version : COMMITTED: #npcedit weapon graphics addition


RichardoX
02-01-2010, 05:49 PM
This simply adds two commands which gives you the ability to modify the primary/secondary weapon held in the NPC's hands. The last time I tried to submit this, it was stickied. I am unsure why. :p

#npcedit wep1 graphic_id (primary hand)
#npcedit wep2 graphic_id (secondary hand)

Command.cpp

AFTER
c->Message(0, "#npcedit findable - Sets an NPC's findable flag");

ADD
c->Message(0, "#npcedit wep1 - Sets an NPC's primary weapon to a specified graphic id.");
c->Message(0, "#npcedit wep2 - Sets an NPC's secondary weapon to a specified graphic id.");



AFTER

else if ( strcasecmp( sep->arg[1], "findable" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
c->Message(15,"NPCID %u is now %s",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])==0?"not findable":"findable");
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set findable=%i where id=%i",atoi(sep->argplus[2])==0?0:1,c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
c->LogSQL(query);
safe_delete_array(query);
}


ADD

else if ( strcasecmp( sep->arg[1], "wep1" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
c->Message(15,"NPCID %u will have item graphic %f set to his primary on repop.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atof(sep->arg[2]));
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set d_meele_texture1=%f where id=%i",atof(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
c->LogSQL(query);
safe_delete_array(query);
}
else if ( strcasecmp( sep->arg[1], "wep2" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
c->Message(15,"NPCID %u will have item graphic %f set to his secondary on repop.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atof(sep->arg[2]));
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set d_meele_texture2=%f where id=%i",atof(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
c->LogSQL(query);
safe_delete_array(query);
}

trevius
02-01-2010, 06:23 PM
Duplicate post as mentioned:
http://www.eqemulator.net/forums/showthread.php?t=28848

Stickied submissions means they are waiting to be reviewed and/or added. I don't know why it hasn't been added yet off-hand, though.

:P

RichardoX
02-01-2010, 07:14 PM
I'm sorry Trev. I use it all the time but when I updated my source, it removed the command. I didn't know what else to do from there and I didn't want to bother with a PM. :p

trevius
02-01-2010, 07:35 PM
You could have replied to the original thread on it :P

I don't see any issues with adding that extra option to the command. I might be able to get it added pretty soon if no one else does.

Personally, I have been wanting to expand the NPC settings a bit to allow us to create full armor set appearances for NPCs. I just need to think of the best way to add it in, as I don't want to make another table for it. I am thinking about just removing the npc_types_tint table and replacing it with an npc_armor_sets table instead. Instead of just setting the tint for each slot in the set, it would also let you set the texture for each slot of the set. So, you could have chain legs, plate boots, and cloth arms, etc on NPCs to mix and match however you like. Then, since they are sets, you can easily apply the set to whichever NPCs you want. This will keep the npc_types table from getting any bigger too. I guess I would just rename the armortint_id in npc_types to something like armorset_id.

Hopefully, I can get that all figured out and coded at some point. The reason I mention it here is because once it is added, #npcedit could then be expanded to make use of the new armor set table. And, I am thinking about adding weapon model in there since they are worn armor slots and there are already tinting fields for them. It probably makes more sense to remove the weapon slot tinting fields and leave those 2 slots up to the npc_types table, though.

RichardoX
02-01-2010, 10:18 PM
Sounds like a fantastic idea! Thanks for your help Trevius! I'd love to see this added into npcedit until we can get your alternative added in.

trevius
02-03-2010, 06:58 AM
Ok, I got this code added to R1213. You had this command set to save weapon models to the DB as floats, when it should have been ints. I made the correction, but that may very well be why no one else had bothered to add this to the source yet :P

RichardoX
02-03-2010, 08:59 AM
Thank you very much! :D