[Problem]5165 Guard

06/13/2010 06:36 Arcо#16
Quote:
Originally Posted by Tweety.4Girls View Post
you can post you paket for companions and how I can fix my problem with summon guards :) I w8 you answer
Is the correct packet.
I don't see why its causing you trouble.
06/13/2010 12:01 Korvacs#17
If hes spawning correctly but not moving, have you checked that you are loading your dmaps correctly? Ive heard that bugs mob movement.
06/13/2010 12:30 Sp!!ke#18
I will add now all maps for 5165 and I will try again

look on this

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

namespace NewestCOServer.Game
{
public class Companion
{
public uint MinAttack;
public uint MaxAttack;
public byte Level;
public uint SkillUses;//0 if just melee
public Location Loc;
public Character Owner;
public ushort CurHP;
public ushort MaxHP;
public uint Mesh;
public uint EntityID;
public string Name;
public byte Direction;
DateTime LastMovement = DateTime.Now;
DateTime LastAttack = DateTime.Now;
public PoisonType PoisonedInfo = null;
public Companion(Character Owner, uint Type)
{
this.Owner = Owner;
if (Database.CompanionInfos.Contains(Type))
{
CompanionInfo Cmp = (CompanionInfo)Database.CompanionInfos[Type];
MinAttack = Cmp.MinAttack;
MaxAttack = Cmp.MaxAttack;
Level = Cmp.Level;
SkillUses = Cmp.SkillUses;
CurHP = Cmp.HP;
MaxHP = Cmp.HP;
Mesh = Cmp.Mesh;
Name = Cmp.Name;
EntityID = (uint)Program.Rnd.Next(400000, 500000);
Direction = 0;

Loc = Owner.Loc;

World.H_Companions.Add(EntityID, this);
World.Spawn(this, false);
}
}
public void Dissappear()
{
if (World.H_Companions.Contains(EntityID))
{
World.H_Companions.Remove(EntityID);
if (Owner.MyCompanion == this)
Owner.MyCompanion = null;
World.Action(this, Packets.GeneralData(EntityID, 0, 0, 0, 135).Get);
}
}
public void Step()
{
if (DateTime.Now > LastMovement.AddMilliseconds(250))
{
LastMovement = DateTime.Now;
if (MyMath.PointDistance(Loc.X, Loc.Y, Owner.Loc.X, Owner.Loc.Y) <= 18)
{
if (Owner.AtkMem.Target != 0 && Owner.AtkMem.Target != Owner.EntityID && (MyMath.PointDistance(Loc.X, Loc.Y, Owner.Loc.X, Owner.Loc.Y) <= 8))
{
if (SkillUses != 0 && DateTime.Now > LastAttack.AddMilliseconds(1000))
{
LastAttack = DateTime.Now;
uint Damage = (uint)Program.Rnd.Next((int)MinAttack, (int)MaxAttack);

if (World.H_Chars.Contains(Owner.AtkMem.Target))
{
Character C = (Character)World.H_Chars[Owner.AtkMem.Target];
if (C.Alive && C.Loc.Map == Loc.Map && (MyMath.PointDistance(Loc.X, Loc.Y, C.Loc.X, C.Loc.Y) <= 10))
C.TakeAttack(this, Damage, AttackType.Magic);
}
else if (World.H_Mobs.Contains(Loc.Map) && ((Hashtable)World.H_Mobs[Loc.Map]).Contains(Owner.AtkMem.Target))
{
Mob M = (Mob)((Hashtable)World.H_Mobs[Loc.Map])[Owner.AtkMem.Target];
if (M.Alive && M.Loc.Map == Loc.Map && (MyMath.PointDistance(Loc.X, Loc.Y, M.Loc.X, M.Loc.Y) <= 10))
M.TakeAttack(this, Damage, AttackType.Magic);
}
}
}
else if (MyMath.PointDistance(Loc.X, Loc.Y, Owner.Loc.X, Owner.Loc.Y) >= 4)
{
GetDirection(Owner.Loc);
byte eDir = Direction;
bool Success = true;

while (!FreeToGo())
{
Direction = (byte)((Direction + 1) % 8);
if (Direction == eDir)
{
Success = false;
break;
}
Success = true;
}
if (!Success)
JumpToOwner();
else
{
Loc.Walk(Direction);
World.Action(this, Packets.Movement(EntityID, Direction).Get);
World.Spawn(this, true);
}
}
}
else
JumpToOwner();
}
}
void JumpToOwner()
{
Loc.X = (ushort)(Owner.Loc.X + Program.Rnd.Next(7) - Program.Rnd.Next(7));
Loc.Y = (ushort)(Owner.Loc.Y + Program.Rnd.Next(7) - Program.Rnd.Next(7));
World.Action(this, Packets.GeneralData(EntityID, Loc.X, Loc.Y, 0, 0, 137).Get);
World.Spawn(this, true);
}

void GetDirection(Location Target)
{
byte ToDir = (byte)(7 - (Math.Floor(MyMath.PointDirecton(Loc.X, Loc.Y, Target.X, Target.Y) / 45 % 8)) - 1 % 8);
Direction = (byte)((int)ToDir % 8);
}
bool FreeToGo()
{
Location eLoc = Loc;
eLoc.Walk(Direction);
if (!DMaps.H_DMaps.Contains(Loc.Map))
return true;
if (((DMap)DMaps.H_DMaps[Loc.Map]).GetCell(eLoc.X, eLoc.Y).NoAccess)
return false;
return true;
}
}
}
I'm not pretty sure about that but I will w8 anyone who try to help me
06/13/2010 12:51 dodolinobobo#19
i think you need that too....

Code:
[URL="http://www.elitepvpers.com/forum/co2-pserver-guides-releases/177649-release-rb-guard.html"]Click here for the topic[/URL]l
06/13/2010 18:09 Korvacs#20
Quote:
Originally Posted by dodolinobobo View Post
i think you need that too....

Code:
[URL="http://www.elitepvpers.com/forum/co2-pserver-guides-releases/177649-release-rb-guard.html"]Click here for the topic[/URL]l
Got nothing to do with the 5165 source.
06/13/2010 18:26 dodolinobobo#21
Quote:
Originally Posted by Korvacs View Post
Got nothing to do with the 5165 source.
i know but i want only to say that you need somethink like that,sure converted for the 5165 system
06/13/2010 20:20 Sp!!ke#22
Quote:
Originally Posted by Korvacs View Post
Got nothing to do with the 5165 source.
I'm 100% agree with you :) nothing to do with my problem :|
06/13/2010 22:38 Arcо#23
Quote:
Originally Posted by Tweety.4Girls View Post
I'm 100% agree with you :) nothing to do with my problem :|
The packet works perfectly with me, so I'm going to assume you either put it in the wrong place, or didn't replace the existing one.
06/14/2010 14:13 Sp!!ke#24
hmm not I put it in packets.cs but I have 2 type of problem

1. with my packet guard is invisible
2. with you packet guard is visible but not move and not attack
03/28/2012 20:00 snipetime#25
Sorry i bump this very old thread but anyone find a fix for the guard is visible but not move and not attack ?

i looked in to the companion.cs and don't find anything wrong.

Or maybe what Korvacs said :

If hes spawning correctly but not moving, have you checked that you are loading your dmaps correctly? Ive heard that bugs mob movement.

Again sorry...