Jump to content
  • 0

Custom projectile code changes


Blinkuz

Question

Have you ever tried to remove the spawns from a projectile the moment one of the spawns collides with something?

 

Currently I have added this code to the ProcessFragments() method but the elimination is not covering all the projectiles, when colliding it only eliminates the projectiles created before the one that collided, if the one that collided was the last one generated then all the previous ones are deleted , but I need all of them to be removed including the ones that were before and my 2 neurons can't find a correct way to do it.

 

NOTE: The ProcessFragment () method is in the Projectile class inside the Entities folder of the server.

if (killSpawn)
 {
    if (Base.KillChildOnCollide) // Here my changes begin to try to eliminate the spawns 
     {
        for (int j = 0; j < mSpawnedAmount; j++)
          {
             spawn.Dispose(j);
             Spawns[j] = null;
             mSpawnedAmount--;
             }
      }
      else
         {
           spawn.Dispose(i);
           Spawns[i] = null;
           mSpawnCount--;
         }
                            
          continue;
}

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I already found the solution by myself, I just had to go through all the projectiles in the spawns in the for instead of the mSpawnedAmount, it was as follows:

 

 for (int j = 0; j < Spawns.Length; j++)
          {
             spawn.Dispose(j);
             Spawns[j] = null;
             mSpawnedAmount--;
          }

 

Link to comment
Share on other sites

×
×
  • Create New...