Results 1 to 7 of 7
  1. #1
    cxydsaewq's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    954
    Reputation
    25
    Thanks
    1,341
    My Mood
    Amazed

    Pets don't connect to players world [Seraphs' Dominion]

    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:


    PetChasing.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;
    Thank you for reading

    --EDIT--

    They do connect but their sprite gets stuck in the world where you activated them


  2. #2

  3. #3
    Silvus's Avatar
    Join Date
    Oct 2014
    Gender
    male
    Posts
    132
    Reputation
    10
    Thanks
    91
    My Mood
    Cheeky
    Quote Originally Posted by cxydsaewq View Post
    Anyone?
    Didnt read the code, but dont u need a behaviour for them?

  4. #4
    Ahl's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    /modcp
    Posts
    16,599
    Reputation
    3219
    Thanks
    5,383
    My Mood
    Angelic
    Quote Originally Posted by Silvus View Post
    Didnt read the code, but dont u need a behaviour for them?
    The behaviors are found in BehaviorDb.misc.cs so no you don't as they already have it.

    It's the matter of the pet not following the player in another world
    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

  5. #5
    cxydsaewq's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    954
    Reputation
    25
    Thanks
    1,341
    My Mood
    Amazed
    Quote Originally Posted by Color's Sheep View Post
    The behaviors are found in BehaviorDb.misc.cs so no you don't as they already have it.

    It's the matter of the pet not following the player in another world
    It's not about the pet not following the player, it's the sprite

  6. #6
    toby2449's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Location
    The Ocean
    Posts
    281
    Reputation
    10
    Thanks
    21
    My Mood
    Inspired
    I'm using that source too, except mine doesn't despawn when a player leaves the world. It just stands there. xD
     
    ded lol


     
     
    I don't have skype xd. Well, I used to before it got hacked. Go hack it some more - toby2449

  7. #7

Similar Threads

  1. [W.I.P] The Seraphs' Dominion (123.5.1)
    By Kithio in forum Realm of the Mad God Private Servers Discussion
    Replies: 61
    Last Post: 08-13-2014, 01:14 AM
  2. [Discussion] The Seraphs' Dominions Private Server Client
    By Kithio in forum Realm of the Mad God Private Servers Discussion
    Replies: 7
    Last Post: 07-14-2014, 12:39 AM
  3. The Seraphs' Dominion => Client Tour
    By Kithio in forum Realm of the Mad God Private Servers Discussion
    Replies: 10
    Last Post: 06-23-2014, 10:09 AM
  4. [Help Request] Virus Scan Websites Don't Connect
    By I'm Chris in forum Combat Arms Mod Help
    Replies: 0
    Last Post: 08-03-2011, 01:03 AM
  5. IS Nexon really cutting the connection of players in Brazil?
    By El Narco in forum Combat Arms Discussions
    Replies: 17
    Last Post: 09-22-2009, 07:18 PM