News | Forum | People | FAQ | Links | Search | Register | Log in
Coding Help
This is a counterpart to the "Mapping Help" thread. If you need help with QuakeC coding, or questions about how to do some engine modification, this is the place for you! We've got a few coders here on the forum and hopefully someone knows the answer.
First | Previous | Next | Last
@Thulsa - Thank You! 
It *did* help. Looks like I need to be way more careful about variable assignments in there for future changes. 
I made a monster.A copy of RMQ's flayn monster code,but edited heavily to fit in with regular quake.
I removed the reanimation code,torso splitting code and some functions that weren't in the file.

Now the thing is,I precached the models and I even have them in my progs folder for the mod.
In the requiem engine, "create monster_flayn" works,but and invisible monster spawns.

QSS and MarkV don't even start the e1m1 ENT file with the monster_flayn that replaced all monster_army.

Should I rewrite the code?

Am using progs_dump_devkit_v110, vanilla dump works fine but my mod doesn't load e1m1.ent with the new monster 
Hello, In the Chasm thread, Madfox said he had some trouble getting infighting between Chasm monsters to work. Can somebody with experience in that area help?

The thread is here: 
The main factor is that I used most qc from the quake entities. I have no trouble with the infight, as quake entities usual have that in commen.

When I try to target a monster to a path_corner the game stops with a walk_monster_start error.
A bit strange as the spider just follows its path without problem, and it is the same kind of imported entity.

Also I used a subroutine into the stand function.
This is a hack I found to interfere with the stand function. The Mong soldier looks around, and while he is watching aside it won't attack.
For some reason Faust, who has the same stand function, ony uses half of the frames. It is as if some arithmic cuts out the other half.

void() faust_stand11 =[ $stand11, faust_stand12 ] {ai_stand();};


void() faust_round1 =[ $round1, faust_round2 ] {};

void() faust_round24 =[ $round24, faust_stand13 ] {};


void() faust_stand12 =[ $stand12, faust_check ] {ai_stand();};

// faust_check IS CALLED IN faust_stand12, TO DETERMINE IF HE'LL STAND OR ROUND.
void() faust_check =
if (random() <0.25)
faust_stand12 ();
faust_round1 ();
//end strat_check

In game it uses only untill frame round12, and then switches back to stand13. 
Chasm monsters only have a stand and run function.
So asking them to walk is like asking for a high Q.
Fetched a walk pose and all is well. 
That Is.., 
what is it when one entity starts an infight with another one
and the attacked one doesn't respond? 
why do you need to ask Chasm monsters to walk? just have them run Patrol. 
They need the order of th_stand, th_walk and th_run, otherwide the error walk_monster_start occurs in monster.qc. 
so the Chasm monsters can still Patrol, but they use their run function? 
Animated Poses 
As soon as they end their walk function they use run for chasing.
Most chasm entities have no walk function, spider even has no stand function. In Chasm it waits aside in walk pose. 
Compiling Progs.dat - Very Strange Bug In-game 
Hello everybody

Here it the strange thing...

If compiling an original, unchanged Source Code from Abyss of Pandemonium v2.0 using FTEQCCGUI.exe
there is an ammo counter bug occurs while switching weapons after shhoting.

For example if type "impulse 9" and start shooting from Nailgun, for instance from 200 nails to 188 and then switch to Super Nailgun you will see 189 nails in ammo instead of 188!

If you shoot from Super Nailgun from 188 nails to 182 for example and then switch to Nailgun, you will see 184 nails in your ammo counter instead of 182!

So cycling forward after shooting adds 1 piece of ammo to the weapons which share the same ammo type with the previous one and cycling backwards adds 2 pieces of ammo to the weapons which share the same ammo type with the previous one.

Same problem goes to shotgun weapons, lightning, and rocket/grenade launchers.

Could you guys tell me what may cause this proble and how to eliminate it? 
no idea, but some things to check:

does the big ammo counter on the HUD match the values of the 4 small ammo counts? if not, it may be a problem with setting self.currentammo

otherwise, there are very few places where things like self.nails, self.shells, etc. are set, at least in vanilla code -- but maybe AOP adds some weird new code that has a bug. In that case, search for something like ".ammo_nails =" and see what you can find that looks suspicious 
It's Fixed 
As Seven from said

"It happened during decompilation of the original source.
As you know, the AoP progs.dat was reverse engineered !
FrikQCC´s decompiler made some bad decisions, so..."

He provided me with the "cleaned" source code and now I'm making the patch for AOP v2.0 to make it more enjoyable (like vanilla) Quake.

Thinking of releasing it here, when I'm finished with this. 
Talking Player... 
Hey everyone! Sorry for the dumb question but is this the right place to post regarding QC coding help?

If it is, here's my question:

I've been trying to work out what might be the best way to add more vocalization for the player. Like adding some smack talk (i.e. Duke Nukem). One way I was thinking might be an inverted obituary function? But not entirely sure tbh, is there a better way of doing this? Point in the right direction? 
Pre-Recorded Obituary 
Hi MrC. I'd say you were along the right lines with looking at the obituary function. In my view the place to start is the function which calls the obituary function, which is a function called Killed in combat.qc.

If you look at the function, there's a block which starts

if (self.flags & FL_MONSTER)

I'd add a bit of code inside that block:

if (attacker.classname == "player")
    PlayerRemarkOnKill(attacker, self);

Then your PlayerRemarkOnKill function looks like:

void(entity player, entity monster) PlayerRemarkOnKill =


I'll leave you to play around with what you actually want to do with the remarks. Because the monster entity is passed to the function, you have the option of playing lines that are specific to a particular enemy type. 
Whoa, thanks Preach! Just got it all added and it works perfectly. And good call with checking classnames for specific commentary :) 
QC Frame Function Generator 
Ok, so onto my next conquest... I was curious about frame functions and if there were any little tools out there for generating QC frame functions? I mean, not to sound lazy or anything.

I know there are alternative methods like framegroups but how about calling sounds etc... at specific frames when using this method?

Thanks again and sorry if this is such a basic question, still learning my way around. 
FTE Particles On Sky Boxes... 
(NOTE: Posting here because "getsurfacenearpoint" and "surface" keywords show up in this thread more than anywhere else on the web)

