Jump to content

MarioTorlandino

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About MarioTorlandino

  • Rank
    On the Coast
  1. MarioTorlandino

    Spawned cars despawning when far from players

    Problem solved. It was lifetime parameter of cars in types.xml Set it to maximum and everything works perfect. <lifetime>2592000</lifetime>
  2. Hi everyone! I'm working at server mod that should spawn and mainpulate and then despawn some game objects. I can't understand why cars disappearing after some time far from player. For example, I'm creating "Land_Container_1Mo" and "OffroadHatchback" at same location with same function, I can see them appearing and disappearing in game and everything works fine if I'm near. If objects is created and I'm going far from them then only "Land_Container_1Mo" stays in place and car is disappearing. I tried spawning cars in line and teleporting player further and further from them via VPPAdmin and far cars from line is disappearing. Looks like some garbage collector checking objects every dozen of seconds and deleting if no player detected near. How should I spawn cars and "fix" them in world? Script is saving spawned objects in array to despawn it later. So I need this objects to be despawned automaticaly only if server is restarting etc. without script finishing properly. Thanks! Spawning code example is below: // P:\@MyMod\Addons\MyMod\scripts\4_World\SomeScript.c ref SomeWorkingClass GlobalSomeWorkingClass = new ref SomeWorkingClass; // Main object that creates at start and rules others class SomeWorkingClass { ref array<Object> SpawnedObjects = new array<Object>; //array<SomeOtherClass> CarList ... list of cars and their attachments void SpawnCarObjects() { for (int i=0;i<CarList.Count();i++) { Object CarObject = GetGame().CreateObjectEx(CarList[i].ObjType,CarList[i].Pos, ECE_PLACE_ON_SURFACE); // Creating CarObject.SetOrientation(CarList[i].Rot); // Rotating ... if (CarObject.CanAffectPathgraph()) { CarObject.SetAffectPathgraph(true, false); GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, CarObject); } ... SpawnedObjects.Insert(CarObject); // Go in array for later manipulating } } }
×