GriffonSpade
Member
Hey guys, I've tracked down the cause of the Dark Tides Scroll of Abraxas bug. If you can believe it, it is in CheckHerding, while the familiars are usually under DoOrderCome, which doesn't even reference CheckHerding!
Unfortunately, upon figuring this out, I'm having more problems because of the way familiars' scripted behavior is kludged together, rather than using AI properly. I intend to create two new orders (DoOrderAggro and DoOrderHeel, along with a DoOrderFetch that will only be used during the Dark Tides quest so that it doesn't run checks for it) that only Familiars will use.
However, I need to know exactly how familiars act on OSI to do this right.
1) When you attack a mobile, does your familiar attack it?
2) If you're ranged attacking, does it run out to attack it?
3) What about if you're casting spells at the target while not in war mode?
4) Does it defend you when you are attacked?
5) If it's a ranged attacker, does it run out and attack them?
6) If it runs out to fight, how far away does the target have to be before the familiar stops running out to fight and returns to your side?
I've got a working beta of new Familiar AI workings at https://github.com/ServUO/ServUO/pull/1889
Any testing and confirmation of OSI Fidelity would be appreciated.
Familiar AI Fix/Revamp #1889
This pull is designed to clear out and streamline the kludge that is Familiar AI.
Before being merged to master, this pull should definitely be tested, preferably have confirmation in OSI behavior fidelity, and any necessary refinement to correct if either of the previous two have issues.
-Fixes bug that usually cause familiar to be unable to work properly for the Dark Tides quest. (Though the AI rarely takes a bit to get around the wall)
-Familiars ONLY attack their master's current combatant.
-Familiars ONLY attack creatures within RangeHome (default 10) of master.
--Sanity Check: If master is attacking familiar, or vise-versa, set attacker's combatant to null. (Masters don't attack their familiars, familiars don't attack their masters)
-No support for Archer/Mage familiars. (all familiars are Melee)
-While not attacking, familiars follow their master.
-Familiars teleport to their master if they're on another map.
-Familiars teleport nearer to their master if they're more than RangePerception (default 16) apart.
BaseCreature.cs: Familiar AI Fix/Revamp
-Added Aggro, Heel, and Fetch order types
-Added checks to use familiar orders instead of normal pet orders for BaseFamiliars
Objectives.cs: Familiar AI Fix/Revamp
-Added AI pointer to use DoOrderFetch, so it will no longer check for this quest unless specifically told to.
BaseFamiliar.cs: Familiar AI Fix/Revamp
-Gutted OnThink() and associated code, handled in BaseAI.cs completely now.
--Note that it is still needed to nullify any 'default' behavior from OnThink(), which is also overridden in individual familiars for their special abilities
BaseAI.cs: Familiar AI Fix/Revamp
-Added framework for Orders Aggro, Heel, and Fetch.
--Normal pets will not use these Orders, as they are not usable via speech command, only by being set directly by code/admin. Admin messing with creature ControlOrder could (at least temporarily?) bork the AI and make it behave erratically.
--Familiars should behave as per the BaseFamiliar.OnThink() code, and the Attack/Come/Follow Orders were disregarded.
--Note that while Aggro and Heel are pretty much stubs calling the same module, they may not always be, and they get different settings from OnOrderChanged().
--Fetch is only ever set by the Dark Tides quest to get the scroll of Abraxus. It's use in a switch means it should get checked only the rare times the order defaults or when the quest sets it.
---Fetch code for Scroll of Abraxus quest is no longer in CheckHerding().
---Horde Familiar should no longer bug out and fail when he's supposed to grab the scroll, though rarely he's stupid and takes a while to get around the wall to the goal.
-Familiars teleport to their master if they are ever on different maps.
-Familiars are NOT deleted if their master is dead.
-Familiars teleport nearer to their master if they are ever beyond RangePerception distance from master
-Familiars will only attack creatures within RangeHome distance of their master (default 10)
-Familiars will only attack their master's combatant
--Sanity check: If a player is attacking their familiar, or vise versa, the attacker's combatant will be set to null. (masters don't fight their familiar, familiars don't fight their master)
--They WILL in fact, attack the master's hostile most recent spell target or when master is attacked if it has no combatant. (Both of these set the creature to tthe master's combatant, along with double-clicking a target while in war mode)
--If you flash war mode off, it clears your combatant. The familiar will attack nothing, unless the master gets a new combatant.
--All (controlled) familiar combat is controlled here, and does not use the normal AI combat functions.
--Because all familiars are Melee, no Mage/Archer support was added for familiar combat. If desired it would have to be coded separately.