Goal: Specify FTE particles when entity touches the sky on any quake 1 maps inlcuding mission packs.

Background: As we know, the vanilla "pointcontents(self.origin) == CONTENT_SKY" code doesn't work as intended on many original maps. Fortunately, getsurfacenearpoint in FTE works great for getting surface texture names. I've used it for coding quakec entities (bullets, missles, etc) to fly through the sky without exploding or leaving decals. However, I can greatly simplify the code if someone could tell me how to use FTEQW's "clippeddecal" particle parameter.

Question: The help for clippeddecal states, "The two extra args allow you to spawn these decals ONLY on surfaces with matching surfaceflags." What surfaceflags are recognised, and where are they called from? Any examples? FWIW, using getsurfacenearpoint & getsurfacetexture gives "sky1" on original mission maps. 
FTE Particles On Sky Boxes... Exemplar Video 
Here's an exemplar video showing the Lava Nails flying across the sky, from my question above. All effects are FTE particles, except for the bullets through the sky which I had to code in quakec. So, to eliminate the QuakeC coding, I would really like to know if FTE's clippeddecal surfaceflags can be used instead??? 
Why Is There Not A Defrag Mod In Quake 1? 
What are the major differences between the Q1 engine and the Q3 engine?

Are there any differences in physics between vanilla quake 3 and the defrag mod?

Are the certain limitations in the quake 1 engine? 
the QdQstats mod is kind of like that, it has built in timers for speedrunners. I don't know enough about the dfrag mod to answer more. 
How To Do Func_door From Scratch 
Unfortuantely all qc documentation there is, is spread all over the net. Any leads?

btw, long time no see ^^ 
Reimplementation Query 
Hi wakey. I haven't seen a re-implementation of func_door before, and I can think of a few reasons why. Firstly, the code for the func_door is one of the more complex parts of standard Quake, it's certainly a longer .qc file than any of the other brush objects (in fact, it's longer than misc.qc which contains definitions of dozens of different classes). Aside from doing lots of stuff, the bits about e.g. linking doors are complex in themselves.

Often when writing a mod, a good degree of compatibility with existing maps is desirable. It would be tough to ensure the rewritten code had that compatibility - remember that the func_door is a really flexible entity, often used to create platforms and other moving objects. Trying to remain compatible with the core function is one thing, staying compatible with all the unusual use cases is harder.

Lastly, it's worth pointing out that some of the standard functionality of a func_door depends on "library functions" like SUB_CalcMove and SUB_UseTargets. Can a re-implementation assume those still exist, or should it also code those functions from scratch?

Given all of that, I hope you don't mind me asking first why you want to write func_door from scratch? If it was for a Total Conversion where you create a 2D platformer in Quake, then a lot of the concerns above go away, your mod only runs on the maps you make for it, so compatibility isn't an issue. If it's for a more standard Quake mod I worry that it's a lot of writing and testing code for a benefit I can't yet see... 
Yes, total conversion.(though, not a 2D platformer).

Everything else is already coded from scratch, more or less.(roughly following Ender's "quake from scratch" tutorials, to get basic functionality up and running)

The standard door.qc files all have dependencies that are not implemented yet, thus I can't just drop them in like that.

Lastly, as stated by my colleague, the documentation of the DarkPlaces engine is severely lacking(fragmented at best), when compared to the engines I'm used to (e.g. Unity, Godot, or eaven UE4). 
Scratch Tutorials 
The best way for you to get working doors is to add doors.qc, and then fix all the compile errors by pasting the missing functions into the top of doors.qc. Serious advice.

To expand on that a bit: the scratch tutorials are great at what they do. They look at the duties QuakeC has to perform - the things that it's basically impossible to do without, and perform the simplest possible thing to accomplish those duties. It's hard to fit doors into that framework; they aren't essential, and it's unclear what the simplest version of a door is.

The other problem actually really ties into what you're saying about the infrastructure being missing. If you were writing the simplest possible implementation of doors, it's likely you could write a reduced version SUB_CalcMove which does just enough for the doors to function. But that short-sightedness would come back to bite you when you decide later to add trains. It's a catch-22 for the scratch tutorial writer, the simpler you make the current tutorial, the worse a basis for building on you've created.

The thing with infrastructure is that how much of it you need really depends on what your big picture goals for the TC are. If you're only going to include doors in two highly controlled places in your entire game, you probably need less infrastructure that standard Quake - just hard code everything into the mod! On the other hand if you're creating a mappers toolkit complete with detailed customisation of the door acceleration profile, you probably need to build a lot more! 
Thank You Very Much 
it's appreciated, Preach :)

As far as i could get it, the0programmer has chosen an mixed approach, between using standart doors.qc and his own code. Works like a charm.

Now we have yet another challenge to come over: How do ssqc and csqc communicate?
He told me something of "hacks" with stuffcmd and cvar's, now i was asking myself if that is the standart approach or if there is another way?

Basically he wants to grab information of a csqc entity for use in ssqc. 
Although I've never written anything in CSQC, I'd start with getting to grips with
There's a section on sending data to the client and it seems like those methods would be better than stuffcmd.

There's also a worked tutorial at 
Hexen 2 Cutscene Help Needed 
Hello everybody,

I don't know whether the title of this thread is correct.
I currently work on an Hexen II project where I'd like to put some RPG sequences the way Heretic II does.

That is:

1. the view switches to a third person view thanks to a camera_remote (a handy thing we have in H2 which does basically the same as the intermission view, but triggerable mid-map)

2. the view represents the player facing a monster and they interact by talking (with centerprints) or doing something (like one killing the other or running away) by triggering the corresponding animations on the models.

3. the view returns to the player and the adventure goes on.

Has everyone ever tried to do that (would it be thanks to hack or programming)? Succeeded? How?

Thank you in advance for your insights! :-) 
Although HexenII is more advanced then Quake there is a mod called Visions, which has a Capture Camera Kit.

It has about everything you mentioned, but supports only QuakeI. Maybe with a bit tweaking you could port it to HexenII? 
@madfox Sounds promising! Any idea where I could find it?

Yet, just to be sure there is no misunderstanding, because English is not my mother tongue and it's sometimes hard for me to be clear: my actual problem is not the 1. and 3. above because triggered cameras are a native feature in Hexen II.

The real challenge is to tell monsters and the player how to behave during such cutting scenes: tell them to run, to stand idle, to jump or whatever. What I want to do is puppet mastering. Never mind whether it is the actual monsters and player acting in front of the camera or just fake entities reusing their mdl. 
I used this Camera scene Construction Kit in a map to explain a coming event in the game.
It works with scripts from the moment the trigger_camera is touched. The player changes into a moveless point, while the entities can be turned on/off hostile attacking.

There is no way to tell what entities will do, although a func_train or path_info can be used as well as textures on screen.

You can look at it at the map of DarinMcneil visions 
madfox... great link... I never knew about this! One other camera system can be found in the custents mod but it's a bit different because it's a security camera but there are controllable actors in the mod as well. 
Thank you so much for those exciting links! Hope I'll be able to do something nice from it. :-)
You'll hear about it anyway. ;-) 
Demo Examples 
Inky, in the progs tricks you were interested in how demos work. There used to be something of a scene for making Quake demos, especially in the dial-up era of the internet when youtube didn't exist. I was only an interested observer, but if you were interested in finding out more a good place to start would be reading about

In particular, if you look at the sources there are a couple of interviews archived from which go into some detail as to what combination of engine tools, mod-making and live recording were used to produce the demos. 
Dear Preach,

At reading your last paragraph, demos don't seem to be easy stuff and my guess is that anyway I would probably not be able to trigger one mid-game and go back to the action afterwards, like with camera stuff exemplified in the map by Darin Mcneil mentioned above. So learning how to make demos would probably be putting things too far away from actual mapping which I still keep on learning and which already takes me days and days (and days...)

Yet I feel extremely honored by your personalized attention. My project will anyway owe a lot to your map hacks and advice, for sure! Thank you so much for that and for all what you bring to the community, that's so precious for newbies like me! Sorry I didn't notice your kind message sooner (is there a way to be automatically notified when someone posts after you on a thread?) 
I was thinking of pre- or post-level demo cutscenes when I mentioned it (zerstörer is another good example of doing that). In principle though, you could try the following to get a mid-game cutscene from a demo:

1) Save the game to a fixed filename like 'save interdemo.sav' using stuffcmd
2) Follow that with a command to load the demo 'playdemo cutsc001.dem'
3) insert a stuffcmd into the last frame of the demo which runs 'load interdemo.sav' to resume.

