Item "Bomb" Help

06/27/2014 00:36 perfect0#1
how can I make the item Bomb operate only near the gate and take only half the life of the gate

Here the code I use!

Code:
#region Bomb
                case 3003499:
                    {






                        if (client.Entity.MapID == 1038 && DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
                        {
                            foreach (GameState Player in Kernel.GamePool.Values)
                            {
                                if (Player.Entity.MapID == 1038 && (!Player.Entity.Dead))
                                Argentina.Game.ConquerStructures.Society.GuildWar.LeftGate.Mesh = (ushort)(250 + Argentina.Game.ConquerStructures.Society.GuildWar.LeftGate.Mesh % 10);
                                client.Entity.Die(0);
                                _String str = new _String(true);
                                str.UID = client.Entity.UID;
                                str.TextsCount = 1;
                                str.Type = _String.Effect;
                                str.Texts.Add("bombarrow");
                                str.Texts.Add("bombarrow3");
                                client.Entity.SendScreen(str);
                                Update upd = new Update(true);
                                upd.UID = Argentina.Game.ConquerStructures.Society.GuildWar.LeftGate.UID;
                                upd.Append(Update.Mesh, Argentina.Game.ConquerStructures.Society.GuildWar.LeftGate.Mesh);
                                client.SendScreen(upd, true);
                                Argentina.Kernel.SendWorldMessage(new Network.GamePackets.Message("BOOOOM#58 O Player :" + client.Entity.Name + ". Destruiu o 1Gate da GW...Com a bomba#58", System.Drawing.Color.White, Network.GamePackets.Message.Center), Program.GamePool);
                                client.Inventory.Remove(item, Argentina.Game.Enums.ItemUse.Remove);
                                break;
                                    
                        }
                    }
                }
                     break;
            
           
                                        #endregion Bomb
06/27/2014 02:26 InsomniacPro#2
Why are you doing a foreach loop for EVERY character in the server. Why not just the ones within the character using the bomb's screen?
06/27/2014 03:58 Aceking#3
I agree with Insomniac, thats alot of extra processing time being wasted.
Hell I bet a bunch of players could spam bombs away from the gate and be able to slow your server down at least a fraction. Plus I am sure this isn't the only case of something similar happening.

Regardless, the string effects for the guild bomb is firemagic followed by bombarrow.
Code:
Packet Nr 47. Server -> Client, Length : 30, PacketType: 1015
16 00 F7 03 1B 43 E6 00 0A 01 09 66 69 72 65 6D      ; ÷Cæ 
	firem
61 67 69 63 00 00 54 51 53 65 72 76 65 72            ;agic  TQServer


Packet Nr 48. Server -> Client, Length : 30, PacketType: 1015
16 00 F7 03 1B 43 E6 00 0A 01 09 62 6F 6D 62 61      ; ÷Cæ 
	bomba
72 72 6F 77 00 00 54 51 53 65 72 76 65 72            ;rrow  TQServer
Also looks like your code is killing the gate with 1 bomb use.

You have a couple options.
Best option is to probably pull both gates and check the user is within say 5 co ords?

Or you can hardcode a distance check in. Say for example the clients X co ord has to be between 50-60 and the y between 100-110. (Whatever the range is for one gate).
Not the greatest option and I wouldn't recommend it.

Then if that check passes, I assume you have some kind of damage method?
entity.receiveDmg(dmg, attacker) <- Something like that.
Well you would set the damage to be half the gates max health. (Why am I thinking it always took 4 bombs? God I haven't played live CO in so long).
And then your receive damage method should take over from there and kill the gate if its dead and open it up etc.

If your asking for us to code it for you, aint gonna happen.