crash at death,take a quick look..

Topics regarding Scripting with Reality Factory
Post Reply
Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

crash at death,take a quick look..

Post by Veleran » Wed Nov 30, 2011 6:28 am

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.

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

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

Post by Jay » Wed Nov 30, 2011 12:00 pm

@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)
Everyone can see the difficult, but only the wise can see the simple.
-----

Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

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

Post by Veleran » Fri Dec 02, 2011 3:46 am

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?

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

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

Post by Jay » Mon Dec 05, 2011 12:48 am

Yes i think that would work. PawnRender(false) does not remove the actor from memory, it only makes it invisible.
Everyone can see the difficult, but only the wise can see the simple.
-----

Post Reply