Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 01-16-2002, 07:23 AM
Nefarious
Fire Beetle
 
Join Date: Jan 2002
Posts: 18
Default New Commands #2 <Spawn code variation>

I added some code so that when you spawn something using #spawn it will tell you the x, y, z, and the heading of the spawn


Code:

else if (strcasecmp(sep.arg[0], "#spawn") == 0 &amp;&amp; (admin >= 1)) // Image's Spawn Code
{
int pHeading;
cout &lt;&lt; "Spawning:" &lt;&lt; endl;
//Well it needs a name!!!
if(sep.arg[1][0] == 0)
{
Message(1, "Format: #spawn firstname lastname(put (null) for no last name) race gender class level hp weaponnumber heading (North- 0; West- 60; South-130; East-190): spawns a npc those parameters.");
}
else
{
//Lets see if someone didn't fill out the whole #spawn function properly
if ((!strcmp(sep.arg[2],"(null)")) || sep.arg[2][0] == 0)
sprintf(sep.arg[2],"");
if (!sep.IsNumber(3))
sprintf(sep.arg[3],"1");
if (!sep.IsNumber(4))
sprintf(sep.arg[4],"1");
if (!sep.IsNumber(5))
sprintf(sep.arg[5],"1");
if (!sep.IsNumber(6))
sprintf(sep.arg[6],"1");
if (!sep.IsNumber(7))
sprintf(sep.arg[7],"100");
if (atoi(sep.arg[7]) > 32000)
sprintf(sep.arg[7],"32000");
if (!sep.IsNumber()
sprintf(sep.arg[8],"0");
if (!sep.IsNumber(9) &amp;&amp; heading >= 0)
pHeading = heading;
if (!sep.IsNumber(9) &amp;&amp; heading &lt; 0)
pHeading = heading + 260;
if (sep.IsNumber(9))
pHeading = atoi(sep.arg[9]);

char fullname[500];
if (sep.arg[2][0] == 0)
strcpy(fullname, sep.arg[1]);
else
sprintf(fullname,"%s_%s",sep.arg[1],sep.arg[2]);

// Well we want everyone to know what they spawned, right?
Message(4, "New spawn:");
Message(1, " First Name: %s",sep.arg[1]);
Message(1, " Last Name: %s",sep.arg[2]);
Message(1, " Race: %s",sep.arg[3]);
Message(1, " Gender: %s",sep.arg[4]);
Message(1, " Class: %s",sep.arg[5]);
Message(1, " Level: %s",sep.arg[6]);
Message(1, " Current/Max HP: %s",sep.arg[7]);
Message(1, " Weapon Item Number: %s",sep.arg[8]);
Message(1, " ");
Message(1, " Current Heading: %d", heading);
Message(1, " Current x: %d", x_pos);
Message(1, " Current y: %d", y_pos);
Message(1, " Current z: %d", z_pos/10);

//Time to create the NPC!!
NPCType npc_type;
strcpy(npc_type.name,fullname);
strcpy(npc_type.lastname,sep.arg[2]);
npc_type.cur_hp = atoi(sep.arg[7]);
npc_type.max_hp = atoi(sep.arg[7]);
npc_type.race = atoi(sep.arg[3]);
npc_type.gender = atoi(sep.arg[4]);
npc_type.class_ = atoi(sep.arg[5]);
npc_type.deity= 1;
npc_type.level = atoi(sep.arg[6]);
npc_type.npc_id = 0;
npc_type.loottable_id = 0;
npc_type.texture = 0; // add this to be defineable when we find it in the packet
npc_type.light = 0;
for (int i=0; i&lt;9; i++)
npc_type.equipment[i] = atoi(sep.arg[8]);


NPC* npc = new NPC(&amp;npc_type, 0, x_pos, y_pos, z_pos, pHeading, false);

// Disgrace: add some loot to it!
npc->AddCash(0,0,0,0);
int itemcount = (rand()%5) + 1;
for (int counter=0; counter&lt;itemcount; counter++)
{
Item_Struct* item = 0;
while (item == 0)
item = database.GetItem(rand() % 33000);

npc->AddItem(item, 0, 0);
}

entity_list.AddNPC(npc);

//What the hell lets send a position update!
SendPosUpdate();
}
}

-------------------------------------------------------------
__________________
&lt;!||Nefarious||!>
"Just because I'm smart, doesn't mean i can't act stupid"
Reply With Quote
  #2  
Old 01-20-2002, 10:38 AM
Yodason
Hill Giant
 
Join Date: Jan 2002
Posts: 205
Default hey!

hey that was my idea first! (not that I care)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:36 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3