faves

Initiate
I wrote a section of code, want to change the AI of the pet, but is invalid, who can help me,thanks a lot.


As if this code has no effect:
-------------------------------------------------
switch (info.ButtonID)
{
case 0:
{
if (ct.Controlled)
{
ct.ChangeAIType(AIType.AI_NecroMage);
from.SendMessage("changeAI to Necromancy!");
}
break;
}
 

Attachments

  • changeAi.cs
    4.6 KB · Views: 7
If you got the sendmessage, then look in basecreature.ChangeAIType if AI_NecroMage is listed in the switch.

If it is, look at targeted creature, if its ForcedAI is defined.
 
My pet is not define ForcedAI,defaultAI is NinjaAI,
I use [props to see pet‘s AI,it still shows the original AI,but in fact work normal,It is indeed in the use of AI_NecroMage,
It's very strange.
And thank you for your reply.
 
My pet is not define ForcedAI,defaultAI is NinjaAI,
I use [props to see pet‘s AI,it still shows the original AI,but in fact work normal,It is indeed in the use of AI_NecroMage,
It's very strange.
And thank you for your reply.
If I recall, NecroMage AI was added, but as a custom AI and it does need some ironing out. It was based off the regular Mage AI.
 
If use NecroMage AI ,it seems to need high necromancy and spiritspeak skill for cast Necromany spell,
 
Code:
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;
          
            switch (info.ButtonID)
            {
                case 0:
                    {
                        from.SendMessage("Test");
                        break;
                    }
                case 10:
                    {
                        if (ct.Controlled&& ct.ControlMaster == from && ct.Skills.Necromancy.Value>=50)
                        {
                            ct.ChangeAIType(AIType.AI_NecroMage);
                            from.SendMessage("{0} changeAI to Necromancy!", ct.Name);
                        }
                        else from.SendMessage("{0}'s Necromancy Skill value is too low ! AI will not change.", ct.Name);
                        break;
                    }
 
If use NecroMage AI ,it seems to need high necromancy and spiritspeak skill for cast Necromany spell,
Yes. Anytime you switch to a casting AI (or any AI that relies on specific skills) it will require at least GM skill in order to be utilized.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back