Anyone?
Basiclly the Pets don't follow you in new worlds, help would be very appreciated
Here are all the codes I could found that deal with pets:
Thank you for readingPetChasing.cs
internal class PetChasing : CycleBehavior
{
//State storage: follow state
private readonly int duration;
private readonly float range;
private readonly float speed;
private float acquireRange;
private Cooldown coolDown;
public PetChasing(double speed, double acquireRange = 10, double range = 6,
int duration = 0, Cooldown coolDown = new Cooldown())
{
this.speed = (float) speed;
this.acquireRange = (float) acquireRange;
this.range = (float) range;
this.duration = duration;
this.coolDown = coolDown.Normalize(duration == 0 ? 0 : 1000);
}
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
FollowState s;
if (state == null) s = new FollowState();
else s = (FollowState) state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffects.Paralyze d)) return;
Player player = host.playerOwner; //GetNearestEntity(acquireRange, null);
Vector2 vect;
switch (s.State)
{
case F.DontKnowWhere:
if (player != null && s.RemainingTime <= 0)
{
s.State = F.Acquired;
if (duration > 0)
s.RemainingTime = duration;
goto case F.Acquired;
}
if (s.RemainingTime > 0)
s.RemainingTime -= time.thisTickTimes;
break;
case F.Acquired:
if (player == null)
{
s.State = F.DontKnowWhere;
s.RemainingTime = 0;
break;
}
if (s.RemainingTime <= 0 && duration > 0)
{
s.State = F.DontKnowWhere;
s.RemainingTime = coolDown.Next(Random);
Status = CycleStatus.Completed;
break;
}
if (s.RemainingTime > 0)
s.RemainingTime -= time.thisTickTimes;
vect = new Vector2(player.X - host.X, player.Y - host.Y);
if (vect.Length() > range)
{
Status = CycleStatus.InProgress;
vect.X -= Random.Next(-2, 2)/2f;
vect.Y -= Random.Next(-2, 2)/2f;
vect.Normalize();
float dist = host.GetSpeed(speed)*(time.thisTickTimes/1000f);
host.ValidateAndMove(host.X + vect.X*dist, host.Y + vect.Y*dist);
host.UpdateCount++;
}
else
{
Status = CycleStatus.Completed;
s.State = F.Resting;
s.RemainingTime = 0;
}
break;
case F.Resting:
if (player == null)
{
s.State = F.DontKnowWhere;
if (duration > 0)
s.RemainingTime = duration;
break;
}
Status = CycleStatus.Completed;
vect = new Vector2(player.X - host.X, player.Y - host.Y);
if (vect.Length() > range + 1)
{
s.State = F.Acquired;
s.RemainingTime = duration;
goto case F.Acquired;
}
break;
}
state = s;
}
private enum F
{
DontKnowWhere,
Acquired,
Resting
}
private class FollowState
{
public int RemainingTime;
public F State;
}
}
}
-----------------------------------------------------------------------------------------------------------------
World.cs
protected World()
{
ConMessage = "";
Players = new ConcurrentDictionary<int, Player>();
Enemies = new ConcurrentDictionary<int, Enemy>();
Quests = new ConcurrentDictionary<int, Enemy>();
Pets = new ConcurrentDictionary<int, Entity>();
-----------------------------------------------------------------------------------------------------------------
Player.cs
public void SaveToCharacter()
{
Char chr = client.Character;
chr.Exp = Experience;
chr.Level = Level;
chr.Tex1 = Texture1;
chr.Tex2 = Texture2;
chr.Effect = Effect;
chr.Skin = Skin;
chr.PermaSkin = PermaSkin ? 1 : 0;
chr.Pet = (Pet != null ? Pet.ObjectType : -1);
if (client.Character.Pet >= 0)
GivePet((ushort)client.Character.Pet);
if (Pet != null)
Pet.Move(X, Y);
public void GivePet(ushort petId)
{
if (Pet != null)
Owner.LeaveWorld(Pet);
Pet = Resolve(Manager, petId);
Pet.playerOwner = this;
Pet.Move(X, Y);
Pet.isPet = true;
Owner.EnterWorld(Pet);
}
----------------------------------------------------------------------------------------------------------------
Player.useitem.cs
case ActivateEffects.PermaPet:
client.Character.Pet = Manager.GameData.IdToObjectType[eff.ObjectId];
GivePet(Manager.GameData.IdToObjectType[eff.ObjectId]);
UpdateCount++;
break;
--EDIT--
They do connect but their sprite gets stuck in the world where you activated them
Last edited by cxydsaewq; 06-08-2015 at 09:07 AM.
[Vouched] Filehost l VPN l Music l Streaming l Gaming l Education l Security l Torrent l Others [All Accounts Shop]
Educational Account Store [Chegg l Coursehero l Grammarly l Pluarsight l Udemy l Ect]
VPN Store [ExpressVPN l IPVanish l HideMyAss l VyerVPN l NordVPN l StrongVPN l Others]
90% of Torrent - Trackers Accounts l Invites l Service l Warranty
Anyone?
[Vouched] Filehost l VPN l Music l Streaming l Gaming l Education l Security l Torrent l Others [All Accounts Shop]
Educational Account Store [Chegg l Coursehero l Grammarly l Pluarsight l Udemy l Ect]
VPN Store [ExpressVPN l IPVanish l HideMyAss l VyerVPN l NordVPN l StrongVPN l Others]
90% of Torrent - Trackers Accounts l Invites l Service l Warranty
News Force Head Editor from 09/14/2018 - 03/02/2020
Publicist from 11/23/2017 - 06/07/2019
Global Moderator since 09/24/2017
Minion+ from 04/16/2017 - 09/24/2017
Market Place Minion from 04/16/2017 - 09/24/2017
Minecraft Minion from 02/23/2017 - 09/24/2017
Realm of the Mad God Minion from 11/06/2016 - 09/24/2017
Middleman from 09/14/2016 - 09/24/2017
News Force Editor from 08/23/2016 - 09/14/2018
News Force (Section of the Week) from 03/21/2016 - 07/17/2017
News Force (User News) from 10/18/2015 - 09/14/2018
Donator since 03/16/2015
Realm of the Mad God Editor from 05/20/2014 - 07/08/2014
Member since 12/23/2012
Rep Power: 82
[Vouched] Filehost l VPN l Music l Streaming l Gaming l Education l Security l Torrent l Others [All Accounts Shop]
Educational Account Store [Chegg l Coursehero l Grammarly l Pluarsight l Udemy l Ect]
VPN Store [ExpressVPN l IPVanish l HideMyAss l VyerVPN l NordVPN l StrongVPN l Others]
90% of Torrent - Trackers Accounts l Invites l Service l Warranty
I'm using that source too, except mine doesn't despawn when a player leaves the world. It just stands there. xD
Day 2937401
Still haven't figured out what's the problem
[Vouched] Filehost l VPN l Music l Streaming l Gaming l Education l Security l Torrent l Others [All Accounts Shop]
Educational Account Store [Chegg l Coursehero l Grammarly l Pluarsight l Udemy l Ect]
VPN Store [ExpressVPN l IPVanish l HideMyAss l VyerVPN l NordVPN l StrongVPN l Others]
90% of Torrent - Trackers Accounts l Invites l Service l Warranty