Wouldn't work in co-op, and it wouldn't be seamless because the engine would reload the map, but it's an interesting approach. Certainly would shift the burden from perfectly scripting the cutscene in QC to editing a demo. I suspect you can get good results with less effort through the latter... 
Wow, that's tricky! :-)

The cutscenes I have in mind are mainly dialogs with non playing characters (that is non agressive monsters who give pieces of information to the hero thanks to a dialog, show him a passage, etc.) Could a demo do that? That would save a lot of scripting for sure. 
I'd say that's probably simple enough that you could avoid the demo route. Have you looked at the in-map cutscenes you can do with the custents mod? They might be enough for your purposes. If you had 5-6 entities interacting in a scene, each with two or three things to do, and a need for some kind of camera movement, a demo is going to be more manageable. But there's overhead to setting up demos as well, and that's not worth incurring if the action is short and simple. 
What Makes A Monster Go Infight? 
I'm converting some models and have come to strange point one of them resists to go infight.
It keeps on tracing the player untill it is killed.

Strange enough a hit by another monster just makes it to one counter attack, but then it continues the player.
If another monster gets hurt, it starts infight untill the lame one gets killed.

All the others kill eachother infight, so I can't find a trace to where this infight command is to be found. 
in T_Damage, look for self.enemy = attacker;

If your enemies only do one counter attack and then return to attacking the player, something in your code must be setting self.enemy back to the player. 
I can't find self.enemy = attacker; anywhere.

The macro of a grunt is identical to the enforcer.
What happens is that the enforcer will have infight with the grunt.
Grunt with the same qc code won't infight, and leaves after one attack.

Only thing I can make of is that two enforcers won't attack eachother. 
the qc of a grunt is the enforcer.qc. 
I can't find self.enemy = attacker; anywhere.

That would explain why there's no infighting then. Monsters attack their current enemy. So if the enemy is never changed to be their most recent attacker, they won't attack back.

Note that in T_Damage, in standard quake, there is an exception for "soldiers" (e.g. grunts) to allow them to fight each other. Every other class will not fight monsters of the same class. 
That explains a bit of the cause.
I have this T_Damage (self.enemy, self, self, ldmg);

The perticular monster is called monster_grunt, while quake uses monster_army.
Could it miss the statement soldier, not seeing a monster_ grunt for a monster_army? 
#2779 Found It. 
I gave it a Grunt_Check_Attack in Fight.qc.
For most other monsters it is an oppertunity to devide their attacks on long and short range. In this case it won't work for Grunt.
Deleting the files in fight.qc makes it infight again.

Not really clear to me why but it works. 
Sniper Code 
Hello all :-)

I am desperately trying to find what piece of code decides whether a monster is too far away to see the player or not.
Indeed I'd like to implement a flag to enhance some lesser baddies and make them excellent snipers never mind the distance.
Any idea please?

Thanks a lot in advance! :-) 
Attitudes of monsters go to the fight.qc where they are specified to attack on range, distance or default.

So I think your monster should have an anouncement in the fight.qc.

The SoldierCheckAttack has the code to make the knight decide to make a RANGE_FAR, RANGE_MID or RANGE_NEAR attack. 
Would I Get Away With This? 
combat.qc line 189:
// get mad unless of the same class (except for soldiers)
if (self != attacker && attacker != self.enemy)
if ( (self.classname != attacker.classname)
|| (self.classname == "monster_army" ) )

if ( (self.classname != attacker.classname)
|| (self.classname == "monster_grunt" ) ) //
if (self.enemy.classname == "player")
self.oldenemy = self.enemy;
self.enemy = attacker;
FoundTarget ();
For Clearance 
As I compile the progs I don't see any difference in the behaviour of the grunt, so maybe I overviewed a statement. It keeps acting for black sheep and ignores infight. 
Hi madfox,

