View Single Post
  #1  
Old 04-27-2002, 07:32 AM
Malevolent
Hill Giant
 
Join Date: Mar 2002
Posts: 171
Default On Guard Behavior

Some fun guard behavior tweaks:

Random animations and sayings. I've attached a sample script file that I use in rivervale and the complete changed over wesquests that i've been using.

You'll need to tweak npc.h
Code:
	/******************************************************
	Mob based questing and other goodies
	******************************************************/
	void CheckQuests(char* zonename, char * message, int32 npc_id, int32 item_id = 0, bool IsDoorScript = false);
	bool IsEnd(char* string);
	bool IsCommented(char* string);
	char * rmnl(char* nstring);	
	char * strreplace(char* searchstring, char* searchquery, char* replacement);
And add in this to npc::process
Code:
		/****************************************
		Guards fun anim
		****************************************/

		#define GUARD_ANIMATION_FREQ 500
		if (rand()%GUARD_ANIMATION_FREQ==2)
		if (!IsEngaged() && !ismovinghome) //what are all the guard names?

		if (strstr(GetName(), "Guard") 
			|| strstr(GetName(), "Sentinel") 
			|| strstr(GetName(), "Sentry") 
			|| strstr(GetName(), "Dragoon") ) {
			switch (rand()%12) {
			case 1: DoSocialAnimation(72); break;					 
			case 2: DoSocialAnimation(55); break;
			case 3: DoSocialAnimation(72); break;
			case 4: DoSocialAnimation(31); break;
			case 5: DoSocialAnimation(34); break;
			case 6: DoSocialAnimation(35); break;
			case 7: DoSocialAnimation(72); break;
			case 8: DoSocialAnimation(61); break;
			case 9: DoSocialAnimation(72); break;
			case 10: DoSocialAnimation(55); break;

			case 11: 	
				if (rand()%50==2)
					this->CheckQuests(zone->GetShortName(), "RANDOM_GUARD", this->GetNPCTypeID());
			default:
				DoSocialAnimation(60);
				break;
			
			}
		}
DoSocialAnimations is
Code:
/
*************************************
NPC Social Animation
*************************************/
void NPC::DoSocialAnimation(int num){
	 this->CastToMob()->DoAnim(num);
}
You'll need to have that signature in npc.h (void DoSocialAnimation(int num);

By changing 'name' in the quest file, you could also have town criers, etc.

--MV
Reply With Quote