EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Hate decay Timer: How long do you stay irked? (https://www.eqemulator.org/forums/showthread.php?t=916)

Malevolent 03-27-2002 12:08 PM

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

Malevolent 03-28-2002 06:59 AM

I should note that you'll need to put in code to move the NPC back to their home (in NPC::Process()) unless you don't mind having them stand and/or remain in their last known position.


All times are GMT -4. The time now is 06:59 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.