Page 1 of 1

crash at death,take a quick look..

Posted: Wed Nov 30, 2011 6:28 am
by Veleran

Code: Select all

{ 
	Spawn[ ()
	{
		   Console(false);
               BoxWidth(16);			// set bounding box width/depth
               NewOrder("Fire");
      } ] 

      Fire[ () 
      {      
            FireProjectile("Firebolt", "BONE02", 0, 0, 6, "health", "");
            Delay("Idle", 0.2, "");
            AttributeOrder("health", 20, "Destoyed");
            RestartOrder();
      } ] 

      Destoyed[ () 
      {            
            AddExplosion("Firebolt1Explosion", "BONE02", 0,0,0);
            SetEventState("Trap1Trigger", true);
            Remove(true);
	} ] 

} 
Since it has failed,i may change it to be indestructible and sometimes to fire and sometimes not ,randomly when player passes within a range.
It is just a skull-like object on the wall that usually spawns when the player goes near it.

Re: crash at death,take a quick look..

Posted: Wed Nov 30, 2011 12:00 pm
by Jay
@Veleran: My guess is since you are applying the explosion to the actor via ("BONE02"), but then delete the actor with Remove(true), you get a crash since it cannot find the actor anymore... Try changing "BONE02" to "" in your death command.

@QoD, or whoever is managing the code at the moment:
The bug is in CPawn.cpp in the destructor (line 119) - We use RemoveActor() instead of the more conservative RemoveActorCheck() (which should also work if there is no Explosion to unattach, from a quick look at the CExplosionInit::UnAttach(...) method) to remove the actor. This causes problems with Explosions attached to the actor.

However, since this problem could also spread to other actor-like entities - since we theoretically can attach explosions to every actor there is - i advocate adding CCD->Explosions()->UnAttach(theActor); to CActorManageR::RemoveActor()... or just call the RemoveActorCheck from inside.

Proposed fix:

At CActorManager.cpp, line 695:

Code: Select all

int CActorManager::RemoveActor(const geActor *theActor)
{
   return RemoveActorCheck(theActor);
}
While we are at it, since both the RemoveActor() and the RemoveActorCheck() are very small functions, i advocate changing their signatures to inline, to make sure the compiler inlines them.

CActorManager.cpp, line 695:

Code: Select all

inline int CActorManager::RemoveActor(const geActor *theActor)
CActorManager.cpp, line 707:

Code: Select all

int CActorManager::RemoveActorCheck(const geActor *theActor)

Re: crash at death,take a quick look..

Posted: Fri Dec 02, 2011 3:46 am
by Veleran
It had passed through my thoughts when i saw barrel scripts crash at explosion but i would nt let the actor to remain visible while the explosion actors of the actor spray were already flying out.(it seemed like the barrels had already break into pieces).

Can i try maybe to use pawn render false then and after the explosion is done then to use remove?

Re: crash at death,take a quick look..

Posted: Mon Dec 05, 2011 12:48 am
by Jay
Yes i think that would work. PawnRender(false) does not remove the actor from memory, it only makes it invisible.