Help Needed Script,

02/19/2010 23:04 -Shunsui-#1
What is Wrong with this, Idk Why but the Bless Effect Does not Seem to be Going Off,

Code:
using System;
using System.Collections.Generic;
using System.Text;

namespace NewestCOServer.Extra
{
    public class BlessEffect
    {
        public static void Handler(Main.GameClient GC)
        {
            byte bless1 = 0;
            byte bless3 = 0;
            byte bless5 = 0;
            byte bless7 = 0;
            for (byte i = 1; i < 12; i++)
            {
                if (i != 7)
                {
                    Game.Item I = (Game.Item)GC.MyChar.Equips.Get(i);
                    if (I.Bless == 1)
                        bless1++;
                    if (I.Bless == 3)
                        bless3++;
                    if (I.Bless == 5)
                        bless5++;
                    if (I.Bless == 7)
                        bless7++;
                }
            }
            #region Check for bless 7
            if (bless7 > bless5 && bless7 > bless3 && bless7 > bless1)
            {
                GC.AddSend(Packets.String(GC.MyChar.EntityID, 10, "aegis4"));
                goto end;
            }
            #endregion
            #region Check for bless 5
            else if (bless5 > bless7 && bless5 > bless3 && bless5 > bless1)
            {
                GC.AddSend(Packets.String(GC.MyChar.EntityID, 10, "aegis3"));
                goto end;
            }
            #endregion
            #region Check for bless 3
            else if (bless3 > bless7 && bless3 > bless5 && bless3 > bless1)
            {
                GC.AddSend(Packets.String(GC.MyChar.EntityID, 10, "aegis2"));
                goto end;
            }
            #endregion
            #region Check for bless 1
            else if (bless1 > bless7 && bless1 > bless5 && bless1 > bless3)
            {
                GC.AddSend(Packets.String(GC.MyChar.EntityID, 10, "aegis1"));
                goto end;
            }
            #endregion
        end:
           Console.WriteLine("This");
           return;
        }
    }
}
02/19/2010 23:08 KraHen#2
Try it like this :

else if ((bless1 > bless7) && (bless1 > bless5) && (bless1 > bless3))


And I don`t see why you`re adding that 'goto end' part, since only one of the if statements is going to be true.
02/19/2010 23:15 Arcо#3
There's no MyMath.ChanceSuccess. So the source doesn't know how often for the effect to appear.
02/19/2010 23:19 KraHen#4
Just a question, when you send an effect, do you send it so the effect will loop or just play it one single time?
02/19/2010 23:22 -Shunsui-#5
@ElDeRnEcRo
Still Dosent Seem to do anything, the first post u did

Play it one single time because i want to see if iam going the right way, So i wanted to see if the Effects WOrk, Thats the Whole Point of that Script So then i can move on to Fixing it better,

@Arco, I Thod with out a ChanceSucces, It would Just Happen Eavery Time, I WilL Try Adding 1
02/19/2010 23:29 -Shunsui-#6
Added, if (MyMath.ChanceSuccess(15))

Before Game.Item I =

Still Nothing,
02/19/2010 23:31 Arcо#7
I look at your code and all its doing is checking for the bless and then sending the effect.
Shouldn't you be putting something in the attack.cs as well so when your char gets attacked the effect comes up.
02/19/2010 23:36 -Shunsui-#8
Quote:
Originally Posted by .Arco View Post
I look at your code and all its doing is checking for the bless and then sending the effect.
Shouldn't you be putting something in the attack.cs as well so when your char gets attacked the effect comes up.
I Did In GetAttack, Also When Hes Attacking,

This is in Attack.cs
Extra.BlessEffect.Handler(GC);

This is In Character.cs in TakeAttack Void
Extra.BlessEffect.Handler(MyClient);

And Again in TakeAttack( Mob Void
Extra.BlessEffect.Handler(MyClient);

And in 1 more Spot for Attacking,
02/19/2010 23:36 KraHen#9
How are you using the Handle() void? Please show us it`s use! The whole part please if possible :P
02/19/2010 23:40 -Shunsui-#10
Quote:
Originally Posted by ElDeRnEcRo View Post
How are you using the Handle() void? Please show us it`s use! The whole part please if possible :P
What do You Exactly Mean When Geting Attacking/Or Hes Attacking, Should Activate

Code:
public static void Handler(Main.GameClient GC)
In BlessEffect.cs
02/19/2010 23:49 KraHen#11
I mean where do you put the void in use, like

//xy codes;
Handler(xy2);
// xy3 codes;
02/20/2010 00:28 -Shunsui-#12
Quote:
Originally Posted by ElDeRnEcRo View Post
I mean where do you put the void in use, like

//xy codes;
Handler(xy2);
// xy3 codes;
When player is attacking or getting attacked
02/20/2010 00:30 Arcо#13
Quote:
Originally Posted by -Shunsui- View Post
When player is attacking or getting attacked
Paste the entire code here.
02/20/2010 00:32 -Shunsui-#14
Quote:
Originally Posted by .Arco View Post
Paste the entire code here.
This is in Attack.cs

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NewestCOServer.PacketHandling
{
    public class Attack
    {
        public static void Handle(Main.GameClient GC, byte[] Data)
        {
            try
            {
                [COLOR="Red"]Extra.BlessEffect.Handler(GC);[/COLOR]
                Extra.Durability.AttackDurability(GC);
                uint AttackType = BitConverter.ToUInt32(Data, 20);
                if (AttackType != 24)
                    GC.MyChar.AtkMem.AtkType = (byte)AttackType;
                GC.MyChar.Action = 100;

                if (!GC.MyChar.Alive) return;

                for (byte i = 1; i <= 12; i++)
                {
                    Game.Item I = GC.MyChar.Equips.Get(i);
                    if (I.ID != 0 && I.Soc1 != Game.Item.Gem.EmptySocket)
                        Features.GemEffect.GemEffects(I.Soc1, GC);
                    if (I.ID != 0 && I.Soc2 != Game.Item.Gem.EmptySocket)
                        Features.GemEffect.GemEffects(I.Soc2, GC);
                }
Part of TakeAttack Void

Code:
public void TakeAttack(Mob Attacker, uint Damage, AttackType AT)
        {
            if (Damage != 0)
            {
                [COLOR="red"]Extra.BlessEffect.Handler(MyClient);[/COLOR]
                Extra.Durability.DefenceDurability(MyClient);
                if (Protection) Damage = 0;
                if (BuffOf(SkillsClass.ExtraEffect.Scapegoat).Eff == SkillsClass.ExtraEffect.Scapegoat && MyMath.ChanceSuccess(30))
                {
                    Buff B = BuffOf(SkillsClass.ExtraEffect.Scapegoat);
                    RemoveBuff(B);
                    uint Dmg = (uint)(PrepareAttack(2, false) * B.Value);
                    Attacker.TakeAttack(this, ref Dmg, AttackType.Scapegoat, false);
                    return;//Will not be damaged
                }
                if (CanReflect)
                {
                    if (MyMath.ChanceSuccess(2))
                    {
                        Attacker.GetReflect(ref Damage, AT);
                        World.Action(Attacker, Packets.String(Attacker.EntityID, 10, "MagicReflect").Get);
                        Damage = 0;
                        return;
                    }
                }
02/20/2010 04:59 -Shunsui-#15
Well. I Edited, the Script and I Tested it with different Effects, I Did it with the Super Rainbow Gem Effect and it works well, so iam guesing this Aint the Right Effect, Can Anyone help me out try finding the correct Bless Gear Effect