Coding new entities in Quake using QuakeC
Moderator: InsideQC Admins
4 posts
• Page 1 of 1
Coding new entities in Quake using QuakeC
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:
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)
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:
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: Select all
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;
};
- timbobsteve
- Posts: 15
- Joined: Mon Oct 10, 2005 12:56 pm
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.

Now I can focus on making it work how I want it to.
- timbobsteve
- Posts: 15
- Joined: Mon Oct 10, 2005 12:56 pm
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.
Thanks again.
- timbobsteve
- Posts: 15
- Joined: Mon Oct 10, 2005 12:56 pm
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest