Request Give Skelly pet AOE attack?

smoochy boys on tour

Destroyer1987

Racoon
Dedicated Member
Feb 15, 2013
80
9
35
In The Shadows
hello,

been trying myself for awhile and looked over forum (sorry if been resolved before)

my question is how do you give tao pet skelly an aoe attack?

allso to allow 2 pets to be summoned ie 2 skellys

thanks in advance for any help
 
Last edited:

chaosdeath

LOMCN Veteran
Veteran
Mar 22, 2012
1,237
11
100
Newport, UK
https://imgflip.com/i/1xgwh2

---------- Post Merged at 07:45 PM ---------- Previous Post was at 08:04 AM ----------

Small David I was not actually hating the guy . But I take it that every one sees things how they wish to see it. As his question clearly stated how do you give skelly an aoe attack

My answer was one does not just give skelly an aoe attack .... but hey like I said each to their own ... although it would be nice to just give attacks to mobs pets etc rather than sit and code it then test etc
 

Violent

Drinker Of Tea
Golden Oldie
Oct 7, 2008
1,071
201
170
Sheffield, UK
Here is something that will get you started. This is very basic and may need tweaking. There is also no magic animation so it will perform like CHM but you wont see the CHM animation. (Graphics is not my strong point.)

Go to BoneFamiliar.cs

Add the following functions:

Code:
        protected override void CompleteAttack(IList<object> data)
        {
            //If Skele is a pet then it will do an AOE attack.
            if (Master != null)
            {
                AoeAttack();
            }
        }

Code:
        /// <summary>
        /// JS - Attack all targets 1 space away from Skele.
        /// </summary>
        private void AoeAttack()
        {
            int damage = 0;
            
            //Get the damage based on the skele's DC
            damage = GetAttackPower(MinDC, MaxDC);


            if (damage == 0) return;


            //Loop round the cells around the skele to check for targets and do damage to them.
            for (int i = 0; i < 8; i++)
            {
                Point target = Functions.PointMove(CurrentLocation, Direction, 1);
                Direction = Functions.NextDir(Direction);


                if (Target != null && target == Target.CurrentLocation)
                    Target.Attacked(this, damage, DefenceType.AC);
                else
                {
                    if (!CurrentMap.ValidPoint(target)) continue;


                    Cell cell = CurrentMap.GetCell(target);
                    if (cell.Objects == null) continue;


                    for (int o = 0; o < cell.Objects.Count; o++)
                    {
                        MapObject ob = cell.Objects[o];
                        if (ob.Race == ObjectType.Monster || ob.Race == ObjectType.Player)
                        {
                            if (!ob.IsAttackTarget(this)) continue;


                            ob.Attacked(this, damage, DefenceType.AC);
                        }
                        else continue;


                        break;
                    }
                }
            }
        }

That should get you started. Or at least give you some idea how to add new attacks to current monsters (without the graphics).
 

TheDayIDie

Banned
Banned
Dedicated Member
Jul 29, 2011
4,071
97
135
UK
He didn't specify the files he is using so I didn't bother replying.

If he is using crystal then do what the two above have specified. Edit the BoneFamiliar.cs to include it or change the mon ai to a different number for BoneFamiliar in your database.

P.s. OmaKing has an attack that hits everything around it.
 

Destroyer1987

Racoon
Dedicated Member
Feb 15, 2013
80
9
35
In The Shadows
thanks Violent i will try that now. Im using crystal m2 sorry i forgot to say that. i like the idea of CHM attack also the omaking.

Im just after a way for skelly to be more helpfull to a tao for leveling.

Also is it possible to change from 1 skelly to 2 skellys summoned?

Again sorry if this has been explained before, trying to learn as much as i can.

Violent : Rep Given, thank you.
 
Last edited:

Destroyer1987

Racoon
Dedicated Member
Feb 15, 2013
80
9
35
In The Shadows
My bonfamiliar.cs files looks like this,

//If Skele is a pet then it will do an AOE attack.
if (Master != null)
{
AoeAttack();
}
}


/// <summary>
/// JS - Attack all targets 1 space away from Skele.
/// </summary>
private void AoeAttack()
{
int damage = 0;

//Get the damage based on the skele's DC
damage = GetAttackPower(MinDC, MaxDC);




if (damage == 0) return;




//Loop round the cells around the skele to check for targets and do damage to them.
for (int i = 0; i < 8; i++)
{
Point target = Functions.PointMove(CurrentLocation, Direction, 1);
Direction = Functions.NextDir(Direction);




if (Target != null && target == Target.CurrentLocation)
Target.Attacked(this, damage, DefenceType.AC);
else
{
if (!CurrentMap.ValidPoint(target)) continue;




Cell cell = CurrentMap.GetCell(target);
if (cell.Objects == null) continue;




for (int o = 0; o < cell.Objects.Count; o++)
{
MapObject ob = cell.Objects[o];
if (ob.Race == ObjectType.Monster || ob.Race == ObjectType.Player)
{
if (!ob.IsAttackTarget(this)) continue;




ob.Attacked(this, damage, DefenceType.AC);
}
else continue;




break;
}
}
}
}


