View Single Post
  #4  
Old 07-02-2006, 10:22 AM
unicorn97211
Sarnak
 
Join Date: May 2006
Posts: 37
Default

It's still a tad rough but here ya go, I recommend using #repop between uses if you are using large ranges.

Usage:

#modeltest [Start Race] [End Race] [Start Gender] [End Gender] [Start Texture] [End Texture] [Helm Texture]

Examples:

#modeltest 1 3

Shows a model for human, barbarian and erudite for each gender with a texture of 0 and helm texture of 0.

#modeltest 1 3 0 0

Shows only male models for human, barbarian and erudite with a texture of 0 and helm texture of 0.

#modeltest 1 3 0 0 0 10

Shows only male models for human, barbarian and erudite with textures 0 through 10 and helm texture of 0.

#modeltest 1 3 0 0 0 10 2

Shows only male models for human, barbarian and erudite with textures 0 through 10 and helm texture of 2.

#modeltest 1 400

Shows a model for races 1 through 400 for each gender with a texture of 0 and helm texture of 0 and causes a ton of lag!


The Code:
command.h

change:
Code:
void command_mlog(Client *c, const Seperator *sep);
to:
Code:
void command_mlog(Client *c, const Seperator *sep);
// EverHood 6/14/06
void command_modeltest(Client *c, const Seperator *sep);
command.cpp

change:
Code:
		command_add("npcemote","[message] - Make your NPC target emote a message.",150,command_npcemote)
to:
Code:
		command_add("npcemote","[message] - Make your NPC target emote a message.",150,command_npcemote) ||
		// EverHood 6/14/06
		command_add("modeltest","- Spawn an NPC for every race in a grid. *Use in open areas!",250,command_modeltest)
Add this to the end:
Code:
// EverHood 6/14/06
// Wifes world buidling request
void command_modeltest(Client *c, const Seperator *sep)
{
	if(sep->arg[1][0] == '\0') {
		c->Message(0, "Syntax: #modeltest [Start Race] [End Race] [Start Gender] [End Gender] [Start Texture] [End Texture] [Helm Texture]");
		return;
	}

	int x = 1,y = 1,StartGender = 0,EndGender=2,StartTexture=0,EndTexture=0,HelmTexture=0;
	int start_race = atoi(sep->arg[1]);
	int maxraces = atoi(sep->arg[2]);
	if(!sep->arg[3][0] == '\0')
		StartGender=atoi(sep->arg[3]);
	if(!sep->arg[4][0] == '\0')
		EndGender=atoi(sep->arg[4]);
	if(!sep->arg[5][0] == '\0')
		StartTexture=atoi(sep->arg[5]);
	if(!sep->arg[6][0] == '\0')
		EndTexture=atoi(sep->arg[6]);
	if(!sep->arg[7][0] == '\0')
		HelmTexture=atoi(sep->arg[7]);
	if(maxraces<start_race)
		maxraces=start_race;
	c->Message(0,"Spawning %i Races %i Genders and %i Textures.",maxraces-start_race,(EndGender-StartGender)+1,(EndTexture-StartTexture)+1);
	for(int race = start_race;race<=maxraces; race++){
		for(int gender = StartGender;gender<=EndGender; gender++){
			for(int texture = StartTexture;texture<=EndTexture; texture++){
				//Time to create the NPC!!
				NPCType* npc_type = new NPCType;
				memset(npc_type, 0, sizeof(NPCType));
				strcpy(npc_type->name,"Test");
				npc_type->cur_hp = 100; 
				npc_type->max_hp = 100; 
				npc_type->race = race;
				npc_type->gender = gender; 
				npc_type->class_ = 1; 
				npc_type->deity= 1;
				npc_type->level = 1;
				npc_type->npc_id = 0;
				npc_type->loottable_id = 0;
				npc_type->texture = texture;
				npc_type->light = 0;
				npc_type->walkspeed = 0.67;
				npc_type->runspeed = 1.25;
				npc_type->merchanttype = 0;	
				npc_type->bodytype = 0;
				npc_type->equipment[7] = 0;
				npc_type->equipment[8] = 0;
				npc_type->helmtexture = HelmTexture;
				npc_type->STR = 150;
				npc_type->STA = 150;
				npc_type->DEX = 150;
				npc_type->AGI = 150;
				npc_type->INT = 150;
				npc_type->WIS = 150;
				npc_type->CHA = 150;
				
				NPC* npc = new NPC(npc_type, 0,c->GetX()+(x*10)-(gender*2), c->GetY()+(y*60)-(gender*9)-(texture*3), c->GetZ(), 180);
				npc->GiveNPCTypeData(npc_type);
				//safe_delete(npc_type);
			
				entity_list.AddNPC(npc);
			}
		}
		if(x==10){
			x=1;
			y++;
		}else{
			x++;
		}
	}
}
Let me know if anyone wants a unified diff of this and I'll work one up.

Enjoy
Reply With Quote