That's the correct piece of code to change, did you keep it all exactly the same apart from changing monster_army to monster_grunt?

If so, you might need to add some dprint lines in there to try and work out whether the code is running or not when the grunts shoot each other, what classname they have when they enter this section of code, etc... 
Never Try To Beat A Twin 
Thanks for your attention, Preach. Before I turn into one.

I wondered if I could place the statement under the other one, expecting it would work. I guess not, as army will fight a grunt, but grunt won't fight army, nor eachother.

I can hardly believe this error is so consistent. All other monsters I converted have no porblem with infight. For this one I even made all frames and macro the same, but it still excists.

In this file is a try out, don't mind the strange stand / walk scene. It is a rare coinscidence with the same frame group, but altered runout.

How do I place these dprint lines?
Is there a console argument or do I set these statements in the qc? 
In Qc 
it's void dprint (string text).
Plus you need to set the cvar developer to 1. 
ai.qc defs or elsewhere? 
To Be Honest 
i am guessing myself, looked it up once for someone who was new to qc.
In ai.qc there should be an commented out example in t_movetarget, line 147.

It reads dprint //("t_movetarget\n");.
Hope that helps somewhat. 
Thanks for the hint! 
Seeing Double 
Had a look at your zip madfox. The way you formatted your original post, I thought you had deleted the old code and put your new code. But in fact you've left both bits of code in, so it's doing both checks, one after the other. If I add some brackets to make it clearer what's happening:

if (self != attacker && attacker != self.enemy)
if ( (self.classname != attacker.classname)
|| (self.classname == "monster_army" ) )
if ( (self.classname != attacker.classname)
|| (self.classname == "monster_grunt" ) ) // I hope it madfoxed
if (self.enemy.classname == "player")
self.oldenemy = self.enemy;
self.enemy = attacker;
FoundTarget ();

The outside check only allows monster_army to fight with monster_army, and the inner check only allows monster_grunt to fight with monster_grunt. No monster can be both things at once, so it always fails.

Either go back to the original code and replace monster_army with monster_grunt, or create a proper three way check:

if ( (self.classname != attacker.classname)
|| (self.classname == "monster_army" )
|| (self.classname == "monster_grunt" ) )
Black Sheep 
I changed the code for the two monsters, but I fear there is something else going on. The Quake soldier is used as monster_army but there is also a soldier.qc and a grunt.qc.

For sake of a double classname grunt somewhere I changed the montgrunt to mong. Although all parms are thay direction there is a behaviour of a army monster with infight and a mong soldier that gives one counter attack.

I deketed the army in combat for just a mong fighter but it will hardly reackt. Could it be that its painframes are too long, as every time it is attack it looks as if ther is a freeze moment before it just start goosing the player. 
[Hexen II] AC Calculation 

Not sure this is the right place for such a question, I beg you pardon in advance if not.

I am currently mapping for Hexen II and my question is extremely specific to that game. H2 has different kinds of "armor" items the player can grab, each absorbing a specific percentage of damage (actually depending on the player class, the hc code is pretty clear about how it works).

What I don't understand is the "AC" counter displayed in the HUD. This counter is incremented by a certain number of points when an armor item is picked up, but that number doesn't seem to be related to the actual percentage of damage the item can take. It is very puzzling and I have not been able this far to figure out how the HUD counter works.

Is there any chance one of you might have an idea about that???

Thank you so much in advance! :-) 
[Hexen II] AC Calculation: Answer 
Just in case anyone would care, I got my answer here: 
Trenchbroom Commandline 

Like some of you start to know, I map for Hexen II whose entities are sometimes tricky and not as well documented and known as Quake's ones.

That's why I learn a lot from Raven's original maps. The recurring type of question I have been asked to myself is "What is this spawnflag value for? How do they use it in vanilla H2?"

And basically I was launching a textual search on the entire set of .map files by Raven for all the occurrences of the given classname and inspected them one by one until I found one whose spawnflags value contained the desired power of 2 (which is not an easy calculation to work out in one's head). Sounds stupid and monstrously time consuming? It was!

I'm pretty sure you will laugh at me and explain that a far easier solution was available already but well, today I developed my own advanced multi-criteria search tool. It supports regexes and can filter entities by classname, property name and property value (which is searched among powers of 2 if needed). Each matching entity is returned with also its targetname and x y z position within the map.

The cherry on top of the cake would now be that by clicking on a result, Trenchbroom opens the map and moves the camera directly on the entity. Do you know of any command line parameter in Trenchbroom allowing such a thing?

(Sorry my posts are always more verbose than strictly necessary)

Thank you very much in advance! 
A cherry on top of the cherry on top of the cake would even be a command line parameter to open a map with TB and automatically load a pts file in the same action: usual shortcuts to follow the "pts line" would allow to go from one search result to the next instead... 
Worldcraft had a very nice feature called... entity report, I think.

Essentially it listed all entities and allowed you to filter the list by value. It also had basic error checking.

Ideally this would be a per-game thing, allowing the users to edit a .txt file or something to make new error checking parameters.

It's tempting to go into TB dev and help... 
Ressurect/respawn Player In Singleplayer 
Hello again, I guess, this is proper forum to ask (I hope).

In doom forks there is often /budha mode (never have player health go below 1) and /resurrect command (that revives dead player in the spot they died).

During my years of dooming I started using those when quickly analyzing mod maps or doing my own tampering.

For me, they are much better suited for testing than /god.

I am curious about these things:

1. both of these (budha, resurrect) should be attainable with custom modded progs.dat, I believe. Am I right? Is there anything specific in C parts of engines to prevent that (given COOP this should work even with monsters)?

2. can I somehow resurrect with vanilla SP progs.dat? Using `/give h 100` will make my dead player "stand-up", but they cannot move and jump will immediately end level. Am I missing something or this is un-doable in vanilla? 
I'm fairly sure that's un-doable in vanilla.

you can absolutely mod progs.dat to do this though 
here is a quick and dirty proof of concept, no options just respawn in situ with 100 life 
Rubicon 2 has a resurrection cheat — impulse 666. You could look at that code. 
Really Helpful 
Thank you guys this is awesome! 
MapSearch & Inky's Hexen II Mapping Corner 
Hello everybody,

I answer to my own post #2802...
As said, I developed a very handy and powerful command line tool (supporting regexes and spawnflags search) to investigate map files and understand better how those at Raven & iD Software made their maps to learn from their example.

I'd be more than happy if it can be useful to some of you as it was for me :

I would like to take the opportunity to also introduce my newly born website 'Inky's Hexen II Mapping Corner' which has the ambition of becoming a reference for those mapping for Hexen II. Anybody's advice or contribution to make the site grow faster and improve in quality would be most welcome. :-)
Feel also free to backlink it, if you like it, to make it gain some audience and help the small Hexen II mapping community to reinforce its network.