is this correct? again i am sorry if ive done it wrong, all new to me but interesting enough to want to try and learn.
 

Violent

Drinker Of Tea
Golden Oldie
Oct 7, 2008
1,071
201
170
Sheffield, UK
The first part needs to be in an override function like this:

Code:
protected override void CompleteAttack(IList<object> data)
        {
            //If Skele is a pet then it will do an AOE attack.
            if (Master != null)
            {
                AoeAttack();
            }
        }

Don't about asking questions if you are unsure. Genuine developers don't mind helping people out.
 

Destroyer1987

Racoon
Dedicated Member
Feb 15, 2013
80
9
35
In The Shadows
This is now the folder,

protected override void CompleteAttack(IList<object> data)
{
//If Skele is a pet then it will do an AOE attack.
if (Master != null)
{
AoeAttack();
}

/// <summary>
/// JS - Attack all targets 1 space away from Skele.
/// </summary>
private void AoeAttack()
{
int damage = 0;

//Get the damage based on the skele's DC
damage = GetAttackPower(MinDC, MaxDC);




if (damage == 0) return;




//Loop round the cells around the skele to check for targets and do damage to them.
for (int i = 0; i < 8; i++)
{
Point target = Functions.PointMove(CurrentLocation, Direction, 1);
Direction = Functions.NextDir(Direction);




if (Target != null && target == Target.CurrentLocation)
Target.Attacked(this, damage, DefenceType.AC);
else
{
if (!CurrentMap.ValidPoint(target)) continue;




Cell cell = CurrentMap.GetCell(target);
if (cell.Objects == null) continue;




for (int o = 0; o < cell.Objects.Count; o++)
{
MapObject ob = cell.Objects[o];
if (ob.Race == ObjectType.Monster || ob.Race == ObjectType.Player)
{
if (!ob.IsAttackTarget(this)) continue;




ob.Attacked(this, damage, DefenceType.AC);
}
else continue;




break;
}
}
}
}

Do i have to input the spell into the code? Again really appreciate the time and help, hopefully once i have one working i can do more myself.
 

chaosdeath

LOMCN Veteran
Veteran
Mar 22, 2012
1,237
11
100
Newport, UK
Word of advice try everything in your power once coded to make sure it does not cause a crash. There was an incident regarding the deathcrawler and it’s poisoning that if a player died or teleported away as the death crawler died it crashed the server , due to its death poison... IE no one to poison in the area so the code caused a crash as it was looking for a player to poison.

So although it may work think of all the variables that a player could potentially be in that may cause an issue code wise. Otherwise you will end up pulling your hair out looking for the reason the server crashed.

NOT ALL ISSUE CAUSE SERVER CRASHES... check and make sure you do not have an error report due to the new skelly AI
 
Last edited:

Far

tsniffer
Staff member
Developer
May 19, 2003
20,166
30
2,763
540
Mir2 chat section, not Crystal Help section ^.

Please use code tags [ code ] xyz [ /code ] when pasting code.
 

Destroyer1987

Racoon
Dedicated Member
Feb 15, 2013
80
9
35
In The Shadows
Added but wont allow skelly to use CHM attack, will look later what ive done wrong.

Far sorry wasn't sure if code is different for Crystal Server, Will use that section from now on. Do not understand what you said tho about
Code:
 

Violent

Drinker Of Tea
Golden Oldie
Oct 7, 2008
1,071
201
170
Sheffield, UK
Word of advice try everything in your power once coded to make sure it does not cause a crash. There was an incident regarding the deathcrawler and it’s poisoning that if a player died or teleported away as the death crawler died it crashed the server , due to its death poison... IE no one to poison in the area so the code caused a crash as it was looking for a player to poison.

So although it may work think of all the variables that a player could potentially be in that may cause an issue code wise. Otherwise you will end up pulling your hair out looking for the reason the server crashed.

NOT ALL ISSUE CAUSE SERVER CRASHES... check and make sure you do not have an error report due to the new skelly AI

That goes without saying. No code is perfect and the code i provided was a basic example of one of the ways it can be done. However there are null checks in the code and about 80% of server crashes are caused by null objects (From my experience anyway).
 

bayside12

LOMCN Member
Feb 5, 2018
129
0
27
when i try and use this code and go to build i keep getting these two error codes :


Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'Cell' could not be found (are you missing a using directive or an assembly reference?) Server C:\Users\edward\Desktop\mir3server\Server Tools\mir2-master\Server\MirObjects\Monsters\BoneFamiliar.cs 85 Active

Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'Point' could not be found (are you missing a using directive or an assembly reference?) Server C:\Users\edward\Desktop\mir3server\Server Tools\mir2-master\Server\MirObjects\Monsters\BoneFamiliar.cs 74 Active


any idea sorry im new to all this coding.

thanks