[Help] NPC health?

08/17/2010 20:24 killersub#1
alright so I've currently checked my server again and found out dat once u attack npcs with like skills (not including fb/ss) they get attacked with a random dmg amount...wtf lol? anyone kno how can I fix it so u cant ATTACK ANY npc lol? most of the new sources released nowadays have dis problem but I have not yet fixed it since idk how to...any help would be appreciated :handsdown:
08/17/2010 21:48 _DreadNought_#2
It's just a basic bit of code, it's in the attack.cs your better off not using newestcoserver to be fair.
08/17/2010 22:36 killersub#3
Quote:
Originally Posted by Eliminationn View Post
It's just a basic bit of code, it's in the attack.cs your better off not using newestcoserver to be fair.
meh I'm jus seeing how much I can code into it for it to actually be playable to other people lol...anyways +thanks
08/18/2010 02:37 sagitarius2118#4
hahaha , thats funny but the npc never dies xd
08/18/2010 10:02 Fish*#5
put a check in attack.cs for if it is a npc, i will reply back, when i get home.
08/18/2010 11:37 Korvacs#6
You are spawning npcs with the type which allows them to be attacked, this should only really be used for scarecrows and stakes in Training ground. After thats been corrected you should no longer be able to target npcs or attack them.
08/18/2010 11:49 _DreadNought_#7
Quote:
Originally Posted by grillmad View Post
put a check in attack.cs for if it is a npc, i will reply back, when i get home.
Yeah check if what your attacking has a flag that = a npc
08/18/2010 13:01 Fish*#8
I know, I know.
But im at my school right now =]
08/18/2010 16:59 killersub#9
Quote:
Originally Posted by Eliminationn View Post
Yeah check if what your attacking has a flag that = a npc
I found this In Attack.cs It might be da cause of da problem idk, just putting it out here cuz I didnt have this bit of code in any of my other sources...

Code:
if (PossChar == null && PossMob == null)
                        {
                            Game.NPC PossNPC = (Game.NPC)Game.World.H_NPCs[TargetUID];
                            if (PossNPC != null && PossNPC.Flags == 21 && (MyMath.PointDistance(GC.MyChar.Loc.X, GC.MyChar.Loc.Y, PossNPC.Loc.X, PossNPC.Loc.Y) <= 3 || AttackType == 28 && MyMath.PointDistance(GC.MyChar.Loc.X, GC.MyChar.Loc.Y, PossNPC.Loc.X, PossNPC.Loc.Y) <= 15))
                            {
                                GC.MyChar.AtkMem.Target = TargetUID;
                                GC.MyChar.AtkMem.Attacking = true;

                                if (DateTime.Now > GC.MyChar.AtkMem.LastAttack.AddMilliseconds(GC.MyChar.AtkFrequence))
                                {
                                    uint Damage = GC.MyChar.PrepareAttack((byte)AttackType, true);
                                    //if (!GC.MyChar.WeaponSkill(PossNPC.Loc.X, PossNPC.Loc.Y, PossNPC.EntityID))
                                        //PossNPC.TakeAttack(GC.MyChar, Damage, (ConquerSx.Game.AttackType)AttackType, false);
                                }
                            }
                        }
                    }
might dat be da problem :D?
08/18/2010 17:10 Fish*#10
make a check for that npc flag is only tg npcs XD
08/18/2010 17:25 pro4never#11
21 is scarecrow type. Change your npc types to something the client doesnt view as attackable and change server side too..


Could be wrong but i seeem to remember 21 being scarecrow and 22 or something being stake. Trst out some flag values for your spawn to see what they do ^^. Seem to remember 1 being store and 2 being npc
08/18/2010 23:45 .Beatz#12
pro4never I believe you are correct. Here
Code:
Shop = 1,
        Dialog = 2,//3, 4, 10, 15, 27
        FaceChange = 5,
        TCUpgrade = 6,
        GemSocket = 7,
        ShopCarpet = 14,
        AskVending = 16,
        Gamble = 19,
        Stake = 21,
        Scarecrow = 22
08/18/2010 23:53 Korvacs#13
Indeed so you need to change the npc type to the correct npc type which doesnt allow attacking (ie not a stake or scarecrow), for a standard npc thats type 2, like i said its as simple as that.