PigPen

Member
First . . sorry . . I have tried several searches but either my topic is not hear or I am not using correct search criteria.

I am trying to create a custom monster that will switch from one AI to another AI depending on the status (level) of their Hits or Mana.

Has anyone tried this?
Is this possible or is the AI unchangeable after spawning?

I am using RunUO version 2.1

Any help (or pointing in the right direction) would be appreciated.

Many Thanks
 
There was an AI system that was called MainAI that was meant to be used like an overarching AI, so a mobile could have many AIs.
I have it and was going to implement it at some point... let me know and ill upload for you to play with.
 
Sorry . . here is a sample of what I tried inside the Monster's Script.

Code:
//*********************************************
// AI switch after Hits below 200
//*********************************************

        public virtual void AlterSpellDamageFrom(Mobile from, ref int damage)
        {

        if (Hits <= 200)
        {
            if ( AI != AIType.AI_Mage )
            {
                        AI = AIType.AI_Mage; 
                        Say("I am now a Mage! "); //for Testing

            }
            Mana = ManaMax;
        }

        else if (Hits >= 201)
        {
            if (AI != AIType.AI_Melee)
            {
                AI = AIType.AI_Melee; 
                Say("I am now a Melee! "); //for Testing
            }
        }

        }
Post automatically merged:

Hi FinalTwist . . That might be very helpful
 
It was called OmniAI, used in servuo at some point too from what i can see. I can't seem to find it in resources so ill add it.

just uploaded it.
 
So if I am understanding . . . the answer might be found (not in the creature's script) but by creating a new AI which acts differently (like a AI_Mage or a AI_NecroMage or a AI_Melee) depending on the creatures Hits and/or Mana.

Interesting . . Am I on the right track?

Thanks
 
yeah, you wouldn't be changing the AI, the AI would be omniAI, but the AI would act differently based on the circumstances (magery, or melee).
by using the onthink, etc.
 
You can switch the AI on the fly too. Like you (err, Finaltwist) said, you override the onthink

Code:
        public override void OnThink()
        {
     -- your conditional statements here that change the AI type --

            base.OnThink();
        }

ending with "base.OnThink();" just to make sure nothing else gets skipped.

Your logic looks ok. You just need it to be executed at the right time.
 
Glad to hear! Be sure to give the mob enough skill in magery, wrestling, and related skills so they will be effective in both kinds of combat.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back