Last, a more direct request to you: has anybody out there the math and programming skills to help me with finding the 'x y z' position of a brush's center of gravity, after the brush definition stored in a map file???

Thank you in advance for your feedback! :) 
QuakeC NOOb Needs Help 
Hello all - long time!

I'm working on a server mod that is a mashup of a few different things:

- Reincarnation base map (old server DM mod from Gen and others)
- Added FrikBots
- Added Map Rotation
- Added Multi-skin support

I had a few things I'd like to try and clean up and desperately need some QC help as I have little clue with that I'm doing.

Here's the things I want to achieve:

#1 - Add custom skins to bots

I have custom player skins working for players (you can cycle through up to 32 skins attached to the player model). FrikBots has 16 different bot profiles, and I'd like set each different bot to use one of the custom skins. How can this be done (like what Omicron Bots did)?

I tried this, but it doesn't work:

self.b_pants = 11;
self.b_shirt = 0;
return "Vincent"; = 1;

Let's take one question at a time. Any idea how I can assign skins to the bots? 
Taking The First Exit 
Hi Mezmorki. On the third line of your code you have

return "Vincent";

The return statement does two things. One is that it specifies the value which will be handed back to the code calling this function. But the other is that it ends the function and returns the value immediately. The code on line 4 which sets the skin is correct, but it never runs because the function exits on line 3.

If you swap the order of those two lines it should start working, but let us know if it doesn't... 
That Worked! 
Awesome - thanks for the help! It all worked fine.

Okay next topic. When players respawn a centerprint message pops up letting them know what skin they have active. I'd like to try and switch this message to an sprint (so it prints in the upper left corner instead of the center).

Here's the code:

// GeN >

player_stand1 ();

if (deathmatch)
spawn_tfog (self.origin + v_forward*20);

spawn_tdeath (self.origin, self);

if((teamplay || (deathmatch & D_HH)) && (self.genteam))
SetTeam(self, self.genteam);

// *************************************************************************
// ** **
// ** M U L T I S K I N 1.1 (start) **
// ** **
// *************************************************************************

if ( == 0) centerprint(self, "Respawning as... Quakeguy"); else
if ( == 1) centerprint(self, "Respawning as... Doomguy"); else
if ( == 2) centerprint(self, "Respawning as... Arnold the Terminator"); else
if ( == 3) centerprint(self, "Respawning as... Arnold the Conan (4)");


// *************************************************************************
// ** **
// ** M U L T I S K I N 1.1 (end) **
// ** **
// *************************************************************************


If I replace "centerprint" with "sprint" it compiles okay, but no messages ever appear.

Any ideas? 
I'd say check that you left the "self" part there - but you'll basically crash the whole server if you get that wrong when using sprint. Can you check to see if the message is getting logged in the console? Sometimes if there's a centerprint and a sprint happening at the same time, the one can wipe out the other. 
Not sure what you mean by "left the self part" in place or not.

A given line could look like this in how I have it:

if ( == 0) sprint(self, "Respawning as... Quakeguy\n"); else

I know most other sprint commands end with "\n" in the line to return?

Could there be something with the timing of respawning triggers that results in a different handling for sprint versus centerprint?

Seems like maybe I;m missing something obvious. 
The message is getting printed to the console if I have the console open when I die. 
You got the self part right, I was worried you might have done something like

if ( == 0) sprint("Respawning as... Quakeguy\n"); else

Is the change to sprint because you are centerprinting something else at the same time? If so, try disabling that for a moment and see if the sprint starts working. 
Dang Engine Issue 
turns out it was a quake engine issue of some sort. I was running and older version of qrack and I tried out a different engine and it worked. Updated Qrack and now it works in that too. :) 
Trigger_changemusic + Saves 
Alright. Thanks to Johnny Lew I have a trigger_changemusic in progs_dump however, I have no idea how to get this to work with savegames. Any guidance?

//thanks to Johnny Lew via changemusic.rar --dumptruck_ds

void() trigger_changemusic_touch =
if (!(other.flags & FL_CLIENT))
if (!self.sounds)
objerror("ERROR: trigger_changemusic needs valid track number in sounds field");
WriteByte(FL_SWIM, self.sounds);
WriteByte(FL_SWIM, self.sounds);
self.touch = SUB_Null;
self.nextthink = (time + 0.1);
self.think = SUB_Remove;

void() trigger_changemusic =
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
self.touch = trigger_changemusic_touch;
con_logcenterprint 1 is the option to print centerprint messages to console. setting it to 0 obv turns that off.
you mean, you want to remember which music track was playing and restore that when the savegame loads?

Check out rubicon 2 source code, the function LoadSaveGameCallback, the logic to call in StartFrame, and the special variable loadsavegamecallback_done -- this setup allows you to do any necessary work after loading a save game, such as re-triggering client side looping sound effects.

In theory you can save the desired music track in some variable, and then when the game is reloaded, check that variable and re-trigger the music in your own version of LoadSaveGameCallback. 
yep. I was looking through other mods yesterday. I should've known to start with Rubicon 2! thanks. 
More Trigger_changemusic 
I'm posting this for those who come after. It should plug into mods easily. As I was looking over Rubicon 2 code and overheating my pea-brain, Spike posted this on Discord. It works well so far but I need to test in various source ports. This isn't as flexible as what metl posted above but it works for this implementation. NOTE the & and * are correct below

add this to worldspawn in world.qc
world_sounds = &world.sounds; //Spike not read-only yet...

