View Single Post
  #1  
Old 03-27-2002, 12:08 PM
Malevolent
Hill Giant
 
Join Date: Mar 2002
Posts: 171
Default Hate decay Timer: How long do you stay irked?

Because it might be handy to be able to set thresholds for how long an individual NPC stays irked at you. Something I always disliked about eq was that some animals should just give up sooner than others. I want a wolf to stick on me for a *long* time, but I want a drunkard to forget about me. This allows you to do that.

Code:
npc.cpp

constructor:
hatedecay_timer = new Timer(30); // low for tests, but each mob could have its own "how long do i stay angry for?" value by passing a variable in place of 30

NPC::Process

	//*****************************************
	//malevolent:hatedecay timer check
	if (hatedecay_timer->Check())
	{
		//disable the timer
		hatedecay_timer->Disable();		

		//remove the target from the list
		
		if (target!=0) //prevents leak
		{			
			entity_list.RemoveFromTargets(this->GetTarget());
			this->RemoveFromHateList(this->CastToMob());
		}
		
		//set the next target up
		SetTarget(hate_list.GetTop());		
		
	}
	//*****************************************


NPC::AddToHateList

	hatedecay_timer->Start(); //reset timer each time hate is added using the value passed in before, don't irk me and I won't bother you


npc.h

protected:
	Timer*  hatedecay_timer;
--MV
Reply With Quote