EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::General Support (https://www.eqemulator.org/forums/forumdisplay.php?f=598)
-   -   npc no hate player (https://www.eqemulator.org/forums/showthread.php?t=27282)

spider661 01-20-2009 06:00 AM

npc no hate player
 
i set up factions i got 2 factions of npcs fighting each other 1 npc helping player 1 fighting the player (and npc) but if the player uses an AE taunt or anything that hits the npc that likes them then the npc starts attacking the player and don't like them anymore..

how can i fix this?

i want the npcs to not like each other and fight each other but i don't want the npc that likes the player not to not like the player ever.. the npc should not get aggro from he player if he has good factions. is there a way to stop this?

i tried setting H in the special attacks so they dont agro but that makes hem not agro the npcs ether.

i want them to still fight the npcs.

spider661 01-22-2009 01:52 PM

***bump***

Yeormom 01-22-2009 02:49 PM

You can put a check in the source code that looks up the NPC's faction against the faction of the player and then removes the client from the hate list if it matches your specified target. This would be fairly easy to do actually. If that didn't make any sense, you should consider learning the background on the source code before attempting to implement such a fix, as you will be much better off in the long run.

spider661 01-22-2009 03:52 PM

ya that makes scene to me.. just checking the faction do i have to check for the faction id or just if there > indiff.?

i was thinking the same thing kinda but i was not sure where to put the check itself.

i could put it in where the npc does its check on who is attacking but i figure by that time there already kos.

spider661 01-22-2009 03:56 PM

could i do in aggro.cpp somewhere to say if(mob->GetName() == "general_eleus") and target is player then wipe hatelsit?

spider661 01-22-2009 04:59 PM

i added this to aggro.ccp
in the bool Mob::IsAttackAllowed(Mob *target) function
Code:

//////////////////////ADDED//////////////////////
        if(bt == BT_Noattack && target->IsClient())
                return(false);
///////////////////////END ADDED//////////////////

also added
Code:


//////////////////////ADDED//////////////////////
        if(bt == BT_Noattack)
                safe_delete(action_packet);
                return(false);
///////////////////////END ADDED//////////////////

to spells.cpp in the //cannot hurt untargetable mobs check

and added BT_Noattack = 9 to the bodytypes.h file..

think this will work of am i close?

spider661 01-22-2009 06:15 PM

well all that did was break my spell casting :(

spider661 01-22-2009 09:13 PM

ok i got it in case anyone is wondering ill post the code changes once i get it all tested make sure. but so far so good.

spider661 01-22-2009 09:33 PM

ok this seems to be working so if anyone is interested..

i changed this in aggro.cpp

Code:

        //cannot hurt untargetable mobs
        bodyType bt = target->GetBodyType();
        if(bt == BT_NoTarget || bt == BT_NoTarget2)
                return(false);

to

Code:

        //cannot hurt untargetable mobs
        bodyType bt = target->GetBodyType();
        //////////////////////ADDED//////////////////////
        if(bt == BT_Noattack && this->IsClient())
        {
                //Message(10,"You can't attack this!");
                return false;
        }
        ///////////////////////END ADDED//////////////////
        if(bt == BT_NoTarget || bt == BT_NoTarget2)
                return(false);

on around line 518

i also changed bodytypes.h

Code:

        BT_SummonedUndead        = 8,
        BT_NoTarget                        = 11,        //no name, can't target this bodytype

to

Code:

        BT_SummonedUndead        = 8,
///////ADDED////////////////////////////////////
        BT_Noattack                        = 9,       
///////END ADDED///////////////////////////////
        BT_NoTarget                        = 11,        //no name, can't target this bodytype

its working cant cast aoe spells on them cant aoe taunt cant attack but can still target and talk with and it will still attack npcs and such on opposite factions.

now only prob i am having is you can still target taunt them with normal taunt so if someone knows how to fix that i would love the help but i dont think anyone is going to intentionally taunt these mobs. so its not that big a deal mostly i was trying to prevent accidental aggro.

also this done stop bots and prob not pets so if there is a fix for that would be great also. i would like to end up making this like body type 11 but that you can target. completely invul to anything a player does to it. bu not normal npcs on opposing fractions.

Yeormom 01-25-2009 04:43 PM

Things like taunt, harm touch, kick, etc. are considered special attacks and do not fall under the auto attack category and will thus slip by. To fix your bot problem, you just need to add additional checks in your if statements to determine if the object is a bot or not with IsBot() or a function of your choosing.


All times are GMT -4. The time now is 06:39 AM.

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