increase maximum number of subentity and vspawn

i want to create many subentitys or vspawns in my game they work fine as long as only one of them plays at time
when 4 or more of them needed to run the game will get crashed
can some one tell me how i can fix this issue
can some one tell me how i can increase the maximum number of subentitys or vspawns than the number that openbor normally can load them.

this is the error that i get openborlog.txt

********** An Error Occurred **********
* Shutting Down *

Assertion `index < a->numframes' failed in function 'getDrawMethod' at openbor.c:762.
This is an OpenBOR bug. Please report this at www.chronocrash.com.
 
Last edited:
Can we see your script which is related to this error?
What is it that you're trying to create with this script?
it is happening in many situation
i only mention one of them here as an example

i created pain11 for getting unconsciousness animation
in that animation 4 star appears and they spining around a circle over the entity head and also they has star_shadow that runs behind them with alpha
for these starts when times pass their number will get decreased one by one and it applyes to their shadows too
for exampel at first they are 4 after 2 sec they play 3 star animation . after 4 sec they play 2 star animation . after 6 second they play 2 star animation and after 8 secound the entity gets its consciousness back
each time that one of stars get decreased i spawn star_alone that it is a star that thrown out to the sky . and star alone has star_alone_shadow thet playes behind it
and if the entity that was in unconsciousness ( pain11 ) changes its animation all of the reminding start will thrown out at the same time
for example if it has 4 star and get hitted by another attack all of the 4 star will jump out at the same time or if it has 2 star on his head and get hits 2 stars will jump out
if the player get unconsciousness (i mean using pain 11 animation ) it also can press left and right keys to get back to idle state
each time he press right keys one of starts will jumped out of their cycle
and also if player get unconsciousness (i mean using pain 11 animation ) it also summons another entity that shows the player to push left and right bottuns
and it also has shadow

1650655836236.png
1650655847008.png1650657716617.png

it works fine when one or two entities get unconscious
but when 3 or more get unconscious at the same time game get that error

it goes for many other things that i created i think when i use many subentity or vspawn in openbor it cant handle all of them at the same time and it gets crashe

my code is more than 20000 character and i cant uplead it here then please read txt files
here is my code for star in its idle animation
i also uploaded all other files
please help me. we worked on this project for 8 years and my game is not stable
 

Attachments

Last edited:
I've read some of those texts and I'm scrutinizing star.txt to understand more 🤓.
I haven't found the cause yet but I notice couple things:
1. No custom functions are being used. You really should code custom functions to simplify the script. Currently, you are repeating the same lines of codes 😫 which could be simplified had you used functions 😀.
I think I've shared some simple functions some time ago but I forgot where I shared it 😅. Some of functions you could use is spawn01 and spawnBind function.
2. Double killentity functions. I found couple lines like this:
C:
                    killentity(vSpawn);
                    killentity(vSpawn);

IMO this is dangerous cause the second killentity could remove the wrong entity 😟.
I suggest removing the second one.
 
I've read some of those texts and I'm scrutinizing star.txt to understand more 🤓.
I haven't found the cause yet but I notice couple things:
1. No custom functions are being used. You really should code custom functions to simplify the script. Currently, you are repeating the same lines of codes 😫 which could be simplified had you used functions 😀.
I think I've shared some simple functions some time ago but I forgot where I shared it 😅. Some of functions you could use is spawn01 and spawnBind function.
2. Double killentity functions. I found couple lines like this:
C:
                    killentity(vSpawn);
                    killentity(vSpawn);

IMO this is dangerous cause the second killentity could remove the wrong entity 😟.
I suggest removing the second one.
i removed secound killentity(vSpawn); but still have same problem.
as i told it works fine for one or two entity but as long as it runs over 3 entity in same time openbor will crash
 
I've tried spawning star and as soon as it is spawned, it tosses 4 other stars without playing the rest of its IDLE animation.
Is this how it's supposed to be?
If not, how should I spawn this star?
 
I've tried spawning star and as soon as it is spawned, it tosses 4 other stars without playing the rest of its IDLE animation.
Is this how it's supposed to be?
If not, how should I spawn this star?
you must set these names (pain11/death11/backpain11/backdeath11) for your animations in the entity that want to use stars
then in pain11/death11/backpain11/backdeath11 spawn star with these commands
subentity star
spawnframe 1 0 1 200 0
 
I've simplified the scripts in star.txt with functions. It looks much nicer and easier to grasp now :cool:. See attached star.txt.
There's one simplify step I could do next :sneaky: but I'll do that later.
Oh, I don't have scan_left_right, scan_left_right_shadow and scan_dialogbox_shadow entities so I omitted them from star.txt and also any scripts related to them.

With this simplified version, I couldn't reproduce the bug :oops:. I could have 3 dizzied enemies at once without any crash at all :).
So with that said, I suggest you simplify scripts in star.txt by using functions as I've shown below. FYI, script can call functions from animation script.

These are functions I'm using in star.txt:
C:
void spawnBind2(void Name, float dx, float dy, float dz, int Dir, int Flag, int Num)
{ // Spawn entity, bind it and store each other
   void self = getlocalvar("self");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, dz);
   bindentity(Spawn, self, dx, dz, dy, Dir, Flag);
   setentityvar(self, Num, Spawn);
   setentityvar(Spawn, Num, self);

   return Spawn; //Return spawn
}

void shooter2(void vName, float fX, float fY, float fZ, float Vx, float Vy, float Vz)
{//Spawns projectile next to caller
 //vName: Model name of entity to be spawned in
 //fX: X location adjustment
 //fZ: Y location adjustment
 //fY: Z location adjustment
 //Vx: X speed
 //Vy: Y speed
 //Vz: Z speed

   void self = getlocalvar("self"); //Get calling entity
   int Direction = getentityproperty(self, "direction");
   void vSpawn; //Spawn object.
    
   vSpawn = spawn01(vName, fX, fY, fZ); //Spawn in projectile
   if (Direction == 0){ //Is entity facing left?                  
      Vx = -Vx; //Reverse Vx direction to match facing
   }

   changeentityproperty(vSpawn, "velocity", Vx, Vz, Vy);
    return vSpawn;
}

void spawn01(void vName, float fX, float fY, float fZ)
{
    //spawn01 (Generic spawner)
    //Damon Vaughn Caskey
    //07/06/2007
    //
    //Spawns entity next to caller.
    //
    //vName: Model name of entity to be spawned in.
    //fX: X location adjustment.
    //fY: Y location adjustment.
      //fZ: Z location adjustment.

    void self = getlocalvar("self"); //Get calling entity.
    void vSpawn; //Spawn object.
    int  iDirection = getentityproperty(self, "direction");

    clearspawnentry(); //Clear current spawn entry.
      setspawnentry("name", vName); //Acquire spawn entity by name.

    if (iDirection == 0){ //Is entity facing left?                  
          fX = -fX; //Reverse X direction to match facing.
    }

      fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
      fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
      fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.
    
    vSpawn = spawn(); //Spawn in entity.

    changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
    changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
    
    return vSpawn; //Return spawn.
}
 

Attachments

thank you so much i will try it
those scan_left_right, scan_left_right_shadow are used for player when he get dizzy those entity will apear to tell player to press left and right rapidly to decrease dizzy time
and scan_dialogbox_shadow are not used for stars i put it in script by mistake
and can you give me the link of the latest version of openbor maybe my version is old.
 

Attachments

Back
Top Bottom