Register for your free account! | Forgot your password?

You last visited: Today at 10:56

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Guide\Release]Guards attack mobs

Discussion on [Guide\Release]Guards attack mobs within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
[Guide\Release]Guards attack mobs

Guards attack Blue-Name players on just about every server, but other than my server I have only seen one or two where the guards attack other mobs. So Here is what you have to do to make guards attack mobs:

Note: if you cannot find part of what I have you search for, you are probably using a suckier and much more out-of-date source... or you are using a newer "better" source like Future\Reloaded.. My original source was ShadowCo, though it is much more updated now, and I suggest starting with this. It is very stable, and once you get used to it, easy to navigate.

First go into your Entities.cs file and find
Code:
public void TimerElapsed(object source, ElapsedEventArgs e)
{
In that block you will find:
Code:
            if (Target != null)
                Move();
(if you have a server with moving mobs, if not.. You'll need to write in a Move() Function, CharNearest() function, and a MobUseSkill() Function.. Come back when you have done this. (You can write some of that based on what you'll be adding)

Here in this release\guide I would like to note: this is not the best way to do this, I split it up and made it longer and less efficient to make it simpler for idiots to do. Now we continue:

replace the afformentioned code with:
Code:
if (Target != null)
            {
                Move();
            }
            else if (MType == 1)
            {
                Tgt = Other.MobNearest((uint)PosX, (uint)PosY, (uint)Map);
                if (Tgt != null && Tgt.Alive == true && Tgt.MType != 1 && MyMath.PointDistance(PosX, PosY, Tgt.PosX, Tgt.PosY) <= 10)
                    Move2();
            }
now scroll up to
Code:
    public class SingleMob
    {
        public short PosX;
        public short PosY;
scroll down a bit till you find

Code:
        Character Target = null;
and replace it with
Code:
        Character Target = null;
        SingleMob Tgt = null;
Now find your Move() Function and go right under it (after the Move() block is closed off completely (}))

and add this function

Code:
        public void Move2()
        {
            LastMove = DateTime.Now;

                int DMG = General.Rand.Next(Convert.ToInt32(MinAtk), Convert.ToInt32(MaxAtk));

                if (DMG < 1)
                    DMG = 1;

                DMG *= 5;

                Tgt.GetDamage((uint)DMG);
                foreach (DictionaryEntry DE in World.AllChars)
                {
                    Character Charr = (Character)DE.Value;

                    if (Charr.MyClient.Online)
                        if (MyMath.CanSeeBig(PosX, PosY, Charr.LocX, Charr.LocY))
                        {
                            Charr.MyClient.SendPacket(General.MyPackets.MobSkillUse2(this, Tgt, (uint)DMG, 1320, 2));
                        }
                }
                    Tgt = null;
        }
Almost done.

Next, go to Packets.cs and find
Code:
        public byte[] MobSkillUse(SingleMob Mob, Character Attacked, uint DMG, ushort SkillId, byte SkillLevel)
        {
after that block is closed off (}) add the following:

Code:
public byte[] MobSkillUse2(SingleMob Mob, SingleMob Attacked, uint DMG, ushort SkillId, byte SkillLevel)
        {
            ushort PacketType = 1105;
            byte[] Packet = new byte[32];

            fixed (byte* p = Packet)
            {
                *((ushort*)p) = (ushort)Packet.Length;
                *((ushort*)(p + 2)) = (ushort)PacketType;
                *((uint*)(p + 4)) = (uint)Mob.UID;
                *((ushort*)(p + 8)) = (ushort)Attacked.PosX;
                *((ushort*)(p + 10)) = (ushort)Attacked.PosY;
                *((ushort*)(p + 12)) = (ushort)SkillId;
                *((ushort*)(p + 14)) = (ushort)SkillLevel;
                *(p + 16) = 1;
                *((uint*)(p + 20)) = (uint)Attacked.UID;
                *((uint*)(p + 24)) = (uint)DMG;
            }
            return Packet;
        }
Next! go to your Other.cs file, and find

Code:
        public static Character CharNearest(uint X, uint Y, uint Map, bool Blue)
        {
after THAT block is closed of (})

add:
Code:
        public static SingleMob MobNearest(uint X, uint Y, uint Map)
        {
            try
            {
                int ShortestDist = 30;
                SingleMob NearestMob = null;
                foreach (DictionaryEntry DE in Mobs.AllMobs)
                {
                    SingleMob MOB = (SingleMob)DE.Value;
                    if (MyMath.PointDistance(X, Y, MOB.PosX, MOB.PosY) < ShortestDist && MOB.MType != 1 && MOB.Alive && MOB.Map == Map)
                    {
                        NearestMob = MOB;
                        ShortestDist = MyMath.PointDistance(X, Y, MOB.PosX, MOB.PosY);
                    }
                }
                return NearestMob;
            }
            catch (Exception Exc) { General.WriteLine(Exc.ToString()); return null; }
        }

And that's it! Recompile and restart your server and attract some Mobs to your gaurd!

optional: if you add a value to SingleMob.GetDamage() for enabling\disabling drops you can make guard-killed Mobs not drop items.

P.S:

at the end of your public bool GetDamage(uint Damage) { block for your single mobs you may want to change
Code:
                return true;
to
Code:
                this.Death = DateTime.Now;
                World.MobDissappear(this);
                return true;
just the sake of making sure whenever a mob dies, it actually falls over and dies, instead of standing there and fading away in place
Rechocto is offline  
Thanks
24 Users
Old 09/16/2008, 13:12   #2
 
elite*gold: 0
Join Date: Jun 2007
Posts: 323
Received Thanks: 30
Er.. Nice job..
Zanzibar is offline  
Old 09/16/2008, 13:17   #3
 
elite*gold: 0
Join Date: Aug 2006
Posts: 227
Received Thanks: 57
ty dude i was workingon it but now ty


keving is offline  
Old 09/16/2008, 13:21   #4
 
elite*gold: 0
Join Date: Jun 2007
Posts: 323
Received Thanks: 30
Uh.. This takes up a lot of memory lawl
Zanzibar is offline  
Old 09/16/2008, 13:31   #5
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
Quote:
Originally Posted by keving View Post
ty dude i was workingon it but no ty

:hands down:
Use the *thanks button


Quote:
Originally Posted by Zanzibar View Post
Uh.. This takes up a lot of memory lol
I mentioned it wasn't the most efficient way, just the easiest for people to look at and understand what it's doing :P (hopefully noobs wont just copy-paste, but actually try to learn from the script)
Rechocto is offline  
Thanks
2 Users
Old 09/16/2008, 13:37   #6
 
elite*gold: 0
Join Date: Jun 2007
Posts: 323
Received Thanks: 30
I sed lawl not lol >_<
Zanzibar is offline  
Old 09/16/2008, 13:39   #7
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
Quote:
Originally Posted by Zanzibar View Post
I used lol not lol >_<
I'm just correcting your pronunciation.. "ol" as in "Sol", the name of our sun, or "old", or "Toll", etc.. you sound like you were dropped on your head saying it like you are doing
Rechocto is offline  
Old 09/16/2008, 14:22   #8
 
elite*gold: 0
Join Date: Aug 2006
Posts: 227
Received Thanks: 57
@Rechocto: Pls add me at MSN:
keving is offline  
Old 09/16/2008, 21:54   #9
 
elite*gold: 0
Join Date: Jun 2007
Posts: 323
Received Thanks: 30
Quote:
Originally Posted by Rechocto View Post
I'm just correcting your pronunciation.. "ol" as in "Sol", the name of our sun, or "old", or "Toll", etc.. you sound like you were dropped on your head saying it like you are doing
What if I was dropped on my head...
Zanzibar is offline  
Old 09/16/2008, 22:21   #10
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
special fred... momma dropped him, on his head.. now he's not so, bright--instead, he's just a little bit special


okay enough singing
Rechocto is offline  
Old 09/17/2008, 01:04   #11
 
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
Quote:
Originally Posted by Rechocto View Post
special fred... momma dropped him, on his head.. now he's not so, bright--instead, he's just a little bit special


okay enough singing
This is no pronunciation of "lol", you can pronounce it however you feel.

LAWLZ KAI.
tao4229 is offline  
Old 09/17/2008, 01:09   #12
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
Dang-it Tao, you used to be cool =o
Rechocto is offline  
Old 09/17/2008, 10:17   #13
 
elite*gold: 0
Join Date: Aug 2008
Posts: 77
Received Thanks: 63
Thumbs up

Thanks
Thanks Thanks
Thanks Thanks Thanks
--Thanks Thanks Thanks Thanks--
Thanks Thanks Thanks
Thanks Thanks
Thanks
konkizta is offline  
Old 09/17/2008, 15:25   #14
 
elite*gold: 0
Join Date: Feb 2008
Posts: 668
Received Thanks: 160
Cool ! Thank you very much, ... Btw.. .You know how to let an Guard move back to his Spawning place? Like when you are blue name and Out of range, They will folow you...
YukiXian is offline  
Old 09/17/2008, 15:48   #15
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
you could either disable following, or add to Move() "If(Target == null && MType == 1 && (PosX != StartX || PosY != StartY)) { PosX = StartX; PosY = StartY; World.SurroundMobs(this); World.SpawnMobForPlayers(this, true); }"

or something
Rechocto is offline  
Reply


Similar Threads Similar Threads
[Guide]Small Guide on how to change the name of Guards and Patrols
07/07/2009 - CO2 PServer Guides & Releases - 5 Replies
How to change the name of CoEmuGuard and CoEmuPatrol to what you want! Also GuardReviver if you want (Same thing as Guard and Patrol) Things we will change... Navicat: Monster Monsters
[Help]Guards attack Mobs & Mobs Drop for CoemuV2
07/04/2009 - CO2 Private Server - 0 Replies
Can any help me to make that guards attacks mobs and how can i change the drop rate in CoemuV2
[Release] Backup.SQL From Projekt-X Source For Stigma Guards And Other Mobs!
09/29/2008 - CO2 Private Server - 4 Replies
BACKUP.SQL FROM THE PROJEKT-X SOURCE FOR THE STIGMA GUARDS! RapidShare: Easy Filehosting
[TUT]No Mobs Cant Attack You
08/23/2008 - RFO Hacks, Bots, Cheats, Exploits & Guides - 53 Replies
this is not a quote. This works more well on mage's 1.Open CE 2.Search your name using text 3.Scan, then Find E9 D6, you can find them on with the FF FF adress XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX



All times are GMT +1. The time now is 10:56.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.