Inside3D!
     

Coding new entities in Quake using QuakeC

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
timbobsteve



Joined: 10 Oct 2005
Posts: 15

PostPosted: Mon Oct 10, 2005 1:08 pm    Post subject: Coding new entities in Quake using QuakeC Reply with quote

Hello all,

I am trying to start a mod for the original quake engine and I am having some trouble with quakeC. I have only just started learning it, but I have had some past coding experience.

What I am trying to do is setup a camera system like in the Alone in the Dark games, where the camera changes depending on where the player is in the room.

I have written a custom entity called trigger_camera() and I can compile my code and it does not spit out any errors. But when I run a test map it errors and says something along the lines of the following:

Quote:
Host_Error:PR_ExecuteProgram: Null Function


the entity is one that is made in the code. I will include the code (but i dont necessarily want people to make it work for me... I would prefer to learn what my mistake was and how to fix it)

I hope this isn't all too confusing. It is a little late here and I should really be asleep

My Code: (All in one file called Camera.QC)
Code:

void() Switch_Camera =
{
   local entity camera;

   camera = find(world,targetname,self.target);

   // Switch view to camera
   msg_entity = self.enemy;
   WriteByte(MSG_ONE, 5);
   WriteEntity(MSG_ONE, camera);
   msg_entity.player_cam = camera;
   msg_entity.angles = camera.angles;
};

void() trigger_camera_trigger =
{
   if(self.nextthink > time) return; //Already triggered

   self.takedamage = DAMAGE_NO;

   activator = find(world,classname,"player");

   Switch_Camera();

   //self.touch = SUB_Null;
   self.nextthink = time + 0.1;
};

void() trigger_camera_touch =
{
   if(other.classname != "player") return;

   self.enemy = other;
   trigger_camera_trigger();
};

void() trigger_camera =
{
   if(!self.wait)
      self.wait = 0.2;

   InitTrigger();

   if (!self.spawnflags)
   {
      self.touch = trigger_camera_touch;
   }
};

void() info_camera =
{
   local entity cam;
   
   cam = spawn();
   cam.classname = "info_camera";
   cam.origin = self.origin;
   cam.angles = self.angles;
};
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon Oct 10, 2005 5:44 pm    Post subject: Reply with quote

You're setting a nextthink time but no think function.
Which means the engine tries calling the think function, which is null.
Back to top
View user's profile Send private message Visit poster's website
timbobsteve



Joined: 10 Oct 2005
Posts: 15

PostPosted: Mon Oct 10, 2005 10:23 pm    Post subject: Reply with quote

Thanks Spike... that fixed it. I can't believe I missed that.
Now I can focus on making it work how I want it to.
Wink
Back to top
View user's profile Send private message
timbobsteve



Joined: 10 Oct 2005
Posts: 15

PostPosted: Tue Oct 11, 2005 6:05 am    Post subject: Reply with quote

OK.... I finaly got the players view to change to my camera entity... but now I can't make it so the players controls only affect the player model and not the camera.... i.e. when I use the mouse to look around it moves the camera.... I would prefer to have the camera stationary and always facing the initial camera.angles value.... but I have no idea how to do this.

Thanks again.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group