Yes, that's what botman said. It crashes because he uses pEntity when it is
NULL. He doesn't check for this in his original code.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Richard
Sent: Tuesday, May 01, 2007 3:36 AM
To: '[email protected]'
Subject: RE: [hlcoders] npc_turret_floor Spwaning Problems

Isn't it "npc_turret_floor", rather than "npc_floor_turret"?

R.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Garry Newman
Sent: 01 May 2007 10:07
To: [email protected]
Subject: Re: [hlcoders] npc_turret_floor Spwaning Problems

It's usually best to set the position and spawnflags before it spawns too

CNPC_FloorTurret *pEntity = (CNPC_FloorTurret*) CreateEntityByName(
"npc_floor_turret" );
   if( pEntity )
   {
      pEntity->SetLocalOrigin( local_origin );
      pEntity->SetLocalAngles( local_angles );
      pEntity->AddSpawnFlags( 0x00000020 );
      pEntity->Spawn();
      pEntity->Activate();
   }

On 4/30/07, Jeffrey botman Broome <[EMAIL PROTECTED]> wrote:
> Mukkan Yhtio wrote:
> > I have written the following code the spawn the "npc_turret_floor"
entity.
>
> No, you haven't, you've written code to spawn "npc_floor_turret", not
> "npc_turret_floor"...
>
> >    CNPC_FloorTurret *pEntity = (CNPC_FloorTurret*) CreateEntityByName(
> > "npc_floor_turret" );
>
> After calling CreateEntityByName(), you might want to check if the
> returned pointer is NULL...
>
>     CNPC_FloorTurret *pEntity = (CNPC_FloorTurret*) CreateEntityByName(
> "npc_floor_turret" );
>     if( pEntity )
>     {
>        pEntity->Spawn();
>        pEntity->SetLocalOrigin( local_origin );
>        pEntity->SetLocalAngles( local_angles );
>        pEntity->AddSpawnFlags( 0x00000020 );
>     }
>
> --
> Jeffrey "botman" Broome
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to