add this to defs.qc
nosave float *world_sounds; //via Spike fun times! nosave=noclobber

add to bottom of triggers.qc
void(float newtrack) changemusic =
*world_sounds = newtrack; //changing the field via a pointer
//world.sounds has now been changed via our pointer, newly connecting players (like those connecting after the game is loaded) will get sent the new cd track's number.

//let everyone currently on the server know.
WriteByte(MSG_ALL, newtrack); //initial track
WriteByte(MSG_ALL, newtrack); //looped track... should generally be set the same as the initial track as most engines ignore it entirely so it might as well be sane for those that care.

//thanks to jleww via changemusic.rar --dumptruck_ds

void() trigger_changemusic_touch =
if (!(other.flags & FL_CLIENT))
self.touch = SUB_Null;
self.nextthink = (time + 0.1);
self.think = SUB_Remove;

void() trigger_changemusic =
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
if (!self.sounds)
objerror("ERROR: trigger_changemusic needs valid track number in sounds field");
self.touch = trigger_changemusic_touch;
oops I just noticed

if (SUB_Inhibit ()) // new spawnflags for all entities -- iw

that is in progs_dump only - you won't need it elsewhere and it will cause an error on compile 
How Does Size Work? 
Hi everybody,

I'd like to put in some extra-large monsters to make usual lesser threats a far more scary danger.
From what I can see, seems the size is dealt with code looking like that:

setsize (self, '-32 -32 -24', '32 32 40');

where the 2nd and 3rd parameters correspond to VEC_HULL_MIN and VEC_HULL_MAX respectively.

Yet I can't figure out what the term "hull" actually refers to, nor how a size could possibly be "negative" (unless maybe it's lovecraftian non euclidean geometry brought in QuakeC by Shub-Niggurath herself???)

Your help to my comprehension would be extremely appreciated. Thank you a lot in advance ! :-) 
Tale Of Two Halves 
OK, so this is a bit complicated. For almost all purposes, you have exact control over the bounding box of an entity - but the one exception is really, really important!

The normal bounding box is a cuboid which doesn't ever rotate as the entity moves. The two vectors are relative offsets - they say how far the corners of the bounding box should be from the origin of the entity. The negative ones put the lower corner to the left, back and below the origin of the entity, the positive ones specify a position to the right/front/above the origin.

Interesting to note that those parameters mean the origin isn't dead centre of the cuboid, the bottom of the bounding box is 24 units below the origin, but the top is 40 units above it.

One place where the exact bounding box is used is when colliding with...another bounding box. The exact size of the bounding box is also tested to check if traces from e.g. shotguns have hit something.

However, the one place where the bounding box is (sorta) ignored is calculating collisions against BSP objects. To run faster on Pentium 90s, Quake only computes the spaces that three sizes of object can fit around BSP objects:
• point-sized
• man-sized
• shambler-sized
The precomputed spaces are called "hulls". If the bounding box isn't one of those three sizes, the Quake engine picks a "best-fit" from the available hulls. If you want to get consistent collision, you have to pick one of those three sizes, and the constants are there to make that easier. 
My Triviant 
r_drawviewmodel 1 makes a lot clear.

I try to make a monster launch an attack with three projectiles. One straight forward and two sideways parallel to the player. I studied Wiz_StartFast but I can't make the sideways parallel in line. The outside projectile always aims to the player, not aside.

Where should I start? 
Thank You Preach! 
Your explanation is crystal clear and I would not have guessed that alone, thank you so much!

Now just need to find where the reference hulls for Hexen II are defined (I'm mapping for H2) and I'm done. :-) 
Have you tried looking at the Hell Knight code? I think he does what you're asking for - just spread out over multiple frames instead of all at the same time... 
Yes Preach, that makes sense.
It don't has to be a simillar shot, although it would look fine. 
I will ask this for Madfox here:

So in version 2.38 of the chasm mod, the Mong does not react after being hit by a stratos. However, they will infight on rare occasions. But I cannot figure out what these occasions are. I managed to capture a saved game of them infighting, attached below, maybe somebody could take a look at it? This issue is really weird, monsters either infight or don't infight, but not infight rarely.

The saved games are here:

2.38 is here: 
I figured it out, tagged madfox on discord...

The monsters first frame of run animation has a ai_walk in it.... change it to ai_run and it works just fine. 
Hi, everyone im doing my first code for quakec and I need some help

I would like make a 1920's wall lamp, my entity works but i would like instead a common light a flickering one, i use this code but seems doesnt works properly (compiling is ok), any suggestion? Thanks a lot in advance!

