I have been messing around with writing a new AI for my shard. The AI script itself throws no errors but when I try to make a mob use the AI it says it doesn't exist. It is most likely something small that I missed but if I had hair I'd rip it out at this point. Is there another file I must change for another AI to work? I am kind of new to scripting but I have figured a lot out but this AI system really messes with me.
 
Can you tell us what files you've modified so far and post what errors your console is showing? Please.

youraifile.cs

BaseAI.cs (...Scripts\Mobiles\AI)
Add your ai to the enum near the top
Code:
...
AI_OmniAI,
AI_YourCustomAI //Your Custom  AI
}

BaseCreature.cs (...\Scripts\Mobiles)
in the method: public void ChangeAIType(AIType NewAI)
Add your AI to the bottom of the : switch (NewAI)
Code:
...
case AIType.AI_Spellbinder:
           m_AI = new SpellbinderAI(this);
           break;
//Your custom AI
         case AIType.AI_YourCustomAI:
           m_AI = new YourCustomAI(this);
           break;
       }
     }
 
Last edited:
I took a NecroAi file that was already working on my shard and modified it to a spellweaving AI. I added using Server.Spells.Spellweaving; to the top of the file also.

The error I am getting is error1.jpg

I'm just doing this to see if I can write a better one but I don't want to waste the time if I can't get a basic one working.
 
Code:
         case AIType.AI_YourCustomAI:
           m_AI = new YourCustomAI(this);

in youraifile.cs it should appear like this
Code:
  public class YourCustomAI : BaseAI
and be sure to have using Server.Spells.Spellweaving; at the top of the script.

It might help if you post the section of your ai script that is throwing this error.
 
I'm so sorry Hank I didn't read your first message correctly. I was reading it on my phone and didn't see the pics. It's working perfectly. Your the man.
 
also if you can point me towards the forum to explain how you post your code it might help when people ask me to post code again
 
Back