My code:
/*QUAKED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20)
Short wall torch
Default light value is 200
Default style is 7
void() light_wall_lamp =
precache_model ("progs/lamp.mdl");
setmodel (self, "progs/lamp.mdl");
FireAmbient (); = 3;
lightstyle(, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
makestatic (self);

How looks on quake 
If you want to make a custom light style you should give it a new number not already used and place it with the other light style definitions (forgot where — world.qc)?

Then, it seems bad to hard-code the style in the entity spawn function since it prevents a mapper from changing it per instance in the map. You could do a check “if == 0 then = 3” which would let mappers use different styles but also add the convenience of if being automatic for lazy mappers. 
And I forgot, you have to set the entity style in the map editor anyway because it needs to be there for light.exe to set up the light maps correctly.

So just declare the light style in a centralized location with a unique number < 32 and then set it on the light entities in the map editor, and that should be it. 
I will ask two more questions for Madfox regarding the Chasm mod.

In Chasm mod 2.4. when the Faust fires a rocket, there is no explosion. I used to think that this issue is not a big deal, as there are tons of mods with Rocket Ogres and Rocket Grunts, but apparently it is not that simple. Madfox made a video of it here:

You can see there is no explosion.

The second question is that when one of the monster dies, its corpse floats in the air. I have provided two saved games, one with the creature alive, and another with the creature dead.

If somebody could take a look at these two issues it would be great. Thanks!

The chasm mod is found here: 
Your link is dead yhe1 
Code Topic 
Link won't work, updated. 
Have A Question About Something .. 
Can we make quake player automatically move forward by players his own forward direction
Im really getting stuck about it please some one help me ı wısh i could ask a true question... 
// Player Not Fixed 
I don't understand the question.

Do you want to get behind a player to move it foreward,
or do you need a code so you don't have to push a foreward button?

I don't want to offend you, but I really get stuck to understand your question. 
Yes second one i need an auto forward velocity code.i have a trigger and i want to player go forward automaticlally every time when player touch
And thank you 
I forgot to tell that player must go forward automatically by triggers angle and may can jump may be hide his weapon bla bla :) 
Have A Question About Something .. 
Code looks like this..

void() PlayerClimb = //johnfitz
self.velocity = '0 0 160';
///The code that i want goes here
I Get The Question 
but wouldn't it be something equal to void() trigger_monsterjump in trigger.qc? //poor johnfitz 
Have A Question About Something .. 
I wrote a bit you must look previous posts 
İ will glad if you help me 
void() trigger_monsterjump =
if (!self.speed)
self.speed = 200;
if (!self.height)
self.height = 200;
if (self.angles == '0 0 0')
self.angles = '0 360 0';
InitTrigger ();
self.touch = trigger_monsterjump_touch;
Ledge Grab Help 
How can adapt ledge grab feature in actual quake1 server side quake c code 
Ledge Grab Help 
Solved :) 
Saying Hello 
Hello everyone...hmm ledge grabbing in quake?I do not know if it is worth doing research. 
RE #2853 
Its in Slayers Testaments. 
hmm i heard about it but i didn't download and play it i wondered how did they get it 
Question About Adding Leg Model 
I have animated leg model but i dont know how add its can someone help me 
Question About Adding Leg Model 
Having Trouble Compiling Gameplay Edits 
Some changes I wanted to make for a small gameplay mod couldn't be done with the .qc source code, so I tried editing the Quakespasm source code. FTEQCCGUI didn't work, but the CodeBlocks project file they included did.

First problem was that the basedir was being set to my C:\ drive.
I don't know where I'd look to change that, but I can just put QS there temporarily.

After doing that, building and running it through CodeBlocks works just fine. But when I tried putting the built .exe into the temporary location, I get a generic error: "The application was unable to start correctly (0xc000007b)" when running the built .exe.

I don't really know what to do here. I'm jumping through all these hoops to make the death camera angle at 0 instead of 80. Ideally I could do it through FTEQCCGUI so it'd act like a mod instead of an entirely different engine, but like I said I couldn't get it to compile properly FTEQCCGUI (definition errors or expecting brackets, usually).

If someone could help me out, I'd really appreciate it. Like I said, ideally I'd compile these into a mod (like a prog.dat file), but if the only way I can edit the WinQuake derivatives is by making it into an .exe, then I'll do that, I just need to know what I'm missing. Or if there's a better way to do this. 
First, know that quake engine source can only be used to make a new engine, and QuakeC source can only be used to make a new mod. They are completely separate things, you can't use engine source and try to compile it into a mod.

Second, the basedir issue is most likely due to how you are launching the game. If you already have a working quakespasm setup, you should put your engine in the same place (with a different filename of course), and launch it the same way (either with a shortcut with the same options, or with a batch file with the same options.) 
Re: Metlslime 
Ah, alright. So are there ways to edit stuff like the view with the QuakeC source? Like I said in the last post, I'm wanting to change the angle when you're dead from 80 to 0. I looked around and couldn't find anything in the QuakeC source referencing it.

Also to clarify the basedir issue, it would only check for it in my C drive when trying to build and run the engine in CodeBlocks. Dragging the compiled engine into a quakespasm directory gave me the generic error. Unless you meant have the engine source files in the same location as quakespasm. In that case, I have the engine and quakespasm in separate locations. 
I don't know anything about codeblocks, but if you are trying to launch the game from within that, you might need to find a way to set the "working directory" of the executable to your quake directory.

In terms of whether you can do what you want in quakec, I found this in the engine source:

if (cl.stats[STAT_HEALTH] <= 0)
r_refdef.viewangles[ROLL] = 80; // dead view angle

This implies it's hard-coded in the engine, and the way this logic is written, the only way to avoid it is to set player health to a value greater than 0. However that has various side effects like HUD shows a nonzero health, enemies react to you, etc.

New Idea: what if you let the player die, but then set he intermission camera to match the player's current location, but without a roll? (not sure if intermission camera can be abused in this way when the level is not actually completed, but worth a try.) Or do some other 3rd person camera logic to basically disconnect the camera from the dead player? 
Re: Metlslime 
CodeBlocks is a similar editor on the lines of Micorsoft Visual Studio. The issue is I'm only able to run the compiled engine through it. Outside of it with the compiled .exe, I can't get it to run.

That was the code I was referring to wanting to change, but since it's hard-coded in the engine, it's not that big of a deal that I can't change it as a mod. I'll ask around a different thread as far as properly compiling engine changes goes. Only reason I'd do that is for personal use.

As of posting, it's late at night for me, so I'll give the idea a shot in the morning and post my results. In either case, thank you for the help! 
Stuck About Make Think Timers 
I have a trigger and it moves me up
İf a trigger exists Trigger triggers timer when ı interact with it and at the timer ends trigger would be move me other ways so ı need help to code a think timer.ı look timers in quake c 106 codes but ı stuck .help please 
Will Some One Look My Question?? 
Please :( 
Will Some One Look My Question?? 
Please :( 
Hi Robie. 
What's your first language? It's quite a multi-national community on here so if you find someone who speaks it, you could maybe ask them directly and they can translate into English. 
I don't fully understand your question, but:

In quakec, if you want an entity to wait for a certain amount of time, you can set self.nextthink to a time in the future. e.g.

self.nextthink = time + 5; //wait 5 seconds
self.think = DoSomeStuff;

In this example, the entity will wait 5 seconds and then call the function DoSomeStuff 
Say Thanks 
Thank you so much :) 
Say Thanks 
Thank you so much :) 
Answer To Shambler 
My main language is not english but ım using google translate to ask my questions.And shambler ı have a question you too :)
Im trying to show player legs in firs person mode in defined fovs. But how can ı code it in quake c.And ı know ther is quake15 example but ı looked ıt and its so complex uses auto_cvars etc. I dont like this. I need a script that shows player legs when player looks down and not thirdperson mode and ı dont want use auto_cvars like Show_player legs must not change with cvar it must be persistent . 
If Its Possible 

Just a question. It's possible in Quake 1 connect 2 maps and keep dead monster and other stuff already used, when you return for example from map 2 to map 1?

İ guess you want to make connected map system like halflife and persistent entities in may look gold src engine or original hl source code 
For Crowdy 
Yes, exactly!

Ok, its a great idea! ill check original hl source code, thanks a lot, someone knows a mod that impleted this feature? thanks again! 
If I remember correctly, The Demon King lets you move back and forth between maps, with at least some degree of persistence between them.

Don't know if the source was ever made available, though. 
It's a pity, the zip doesnt contain the src... 
I know. :( Well, at least it shows that what you want to do is to some extent possible to do in Quake, right?

The best I can do is this link with the development team's contact details circa 1997. I doubt any of those e-mail addresses are still active, but at least this tells you who worked on the mod. Maybe you can track one of them down and ask if they still have the source? 
One Important Point 
Demon King didn't preserve map state when you returned to levels - you were spawned at the correct entrance but all the monsters were alive again. I remember the forest being particularly nasty in this regard...

For that you'd need to use a system of saving and loading .sav files - but I think that's within the realm of possibility for a QuakeC mod.

What is probably not possible is the Half-Life style continuity within loading zones - where a monster could follow you through the transition between maps. Even if you could somehow compress the info about such a monster in the tiny amount of storage you have for transmission of data between levels, you'd still be stuck if that monster class wasn't precached when the target map was loaded... 
all the monsters were alive again

Are you sure? I'm pretty sure the monsters stayed dead, but weapons, health and ammo would appear again when you went back to a previous level... 
Thanks @threekidsinatrenchcoat And @Preach 
@threekidsinatrenchcoat I have decompiled the code and give me tips for the idea i want to do, thaks a lot!

@Preach, i have tested the demons king mod and the monster remains dead, but needs to be polished, save/load its a good idea too thanks! 
It Works! 
I have copy paste the parts i need from decompiled files, and works! Now i have polish a bit the code,due the monsters in Demon king dissapear and I added the death animation so the corpse remains (sorry for my english)

Now i must try to keep the corpse position

A question, the spawnflag can have a vector variable instead a float ?

Thanks again 
Using Code Without Permission 
I'm happy you got things working, but decompiling and copy & pasting from someone else's code strikes me as ethically questionable at best.

If you're planning to release your project I'd say the right thing to do is to try and find the creator(s) of The Demon King and ask if they're ok with your using their code like this. If you can't find them or if they don't agree, I don't don't think it's right to use their work like this.

Just my two cents. 
Ill Look For Creators 
I have found their names and emails, ill try to find them and ask for it, thanks again 
Changing Default Player Sounds 
Hello, I'm trying to change player death sounds in my map, how is it possible to do? 
The Sound Of Death 
I'm afraid you'd need to create a mod to do that, you can't controls those sounds just from the map.

However, the mod would be very modest. You could either write a QuakeC mod which just involves changing the path from the old sound to the new one in a handful of places. Or your mod could be entirely free of QuakeC, and just have the new sounds saved in your mod folder with the same filenames as the existing sounds have in pak0.pak. 
Second Option 
So, I need to create "sound" folder in my mod directory and put there the new sounds? And that will override default path in the .pak files from id1? 
That's right. The priority for loading resources goes:

1. pak files in the mod directory - highest numbered file being highest priority
2. loose files in the mod directory
3. pak files in id1 - again from highest to lowest number
4. loose files in the id1 directory

Bear in mind that the existing sound files will be in a subdirectory under "sound" - I think death sounds are in "player" but would be best if you checked that in pak0.pak. 
It Worked! 
Thahnk you very much!
Tested it, you need to put sounds with respective filenames in sound/player directory. 
Hi! A Question 
Im trying to compile a map for Hexen II, its the same compiler than quake 1? Which must use for Hexen 2 and where can find it?

Thanks a lot 
Hexen Has Its Own Compiler 
Thanks @madfox 
Hi Madfox, thanks for the support

Ok i have try it with the "compiling gui" but seems it doesnt works...

"Copying Files...
1 archivo(s) copiado(s).
Converting map...
outputfile: rites.bsp
************ ERROR ************
parsing brush
Press any key to continue . . ."

Needs a special line commands parameters?

Thanks again! 
Also With Other Compiler... 
i got this error:

"Converting map...
---- qbsp ----
Project directory: C:\Users\agonagui\Desktop\Temp\Cosas\Hexen2_Dev\Working\
outputfile: rites.bsp
WARNING: brush plane with no normal
*** ERROR: ***
num_entities == MAX_MAP_ENTITIES"

its weird, due this map the same on quake engine works fine but ported to hexen 2 have this issue

any idea? thanks? 
Sorry I Mean "any Idea? Thanks!" 
lol my mistake hehe 
Not Sure 
I once worked with hexen maps, but I used them in the Quark editor. It has a hexen2 input in a way that is easier to work with. After making the right setup it shows which errors are made.

Parsing brush could mean you are not on grid, or that two brushes are overlapping. Also there can be a leak warning. Fact is that when something is wrong the compiler starts giving messages that can be irrilevant.

Max_map_entities for instance means you are using more than 640 en (lights, func and monsters) which I can't imagine.

My idea would be: try Quark 64. I know it is not the best editor there is, but it is one that gives you an entry to hexen2. Use the hexen compiler in the setup and see for yourselve. You'll find out that a hexen map uses another format for entities, because you can't use a quake map layout as a start for a hexem2 map without changing specefic flags that quake uses.

Again, Quark has the specific flags already embedded in the hexen setup. 
Very Grateful For Your Extended Answer 
Hi madfox, thanks a lot, ill check all that you commented, hope it can works, the problem is that i have made initiallly the mod for quake and seems have problems to convert it to hexen 
You'll need to explore the hexen2 code.

Not an easy task, as it took me a long time to understand quake.qc only. 
I'll Do It 
1 post not shown on this page because it was spam
First | Previous | Next | Last
Post A Reply:
Website copyright © 2002-2020 John Fitzgibbons. All posts are copyright their respective authors.