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
In world.qc, the different lightstyles are defined using 'a' thru 'z' for brightness in a string. I have questions about limits and compiler:

1. What is the character limit for the string?

2. Is there a limit on different lightstyles?

3. Does the compiler create a different saved lightmap for each letter a,b,c, etc?

4. Are lightstyles hardcoded into the compiler?

5. Does anyone know of a mod that makes their own lightsyles, e.g. Spastic Lightning or a Flash and Fade, etc.? 
1. Max string length is MAX_STYLESTRING = 64 which looks like it includes a null terminator, so 63 characters
3. No, the compiler bakes (and writes to the bsp) lighting at 100% brightness, which is level "m", I think. Whatever level QC requests is generated by scaling the 100% brightness lightmap to the requested brightness.

Each face can have up to 4 different lightmaps baked for it (bsp format limit), and each lightmap is linked to a lightstyle number.

more detail: the engine looks up the current brightness levels (a-z) of the (up to) 4 lightmaps that were baked for that face. Each of the baked lightmaps is scaled to the right brightness, they're added together, and the result is used as the lightmap for that frame.

4. No. There's not much hardcoded in the light compiler except it knows if a light has "targetname" set, it allocates one of the 64 style numbers for that targetname. It knows if a light has "style" set to use that as the style number for when that light hits faces.

5. Hmm.. I'm not sure. "The Middle Evil" had a lightning effect. ne_ruins might do some tricks with lightstyles, I forget?

The system could be pushed further with a bit of QC, e.g. switchable lights could be extended so they can be animated while on. Could have fade in/out transitions. 
1: 63 chars (more depending on engine). chars outside the a-z range still have meaning but may result in numerical overflows (at least in surface caches), so avoid capitals etc.
there is an extension that allows styles of the form of "=0.5" to set a specific value with greater precision (1 is about equivalent to m - quake has overbrights), which allows for smoother style changes.
fte has an additional extension that allows you to pass an extra arg for rgb values.
the style strings are dynamic state, the qc is free to change them whenever it wants. however its the engine's choice which char it uses from the string at any particular time so if you want fancy qc-based animations its best to stick to a single char per lightstyle string (or the = thing, if your target engine supports it).

2: the bsp format (including bsp2) is limited to 255 different light styles (0-254, 255=no more). Many engines still limit to 0-63 however (higher requires saved game changes).

3: the map compiler is unaware of the style strings themselves. triggered lights will automatically be assigned a (shared-by-matching-targetname) style index.

4: styles 32+ will typically be used for triggered lights. lower indexes can freely be (re)defined by the QC mod, but existing mods will expect the same style strings that they were made for, so beware of that if you try changing the existing styles.

5: my recommendation would be to create some new trigger_lightstyle entity or something that allows you to (re)define the styles from the map itself, because awesomesauce. Bonus points if it can be triggered to enable/disable/recolour/etc all lights with the same style. Note that this should probably not be baked into the individual lights. 
Dynamic Strings 
If you want to be able to programmatically change the lighting strings you can use the basic idea from the following tutorials (a long and involved series of posts)

The crucial change you need to make is to use

float SVC_LIGHTSTYLE = 12;

as the header byte instead of SVC_CENTERPRINT when you send the characters. This may be overkill but it's nice to know there's a way to do it if you need. If you just want a way to translate a float into a light level it's a fairly compact way to do it without some kind of 26 line long if statement.

This trick will be employed in an upcoming project I'm working on... 
a mod that makes their own lightsyles

I remember JPL's "FortDriant" used a recompiled light index for making a long stairway of repulsing light on a long range of 32.

Don't know if its included in the map. 
Thanks Guys! 
Rubicon 2 has custom light styles 
i've done this
void () execute_changelevel =
local entity tmp;
local float bcount;

intermission_running = 1;
intermission_exittime = (time + 5);
lightstyle(0, "f");// R00k: -added- dim light on intermission

oddly I assume the world uses lightstyle 0 looking in the misc.qc for the lights i cant find any reference for the actual numerical value, yet in world.qc, lightstyle (0,"m"); etc.. 
wait ya, .style entity field is a lightstyle thus the world entity inits with = 0; 
Zero Style 
It's basically that, except it's the style field on the light entities which matters, not the style of the world entity. When you don't set a style, the field defaults to 0 - even in the light compiler. 
okay so basically all default lights use lighstyle 0 which is why altering
that to a lower value makes it look like nighttime? i set
that for intermissions and on any map it dims the screen
so the scoreboard shows up better ;) pr_lightstyle calls the svc_ to broadcast to all connected clients. 
Cell Shading On Makaqu 
so I wanted to implement cell shading in my game, and I'm using the makaqu engine because it has cell shading support but more importantly it can be compiled for the dreamcast (I'm making a game for it). When I asked the developer how to implement the cell shading he told me to edit defs.qc and add the line:

float EF_CELSHADING = 16384;

and add this to the model script:
self.effects = self.effects | EF_CELSHADING;

problem is, when I compile it using fteqccgui and place it in my mod pak it still doesn't have cell shaded graphics. I want to add the effect to the player model and the dog, so how would I do this? 
Request For Details 
and add this to the model script:
self.effects = self.effects | EF_CELSHADING;

Can you give us a bit more of the context surrounding this line of code, like which function you've added it to? It wants to be in the function which is setting the model of the entity you want cell-shading on. 
Cutscene Code For Commercial Game? 
I’m looking for QuakeC code for creating cutscenes for a commercial project. I plan to ask whoever originally wrote the code for permission to use it for this, and it’s for a Dreamcast and PC game using the makaqu engine. If anyone can point me in the direction of code for this, I’d like to homogenenise it with my current code (I’m using a little bit of modified code since I can really only read C and C++) to play the beginning of a level. Is there anyone who can suggest some good code for this that’s relatively easy to use? 
Another Question 
Also, I’m putting commands in the world.c code for specific levels, but for some reason it’s not using them. I’m using cvar_set and localcmd. I need these for the game to work. 

Are you putting those localcmd's inside worldspawn or startframe? If you use main() it might not work. 
Thx! One More Question! 
Thanks for your answer! Another question, when I start a demo when the level starts, then the demo exits the level, the game crashes. However, it doesn’t crash the menu screen if I put in startdemo instead of startdemos it goes into the next level which I want this one to do. Is it because I have different cvars coded into both levels? I’m currently at work so I can’t test it yet, but just getting a second opinion. 
Last Part 
I’m using localcmd to start the demo in the start level, which the demo is supposed to spawn the player in e1m1 after the demo plays. 
Demo Hacks 
the typical way to chain demos to maps is to insert an svc_stufftext into the end of the demo to get the client to issue a 'map' console command at the end.
you can't use the changelevel command etc, so all weapons etc will be forgotten. you can work around that with cvars (again eg nehahra) but this makes a mess when it comes to saved games (and potentially restarting the map). 
So Type It In The Console? 
So just straight up type in svc_stufftext map e1m1 into the console when I want the demo to end? Or do I have to code a timer? 
Player Walk Animation Not Playing Right For Custom Character? 
so I have this coder and he and I can't figure out what is wrong with the code. In Darkplaces, the walking animation works fine, but when I switch to makaqu, it also combines with the attack animation! We don't know whats going on! Any help would be appreciated! 
We will need to see your code. Are you using frame macros? Skeletal or vertex animation? Any QC extensions? 
My Code 
Nevermind! Just Had Too Many Animations! 
Just found out that it had too many animation frames! We fixed it! Taking down drive file for security reasons 
Explobox-induced Undead Leaping Fiend Bug 
Hi guys!

In my upcoming map I have a problem with fiends when they (quite often) kill themselves by leaping at exploboxes. They do give the death sound and add to the kill total, but they kind of end up only half-dead:

-If not gibbed by the explobox, they will remain upright and solid and periodically turn to face the player and leap at them. The attack won't damage the player, though.

-If gibbed, the same behaviour occurs except with just the fiend's decapitated head! Delightful! @~@

Does anybody know if someone's already fixed the bug? 
Explobox-induced Undead Leaping Fiend Bug 
Multiple exploboxes? 
possible workaround:
make a second entity to surround the explobox, using the 'clip' texture so that the fiend can't hit the explobox itself, and thus can't zombify itself.
add a trigger_once entity inside the explobox and give it a health value, and have it killtarget your clip entity, so that the artificial blocker doesn't continue blocking after the box explodes (unfortunately the explobox doesn't do target/killtarget stuff, hence the separate trigger).

any qc mod that fixes the chained-explobox-not-chaining bug should have also fixed the zombie-fiend bug thanks to adding a small delay before the explobox itself fires. 

I heard about this earlier. Can you give more details where and why this happens? 
the explobox's th_die function calls T_RadiusDamage which calls findradius, which calls another explobox's th_die which calls findradius again, which clobbers the first findradius's chain causing it to not see the ents that it should have. You can see this on e3m1 I think it was.
The solution is to add a small delay between the th_die and the T_RadiusDamage.
This additionally fixes a stack overflow crash, as well as this fiend bug, and imho looks a little nicer when a group explodes over time, instead of all at once.

Unfortunately there's not really anything an engine can do to fix this (short of ugly hacks that rewrite the qc at load time). Increasing max stack depth delays the crash but still doesn't allow you to have 10000 exploboxes in a domino-run sort of layout...
I guess you'll have to do that with spawns instead... 
This bug is fixed in URQP. I'd suggest looking at its source, especially misc.qc and combat.qc. 
No More Zombie Fiends 
Thanks a lot for your help, Spike and c0burn!

Since my map already has custom code in it (to enable some custom decorative models), I solved the problem the qc way: I simply copied the explobox-related code from the URQP misc.qc, so now my barrels explode in a cool domino style (but still almost instantaneously for it to feel vanilla enough)! B)

The only problem is that the fiends no longer deliciously gib to pieces when they kill themselves by leaping into a bunch of barrels. :'( I did lazily check if URQP had a more "vanilla" solution, fixing the zombie fiend issue while still retaining the instantaneous explosion chaining, but I couldn't be bothered enough. Did you have something in mind, c0burn, when you referred to combat.qc? o: Oh well, better having less gib-inducing barrel clusters than having some solid "ghost" fiends (or their heads) leaping about.

I also gave Spike's "clip shield" workaround a try, but my memory served me well as I recalled that the clip texture can only be used on world brushes and func_details, it seems. Not even info_notnull or InitTrigger trickery fooled qbsp to compile the brush. :/ I even tried giving the func_detail brush a targetname and tried to killtarget it with a trigger, but nothing worked.

Anyway, the delayed barrel chain explosion fix is a good enough workaround for me. Thanks again! :) 
Best Darkplaces Controller Analog Config? 
So, I'm trying to fine tune the analog stick movements so they aren't so twitchy. However, everytime I try to edit the config, it just doesn't do anything. I think I'm using the wrong commands. Darkplaces joystick config commands are so confusing so I don't know which one to use! Basically, I need it so that the character always moves slowly when the left analog stick on the 360 controller moves around. I'm using chase_active for my game, so if they need to see the player and it can't be too fast. If someone could give me the base settings and new better settings that I can tweak to fit the game, please do! 
iiuc, you can build clip brushes into non-world entities, but you do have to include a non-clip brush somewhere in the same entity.
But yeah, better to fix it via qc, if you have that option. 
Try using the fixed T_RadiusDamage from URQP (you can skip the dtype stuff though). 
Hmm just had a though they're probably not gibbing because the demon gib check is for less than -80 health. You could try increasing it. 
Garbled Centerprint Text 
Hi. I'm trying to get back into quakec so I can finally finish my mod I started ages ago. Anyways, trying to brush up and some things by starting simple. I added a reverseweaponcycle to Malice ( I found a source on github). I seem to be getting some garbled text when shooting buttons which activate secrets. For instance, in level 2, there is a button which is supposed to display "there are more to go) after you shoot it. But now it displays some sort of garbled text which includes some of the brown text. Any idea where I would look to see about fixing this? As in which source file? Thanks. 
The Malice src. is decompiled. So don't expect everything to work. 

I get that, but I don't know which of the files to look in to try and fix it. :( Been looking through other info to try and figure it out, but no luck yet.

I can't seem to register on insideqc and since quakeone changed, it won't let me enter text to post over there. :( This is the only other place I know to ask. 
Legend, Open Up Your Mind! 
The source is alright. The only thing your Quake engine cannot do is to print russian letters.

You might have noticed that EVERY print is like that. Not just the secret button text.

The fix is really easy. Just copy the english phrases into your Malice source. Overwriting the russian text and you are done. Use the ones from vanilla 1.06. It works like a charm.

Or you can switch from english to russian in your engine if it supports it :P

To give you a start: For your specific secret button issue replace the russian words in the function: void() counter_use into english. The function starts in line 170 inside triggers.qc in the Malice source.

The rest we can discuss at if you prefer. 
Wow. Thanks. I didn't notice the rest of the text because I kept testing off of a save file. I'll start poking around. Thanks again.

Unfortunately, I can't use quakeone anymore. I think it may be because my computer is too old and therefore my chrome version is outdated. I'm on xp. I can't enter any text in quakeone for some reason in order to make posts or replies. 
Any idea what this one is supposed to mean? "предмет выпал с уровня на". Using google translate, it comes out as "the subject fell from the level on". But I have no idea what that should really say or what the context is. It's in line 157 of triggers2.qc. Void() The_plant. 
Something To Do With Map Testing? 
I'm no expert, but as I understand, Quake has some tools for map testing. For example, if you place one of your entities like health/ammo boxes etc. too close to the floor when creating the map, there's a chance the entity falls of the level when you run it and get a message in your console for every entity that had fallen off the level. Maybe the line of code is referring to that? 
Malice Source Tweaks 
Thanks for the tips. Spent a few hours getting most pertinent messages translated back into English correctly. The last one I posted still escapes me. As well as one I find that translates into "Splitter" But no idea what it actually does.

Other than the translations, I have managed to add reverse weapon cycling and reverse item cycling. Is there anywhere I can post it when I'm finished so that an English source is available for all?

Also, any ideas on a fix for the probe not moving when selected? Is there a quakec fix for this or only an engine side fix within quakespasm?

Legend Is Everywhere 
Hello again my friend,

I noticed that you posted about your Malice issues in the Quakespasm thread as well. I would like to stay here in the coding help section to better keep topics together. Also because it is not an Quakespasm-only bug.

First of all I am glad that the russian-english tip brought you further in your project.

You brought up some other related questions which I would like to try to answer.

- Chrome is outdated:
You would be suprised who else is still using XP. Why not try and install firefox if chrome doesnt work. You can install and use multiple browsers.

- "the subject fell from the level on":
Like Esrael already wrote, this is a developer message. Please look at the vanilla function inside items.qc: void() PlaceItem
It is exactly the same. You can even use the original english text from there. Which is: "Item fell out of level at "

- minigun texture misalignment:
Please find a fix for it here:

- spy probe not flying in Quakespasm:
Never use setmodel() without setsize()
That is the main culprit here.
So, what you want to do is, open probe.qc and add after: setmodel(self, "progs/probe.mdl");
this line: setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
That will fix the basic issue and the probe works again.
But there is another issue with the code: Malice spawns it in relation to the players view and angle. That needs another fix to make the probe also work when it is spawned while the player is looking upwards:
Change this line: self.origin = self.origin + v_forward * 40;
To this: self.origin = self.origin + v_forward * 40 + v_up * 10;
That should do the trick for most angles and situations. The ceiling is normally always 10 units higher than the player. So that is no problem.

Best of luck with your version of Malice. 
Cool. Thanks again for the probe and message help. I was hoping the probe could be fixed with qc. :)

As for the browser, I do have firefox installed as well. Unfortunately it doesn't wanna work either as far as quakeone goes. :(

I came across that minigun skin you pointed out and it does indeed fix the issue. Though, I suspected it could have been an engine thing since messing about with graphic settings does temporarily fix it without the need of the new skin. Though I'm happy to just go with the skin for simplicity sake.

I posted in Quakespasm thread cause I believed the probe to be an engine issue.

Thanks again. 
Thanks I got the probe working now with your code. One odd thing is that it won't start moving until the player looks up first. As in, you can't activate the probe and immediately start moving forward. Is this how it originally was supposed to work? 
That Dang Probe! 
Something is eluding me here. I can make it it function, but only after the player looks straight up. I've even tried using code from spawning rockets to try and make it begin further out. I'm missing something. Any other ideas? 
No problems here, Legend.
I push the use button and right after that the fire button and it starts flying without even moving the mouse. It doesnt matter if I look straight, a little down or upwards.
Sorry, you must have done some wrong copy/paste.
I used the exact same lines I gave you.

Just in case, be sure to not use a previously saved game with your new progs.dat as the gamecode has been changed. Always start a new game/map and test.

Even in that tiny place at the start of map d2 it works as it should. I am using QS 0.93.
Try harder Legend :) 
Malice Probe Code 
Thanks. I'm using the same version of QS. Could you possibly look at my code and let me know where I went wrong?


self.probe_sound = time + random() * SVC_SETVIEWPORT;

Gotta love decompilers. :)
All those assignments to unrelated constants from defs.qc makes it really hard to read. Consider changing them because that'll be way more appealing for anyone willing to help. 
C´mon Legend ... :) 
I wrote:
So, what you want to do is, open probe.qc and add after: setmodel(self, "progs/probe.mdl");
this line: setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);

Unfortunately you added the new line at the wrong place. You must read more carefully.

You added the line after:
setmodel(probe, "progs/probe.mdl");
That is NOT:
setmodel(self, "progs/probe.mdl");
You set the model to the wrong entity.
probe is not self and self is not probe. ;)

You should not change model or size to different entities in one code block. That awakes evil things and the shamblers will hunt you for that :P

I am sure you can fix it by yourself now. Just reread post #2448.

Also, you still have the russian text inside your code...

Best wishes my friend.
And many greetings to osjclatchford. 
Ugghh. Of course it was just a simple silly oversight by me.

I cannot find any more russian in the probe.qc. I'm sure I may still be missing some in the rest of the files. Though. Which is my blind ass missing in the probe.qc though?

And btw, who is you is? Seven? Dutch? And how do you know I've been talking with osjclatchford? Are you psychic? A sorcerer? :O

Anyways, thanks again for all your help and explanations. 
What's up Legend!

Nope, it's not me. But I happened to see my name pop up, thought I'd say hi. I haven't been on the quake scene much anymore since Quakeone took a nose dive. I might jump back in after a while. Good to see you're still honing your code skills. 
A Newbie Here 
As some of you may know (including otp),this is ijazz2,except it's been a long time,with me having school and also getting selected for some NASA competition which means I go to LA from India in 2 months.Did I mention I forgot the password for ijazz2?

I have a small question.

How do I get weapons to replace other weapons?
(examples:Warhammer from Quoth,Axe<->Sword->Mjolnir from Drake)

I understand that this may take me a very long time to learn,but I am willing to do this.

I'm sorry for trolling. 
are you asking how would you put a different weapon in game? or are you asking how do you have multiple weapons bound to the same key on the keyboard? 
I am asking this:
If Ranger has an axe and he finds a sweet chainsaw,he picks it up,right?
But he has to drop the axe to have the saw.

In straightforward language:
How do I make the player replace the axe with another weapon on pickup?

As I mentioned,examples:
In Quoth,when you pick the Warhammer up,you lose the axe.

In Arcane Dimensions,you lose the regular axe when you pick the shadow axe up.Same goes for the SSG to Widowmaker and Thunderbolt to Plasma Gun.

In (whatever has been released) Drake, the chainsaw replaces the axe.
The sword and the axe replace each other on pickup(both have the same stats;only model differs)

Nailgun is replaced by Super Nailgun

Blaster is replaced by Laser Cannon

Weapons bound to the same key are there in an InsideQC tutorial,so I don't need to worry abotu that.Anyway I'm not gonna have multiple weapons on one key. 
self.items is where an entities items are stored.

What you'll want to do is remove the existing (to be upgraded) weapon from the players inventory, and then add the new weapon.

items.qc is where this is handled and item names are defined in defs.qc.

it should be fairly simple to do. 
It is a bit more involved than that.

For a custom warhammer/axe/whatever you will need the following... (using JazzAxe for example)

•Add a line float IT_JAZZAXE = 128; (assuming ID1, otherwise use next available value)

•Add a W_FireJazzAxe function that is a duplicate of W_FireAxe with damage you want instead of 20 and any other special effects you might want
•Above W_Attack add a line "void player_jazzaxe1 ();" without quotes
•Inside W_Attack add an if statement that checks to see if (self.weapon == IT_JAZZAXE) that then goes to player_jazzaxe1 ();

•Copy and paste all 4 functions of player_axe1, player_axe2, player_axe3, player_axe4
•Add "jazz" (without quotes ofc) in front of axe1, axe2, axe3, and axe4 in the function names
•Change W_FireAxe inside player_jazzaxe3 function to be W_FireJazzAxe();

•Copy weapon_nailgun function (or any other weapon), paste, and rename to weapon_jazzaxe
•Change inside weapon_jazzaxe self.weapon to be IT_JAZZAXE, self.netname = "ijazz2's bane";
•Inside weapons_touch add an if (self.classname == "weapon_jazzaxe") new =IT_JAZZAXE;

I probably missed something. 
You forgot W_SetCurrentAmmo?

Anyway,thanks for helping.You probably should changed your username to QCMaster. 
An Unnecessary WIP 
you shouldnt need to do any ammo checks with melee weapons, unless you're building a melee weapon that uses ammo, which would be pretty cool too. 
Sorry For Multi-post 
QMaster,I have a problem.
I'm using the AD Shadaxe model for jazzaxe.
FTEQCCGUI compiled without error,but when I try to select the weapon (after picking up) it just switches to the shotgun.The model appears for a split-second then the shotgun appears.I cant use it.

Then I tried (using an InsideQC tut) to make the weapon switchable by selecting axe twice.
Problem is still there.

I've ran into that before...might be a conflict with whichever bitflag value you used for IT_JAZZAXE. Can you upload a zip of your qc files? I might be able to take a look at it. 

This one has a few changes from standard id1,including the code which seems to be wrong for the Jazz Axe and some AD-inspired health model changes (.bsp to .mdl) 
Add if at the bottom
if (self.items & IT_JAZZAXE) return IT_JAZZAXE; else return IT_AXE;

And just below that in W_CheckNoAmmo:
inside the if (self.weapon == IT_AXE add "|| self.weapon == IT_JAZZAXE") 
Something is not right.

CheckNoAmmo does not have if (self.weapon == IT_AXE) part! 
i'm out of axe ammo! 
? From The Weapons.qc In The Zip You Sent Me... 
float() W_CheckNoAmmo =
if (self.currentammo > 0)
return TRUE;

if (self.weapon == IT_AXE)
return TRUE;

self.weapon = W_BestWeapon ();

W_SetCurrentAmmo ();

// drop the weapon down
return FALSE;
Never mind,found it.FTEQCCGUI has no Atrl+F combo!!! why!!!!! 
QMaster,the problem is still there.
I did some checking but I can't find anything wrong. 
in checknoammo shouldint you also add if(self.weapon == IT_JAZZAXE) return; ? 
otherwise it says you have no ammo jump to SG 
otherwise it says you have no ammo jump to SG 
if ((self.weapon == IT_AXE) || (self.weapon == IT_JAZZAXE))
return TRUE; 
Yes,I added that.It sill switches to SG after showing JAZZAXE for a split second. 
hmm what about ‘rankforweapon’ function?
im just thinking off the top of my head been awhile since i did the ol double tap
impuls to switch weapons; i had once made the lg
double as a flame thrower
you might need to add your axe there too 
Have you looked at client.qc?

There's a line

if(time > self.attack_finished && self.currentammo == 0 &&
       self.weapon != IT_AXE)
   self.weapon = W_BestWeapon ();
   W_SetCurrentAmmo ();

I suspect you need to change that last test to also consider IT_JAZZAXE
I am sorry.It does not work.Still switching after a second.

I am going to try and hunt down the warpspasm decompiled code I gave someone when I played Quake 2 years ago before going to Half-(my)-Life.

But please,try helping me.I might feature you in my mod. 
Just Checking 
What did you change it to? Was it this:

if(time > self.attack_finished && self.currentammo == 0 &&
self.weapon != IT_AXE && self.weapon != IT_JAZZAXE )
Thank You Sir 
You have saved me a complete rewrite.
Now,the world shall remember you as the savior of QuakeC.

Go Preach! 
Lol, Preach Is Always The Qc Master 
You Guys Might See 4 Teens Around 14-15 Age. 
They also will ask questions like these.Why?

Those idiots are my classmates! 
PDF For Beginners 
I created this PDF from a forum post on QuakeOne. This may be useful information for users new to QuakeC. 
Seconded That 
The way I found the problem line for the jazz axe was searching the entire sourcecode for every example of the keyword IT_AXE, which lead me to the one you hadn't changed yet. 
(from discord chat, I've chopped it down to just give the salient points)

Kinn - Today at 10:19 AM
I've had the "grenades occasionally clip straight through shamblers" bug plenty of times in vanilla quake. I'd totally forgotten it was a thing. Is it still a thing in QS etc?


c0burn - Today at 8:18 PM
entities are re-used
when an entity is removed, not all fields are cleared
the shambler code sets self.owner = lightningbolt


[editors note: player then fires a rocket/grenade, spawning a new entity just after the lightning ent has been removed]

c0burn - Today at 8:21 PM
the shamblers .owner field is set to your rocket
so it passes straight through


c0burn - Today at 8:21 PM
you can just set self.owner = world to fix it
when the bolt is removed
or not set self.owner
really it should be bolt.owner = shambler


Kinn - Today at 8:27 PM
holky fuck 
c0burn gets the Preach award for April. 
The Shambler needs to store a "link" to the lighting flash, just so that it can refer to it over the next few frames in order to animate it. There is no special reason why the Shambler has to use the ".owner" field to create this link. It could have used another entity field. Using .owner for this is a pretty dumb hack and as we can see, just invites bugs.

IMO however, the cleanest fix would be to not actually require the Shambler and flash to be linked like this - I would personally simply spawn the flash, and make it animate by thinking for itself (like the rocket explosion does.)

BONUS POINTS: notice also that whilst this is all kicking off, the Shambler sets self.effects = self.effects | EF_MUZZLEFLASH;

This has the (probably unwanted) side effect of disabling animation interpolation on the Shambler during its lighting attack.

If you made the lightning flash animate itself, as suggested earlier, you could also throw the muzzleflash effect on the flash ent instead of the shambler, controlling it through the flash anim functions. This will re-enable anim interpolation on the Shambler, and disable it on the flash - which is kind of what you want. 
Some Extra Detail 
when an entity is removed, not all fields are cleared

To expand on this part a bit: behind the scenes entity variables store a number. That number represents how far down that entity is in the list of entities - it's also the number you'd use with the edict command to print it, so the number isn't entirely hidden.

Suppose the lightning entity is number 666 on the list*. When the shambler spawns the lightning, it stores the number 666 in its owner variable. When the lightning gets removed, all of the data in slot 666 is cleared**, but the shambler entity isn't modified in any way. So the number 666 stays in place.

The only thing that will ever clear the value 666 is if the shambler spawns another lightning bolt, which will replace 666 with a new entity number. Until that happens, any entity which spawns in position 666 will be the shambler's owner (and so noclip through it). An entity slot won't be reused until 0.5 seconds has passed since the previous occupant was removed, so firing a rocket half a second after the lightning disappears is the easiest way to reproduce the bug.

The only reason this is really a problem is because the engine does special things with the owner field. In a normal entity field, the value 666 hanging around would be completely benign, as the shambler never does anything with the field except during the window where the lightning is spawned. So just changing the entity field the value is stored in will be enough to handle the bug.

*pedants corner: assume we're using an engine with raised limits so that entity 666 is valid.

**in fact in the original implementation, only a small amount of the data is cleared at the point when the entity is deleted - just enough to prevent it affecting the game further. The real deep clean of the data only takes place when the slot is reused. Until then you can access most data from the "ghost" of the previous entity - but don't ever depend on that behaviour as engines are liable to change it. Just something to be aware of when trying to debug issues. 
Quick and dirty memory management? in MY C code? It's more likely than you think! 
Concatenate Strings? 
I'd like to make an entity's targetname consist of two strings that both contain targeting information, but there doesn't seem to be an obvious way to concatenate strings. strcpy() and strcat() are unavailabe, and I haven't found a single example in the id code where concatenation is used.

Is there any other way to create a targetname from two strings I'm unaware of, or do I have to use a seperate field for the second string? 
Separate Fields 
Standard QC doesn't contain a way to concatenate strings, all strings are immutable things that you have to just take as they come. There are some complicated ways to output combinations of strings or characters to the console or the screen, but they can't be employed for logical string comparison in a sensible way. 
Abandon All Hope Ye Who Concatenates Strings 
the vanilla engine has only two ways to concatenate strings.
The first is that some of the builtins that accept a 'single' string argument will perform an implicit strcat. this is useful primarily for centerprint, but also works with bprint+sprint+error+objerror too.
The second is that console prints don't have any implicit new-lines, so you can just call sprint 50 different times to construct a single line. There are numerous mods out there that do things like this in order to try to print various numbers etc.

Other than that, you're screwed. Have a nice day.

If you're okay with requiring engine extensions, fte+qss+dp all have strcat builtins, and are all mostly compatible.
However, note that each of these engines have different temp-string behaviour. Strings in QC are essentially just pointers, so the memory that the pointer/string refers to can actually change and contain some other string entirely (usually as a result of calling other builtins that return temp-strings).

vanilla: ftos and vtos both return the exact same bit of memory, with every single call.
qs/qss: multiple temp strings - after 16 different temp-string-returning builtins have been called (from anywhere) it'll start reusing
the oldest temp-string. Use strzone if you want it to last longer.
dp: unlimited temp strings - call strcat or whatever as much as you want, but they'll ALL be forgotten once the QC returns to the engine, so ANY field or global that contains a tempstring will cause warnings when saving the game, etc. Use strzone still to avoid that.
fteqw: persistent temp strings - call strcat or whatever as much as you want. Store them in fields too, if you want.

Actually, there is a way to do strcat even in vanilla, but its so evil, obtuse, and just generally annoying that I'm not going to describe it. It also breaks compatibility with almost every other engine too, and can even be broken by just the C compiler that the engine was compiled with!

So if you're explicitly targetting vanilla and your targetname thing, just use two fields.
Whereas if you're doing more complex stuff, then you'll need to get people to stop using vanilla or quakespasm, and start using a decent engine instead that actually supports strcat (probably qss, because its basically just a super-set of quakespasm making it an easier engine to 'sell'). 
get people to stop using vanilla or quakespasm, and start using a decent engine instead

Eat shit, you gigantic self-fellating cuntflap of a non-person. 
OTP, if your definition of 'decent' is one that leaves things crippled and requires obtuse workarounds, then that's your problem, not mine. 
Your engine can have every thing ever requested by mappers and players alike and itd be nullified by the lack of documentation.

Want us to make the switch? Create some documentation. Make the source easier to access. I have reasons to use your engines but the lack of documentation is a huge turn off 
Use the pr_dumpplatform command and then just read through the resulting qsextensions.qc file if you want a list of the added qc extensions. Read the included comments if you want to figure out how to actually use it.

For particle effects, you can find some specs on fte's svn, or if you're sticking to dp-compatible stuff then you should be able to find info on that stuff on dp's site somewhere. 
Use the pr_dumpplatform command and then just read through the resulting qsextensions.qc file if you want a list of the added qc extensions.

Does this actually work in QSS? I can't find the resulting qc file 
you mentioned once that CSQC for custom HUDs could be coming for QSS - is this still planned? 
Another Question 
Now here is another thing:
Today I was testing and I noticed that no matter what ever T_Damage value I set for W_FireJazzAxeJazzaxe deals the same damage as in FireAxe.

I had set damage 40 for jazzaxe earlier and today I noticed it took me the same amount of hits to kill a shambler with the regular axe and jazzaxe.

Then I changed the regular axe damage to 600 and both axes kill the shambler instantly.

How do I fix this?
I want the jazzaxe to replace the normal axe like with the hammer in quoth and the jazzaxe should deal its own damage.
How do I do that?

(also I seem to have figured out how to add sounds like when you hit an enemy in AD and Drake.) 
I can't be sure without seeing the code but it sounds like W_FireJazzAxe isn't being called.

First step would be checking W_Attack further down in weapons.qc and checking that your (presumed) if (self.weapon == IT_JAZZAXE) clause is pointing to a different player animation function than the normal axe.

If it is, then check that the relevant function in player.qc contains W_FireJazzAxe() instead of W_FireAxe() 
add a call to error("function name here"); into both functions.
then you'll see which one is actually getting called.
it should also give you a stack trace, so you can figure out where its getting called from too.

(or if you're using fteqccgui+fteqw, you can just set a breakpoint and then step through the code.) 
I Got It! 
The problem was this

void() player_jazzaxe1 = player_axe,not jazzaxe! 
I Would Like A Little Bit Of Help 
So now I migrated to Rubicon Rumble Pack's code.With some of my changes.

I have some questions.Again.

1.How do I add a weapon? All the bit values upto 8388608 are used.And I tried 16777216 but it doesn't seem to work.

2.How do I do that subtraction thingy with self.items?
How does it work,anyway?

3.I checked out the Keep mod by QMaster,and it has a self.items2.What is the self.items2?
How do I add it in my mod?

I know I can just do a .float self.items2,but how can I manipulate it?

I Would Like A Little Bit Of Help 
So now I migrated to Rubicon Rumble Pack's code.With some of my changes.

I have some questions.Again.

1.How do I add a weapon? All the bit values upto 8388608 are used.And I tried 16777216 but it doesn't seem to work.

2.How do I do that subtraction thingy with self.items?
How does it work,anyway?

3.I checked out the Keep mod by QMaster,and it has a self.items2.What is the self.items2?
How do I add it in my mod?

I know I can just do a .float self.items2,but how can I manipulate it?

I don't want to clog this thread with my questions so I gave my email. 
Use Notepad++ 
It has a search in folders option to let you find every instance of .items2

.items2 was derived from the rogue mission pack since .items ran out of bits. 
So in which file can I find a way to derive?

Do I just add

.float items2 in defs.qc?

Then how do I add stuff to it? 
Treat It The Same As Self.items 
Ya just add it to defs.qc or anywhere in the compile order before you use it.

Add in any IT2_JAZZYSTUFFBITS = 1, 2, 4, 8, 16, etc flags. The only really tricky bit is in situations like weapons where you need to know when to check .items and when to check .items2 or you'll be able to switch to weapons you don't have, or accidentally give yourself quad or something. 
Can Teleportation To A Random Destination Be Done In Qc? 
if a trigger_teleport has multiple destinations with the matching targetname, it will always pick what I assume is the the one that is loaded first in the map and therefore has the lowest index of some sort that the find function looks for. I'm not really sure how it works since find is only defined as #18 in the code. I'm not very well versed in qc or regular c for that matter. I implement stuff by deriving heavily from existing code, so I'm at a loss here.

I need a more thorough find function that takes an additional index parameter that returns the first entity whose targetname and index match the given arguments. Then I would only need access to the amount of entities with that targetname and could generate a random number between 0 and that amount to use as the index argument.

I assume the reason find isn't defined in qc is that the the finding process can only be done by the engine, which would be a death sentence for my mod. I stand even less of a chance of understanding complex engine code than qc, and even if I did manage it the mod would be dependent on my custom engine branch which would make it an even harder sell to potential players.

I'm pretty much ready to throw in the towel, but I figured I'd try consulting the mighty code wizards first. Is there a way you could see making random teleportation work without engine modifications? 
just call find in a loop with the first arg set to the previous call's return value, until it returns world.
you then know how many matches there are, and you can pick a random index and select that destination with a second find loop.
no engine changes necessary. 
Thanks Spike 
works like a charm 
Here's a sneaky way to randomly select while only looping through the list once 
Post 2513 
If my memory serves me well,
Custents has a random teleport code.
Or was it nsoe_devkit? 
It's Getting Annoying 
I keep getting this error
Warning Q208:progs CRC not recognised from quake or clones.
This always happens.
If I make a new weapon to add to RRP?
Copy the fx_beam and telefrag?
Part of my code is copied and modified from RRP,Custents and some other sources.

Today I had to reset all my code because of their error.I call it an error because it compiles,but you can't run the game.

How does this warning happen and why?
How should I fix it? 
Warning Q208:progs CRC not recognised from quake or clones.
This can be translated to:
Don't fuck with the initial part of defs.qc

NEVER change 'ANYTHING' before the 'end_sys_fields' line of defs.qc or you get that warning.

(actually, you can change comments, add some preprocessor (like #pragma warning error Q208 etc), etc, but if any of the basic types or names changes, or any symbols are added or removed, then you will have problems as the interface between the engine and progs will end up incompatible.)

(one option is to just include [fte|qs]extensions.qc (not dp's though) before your defs.qc, as it includes systemdefs appropriate to its configured target. you'll also get extension builtins defined for you.) 
Or Use A Separate Defscustom.qc For Your Mod Variables. 
Thanks Qmaster and Spike.
I'm using a custom Def's.qc called astaf.qc,which was the name of my cancelled Half Life mod. 
Sorry For Double Post 
How do I use the Gyro library?
I've added it to my mod,but it's a little confusing.
I think I'm going too fast,this is my first mod after all. 
Sorry For Double Post 
How do I use the Gyro library?
I've added it to my mod,but it's a little confusing.
I think I'm going too fast,this is my first mod after all. 
Sorry For Double Post 
How do I use the Gyro library?
I've added it to my mod,but it's a little confusing.
I think I'm going too fast,this is my first mod after all. 
It's Been A While 
I haven't messed with Gyro in ages, but you might be able to take a look at how things were done using it in the SMC (Small Mod Compilation) created by sevin:

I'm stuck in an airport for a few hours so maybe I can poke around and let you know what I find. 
bumpity bump bump 
I Haven't Found A Working Link For Gyro Yet So... 
..a Mammuth Sized Shambler ! Headed To Preach..but Not Only 
Hi.. is it possible to create a huge Shambler (10 times the player size) ? What about bouncing-box issues ?
What qc changes needed ?
My map is called "Hunt 4 The Great White" 
Komagama Muth 
Here's one. I made it eight times as big as the original.
Bouncing box extends automaticly.
If you use it without changes it flashes from its heels, and can only be hit when you hit it in its foot.

Just for try out, replace it in your progs with the original one and give it enough space.
The best way to make it addepted is by mulyiplying all counts of walk and run with 8. Also the magic lightning will need that number.

I included a mdl and a probable qc, no idea what will happen.
Didn't test the beast. 
Some Adds 
I made a quick try and it seems to work, unless...,
you delete the original shambler out of your qc as all names are the same.
If you need small shamblers too, then give all related names for shambler in the new qc file another name, ie mamuth.

The bouncing box doesn't fit, it's way too small. Although I altered them too. Also the lightning emerges so high its inside its corps. So some alterations are needed here.

I was afraid the skin would look horrible, but that isn't the case.
I just can't escape from it as it moves that incredible fast. 
Bouncing Box? 
Is that what we are calling the bullet interactable box now to distinguish from the physical box?

BounDing box max is hull 2 size of 64x64x80. However, setting the size of a monster to something larger in qc allows bullets to hit it at the larger size even though its physical size is the same. E.g. It could still fit in 81 unit high spaces however, and have its model sticking through the ceiling. 
Oh Thanks To All.. Another (fancy) Question 
supposing I make a total conversion eligible for sale commercially.. what exactly is gpl ?

-I've read that qc code(progs.dat)also is an "asset" because is read by engine as data ?!
Then should I rewrite it all from scratch ?

-And what about the .exe's(glquake.exe,winquake.exe,darkplaces.exe,fitzquake.exe) since are not included in id released source code ! 
My Name Is Madfox And I Want My Money Back! 
GPL is a copyleft license for software, devised by Richard M. Stallman of GNU, who (in short) states that you can use the software to do what you want, including customizing and selling, provided you pass that right on to others and the author. (s) of the software. In concrete terms, the foregoing means that if you want to distribute software that has been published under the GPL, the source code will have to be added. This source code may then be further distributed under the GPL. Anyone can choose to publish his or her program under the terms of this license.

You don't need to rewrite it, as long as you include the code you might have read the scripts that are in the qc that state:
Copyright (C) 1996-1997 Id Software, Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

See file, 'COPYING', for details.

But seriously komagama, I thought you were mapping for fun. I understand your considderation of making a commercial project but then why not start with something like gamemaker?

I'm mapping for several years now, I have only the love for the game, and when I ever had the intention to sit on iD's hat for making a commercial addon I probably had stopped many years ago.

Don't get me wrong, I don't want to disappoint you, but I've seen it before. People with the best intentions to make a coin out of hard earned worked getting screwed off by others who just wanted a piece of the (qc)ake.

Anyway, it is your decision. But watch out, I would love to play your map for free, but if you would ask money for it I would become so critical you wouldn't like your own map anymore.

So I'll start with ten bitcoins for the advice I gave.
Just Kidding Komagama 
You can find the correkted file here.
It's the mamuth.mdl of the super shambler, the h_mamuth.mdl of its head and the mamuth.qc.

If you compile this file you can use it with the normal shamblers in your map, with this result. The bouncing box is right his size.

Only thing left is tweaking the size of its lightning, but I supose it will always be beyond the player view, due to its size.

Succes with it, curious to your map. 
Thank Madfox.. But 
i'm not a noob in game-designing, sorry if I gave that impression.. Fact is there's something in gpl quake code that I cannot understand:
help me if you can:
-may I use big portions of Id qc unmodified (ai.qc, buttons.qc, monsters.qc) ? Carmack stated that you can create your standalone game based upon that code.. 
Would you look at that mammuth shambler! :3c It's so big and clumsy. He'll never be able to reach the "mouseholes" the player escapes into.

Which reminds me, compared to the regular shambler, has the movement speed been increased for this adorable little monstrosity?

Nice work, btw! ;) 
@komagama- well, I'm a noob in gpl code, so I can't help you out.
Maybe someone else.

@Esrael- Mouseholes? That's where the little Shambs come in.
I'm more concerned when it dies the player walks 96 units in shamb space nothingness.
And as I wrote: I just can't escape from it as it moves that incredible fast. 
The QC code is not under the GPL. However, when I talked to someone at id before they were sold to Bethesda, they expected people to handle the original QC code in the same way as the engine code, which means keeping the source open. 
You Heard The Man 
QC please! Chop chop. That means you. Haha. 
Broken English 
mamuth groans I'm too Q to see. 
Oh.. My Headache.. 
now I know why nobody made commercial tc based upon this engine.. aha
Anyway the official released from github includes qc files so they must be gpl as well :) 
The ogre has a pull pose of 11 frames which won't be used in the qc. What should have been its purpose?

I'm retrieving the Qtest1 qc, without any luck.
I'm using the one from Megalol, which luckely has a progs.src
Only problem is that it is casting more than eighty nine warnings.
It seems to me that a lot of it is just a replacement of the original qc.

I spent a whole evening just to get rid of the first moveangles to moveangles2. Is it realy that bunch of spagetthi? 
Projecting Text To A Quad 
are there any examples out there of projecting text to a mesh using an engine like DP or FTE? Or even just dynamically creating a texture and assigning it to a mesh? 
With an animationmaster it is simple, but I know you won't have obviously. You might try max3d or gmax. Here's an example I made.

Or hand me the file and I can see what I can do for you, beer me up, scotty
That's Pretty Cool 
but not what I meant :P sorry, I didn't explain clearly.

I meant taking plain text from a text file and projecting it onto a quad or converting it to a texture dynamically to be assigned to a mesh. If that makes sense. 
Blender can make polygonal text...not quads though.

Best bet might be to make an alphamasked sheet texture with all letters and numbers on it...then assign UV to uach letter for quads.

For quake mdl format you might be able to have 1 quad for each letter/number/rune and have only one quad visible per frame....then in-game you could set the frame number for the letter, but that's a boatload of work. 
If you know the direction your quad faces and the tangent+other one then you can generate the text from csqc with beginpolygon in 3d space.
If its co-planar, you'll need to use stuff like polygonoffset and/or pay attention to shader sort ordering.
This will work in both FTE and DP. The shader tricks may not, however.

Alternatively, a shader with 'deformvertexes textN' will replace a quad surface with the text in the r_shadertext_N cvar(s) (the shader's texture should be a 16*16 grid of chars).
This will only work in FTE.

The third option is to use render-to-texture, and to draw your text that way (which means it can also support unicode etc easily, or even other scenes). You can then use .forceshader or whatever to wrap it over even non-planar surfaces on some target entity.
'map $rt:foo' in your shader, possibly via shaderforname.
setviewprop(VF_RT_DESTCOLOUR, "foo", 1, [width,height]);drawstuff(); setviewprop(VF_RT_DESTCOLOUR, __NULL__);
This will only work in FTE.

Or you can use r_uploadimage and scribble over a texture from QC (which basically requires pointers+ints and masking), FTE-only.

You can also use rtlight cubemaps to dynamically project a texture, but this assumes you've a number of prior cubemaps to select between. You really don't want to use one per letter.
You could also use one sprite per letter (or more realistically one sprite-frame per). Will at least scale better than rtlights... 
@qmaster - that sounds... crazy :P

@spike - exactly the info I was looking for, thanks! 
I'm adding old sprites to Quake1Test maps.
I added some lines on misc.qc for a new light_large_flame,
and to world.qc and it comes up in game.
Only eddict is : R_drawsprite: there is no such frame 1
Does the QTest torches use framegroups in their sprites? All frames will cycle through frame 0 then. No need to animate manually.

Most Quake sprite editors can't generate framegroups. 
What Does Edit Framegroups? 
Also the first frame is frame 0. 
Never Got Out That $pr1te Thing. 
Here's my statement I'll think.

Sprites: Torch (s_torch4.spr) comes through right.
Flame_ball sprite (s_torch6.spr) comes through with error:
R_DRAWVIEW : No Such A Frame1

and it keeps rolling on screen..,

Or better, download following.
Here are my poor reasults for making a SinglePlayer QTest1.mod. 
s_puff.spr and s_statue1.spr and s_telep.spr have (nogroups) frames.
s_torch4.spr and have (Group 0) frames.

How do I change them from Group0 to nogroups?
I use FimG and the window indicates Group Properties but leaves blanc. 
You don't need to modify the sprite, you just need to remove the animations you coded in the QC code.

If you don't use makestatic() in your torches, they will consume more network bandwidth and can generate packet overflows. And if you use makestatic(), your QC animation code will not work. Framegroups solves this problem, by making their animations client-side.

Also, from Fimg's help:
The sprite format used by Quake is the first game sprite format supported by Fimg. However, some of the design ideals of Fimg and a few aspects of the Quake Sprite Format are in conflict. As a result there may be a few things you need to know about Quake sprites before you use Fimg to edit them.

Quake sprites are composed of a number of frames. Each frame either consists of a single, unpaletted image or can be in a 'framegroup' where it is then composed of 1 or more unpaletted images. If the sprite contains no framegroups, Fimg will load the sprite as a simple animation sequence under a Fimg group titled "[no group]".

Fimg was designed to support a more general method of grouping frames where each group is an named animation sequence composed of a number of frames. As a result, if a Quake sprite has any framegroups, it will be loaded differently than previously described, where each 'frame' of the image is treated as a seperate animation sequence group. Each frame will in turn be named "Group X". where X represents the original frame number of the animation.

If Fimg loaded the sprite as a simple animation sequence, the only group will be named "[no group]". The Quake sprite saving routines look for the name "[no group]", and if found and it is the only group present, the animation will not be grouped. Therefore, if you'd like to group the frames for the animation, simply choose Groups->Rename from the menu.

When in a framegroup, each frame has a "Duration" key that indicates the delay for the frame. See the Properties Editor for more details. In addition, all frames have Origin values. See the origin tool for more details about this.

In addition, there are global properties for the file. For clarification, they are:
· Beamlength = Appears to be unused within the engine and is related to Doom style upright sprites.
· Radius = Is normally auto-calculated. If the size of the sprite changes, it is recommended you delete this property so Fimg will auto-regenerate it.
· Synchronous = When auto animating in a grouped frame, should the engine synchronize all instances of this sprite? If, for example the sprite is a fire, having all fire sprites start on the same frame would look ugly and obvious.
· Orientation = How the sprite will orient in game. The only two modes supported by GLQuake are "Oriented" which means the sprite will obey it's orientation and will appear as a flat plane, and VP Parallel, which means the sprite will appear as always facing the viewport.

These can be found by clicking the File Properties button or by clicking File->File Properties.
That clears up a lot. I'll see through it.

I exported all frames from the sprite back into FimG and it was declared as (nogroups).
All flames turn into one frame, but no warnings,
Hello, I would like to make flight physics for player in quake. I mean gliding in the air while player is falling, so it shouldn’t be just slowing down while falling, it should be something like paraplane or paraglider physics.
What I want to realise:
How it can be done in games:

I use sv_player.qc for working with player physics. Also, I am using dpextensions.qc as I am trying to make that on darkplaces engine.

I found some information and documentation about QuakeC on insideqc but still nothing helped me.

Does anybody knows how to realize gliding physics on quake? 
Maybe one chance for something similar is to find Zerstorer QuakeC devkit and see what the "wings" powerup does.

I tried it once but can't remember what it was like to use it. Is it in any of the Zersteror single player maps? I can't recall, but I'm not too much of a "find every secret" type. 
There are Parachutes and Skateboards in the Malice code.
Maybe a good chance to start.

Wrong Link 
i think basically, every frame the player is airborne you want to reduce negative z velocity to a target falling speed, and accelerate forwards up to a max forwards speed.

if you look at the ladder code in rubicon 2 you can see that i'm modifying player velocity whenever player is on a ladder. You can remove the ladder check and add check for onground, and then do your velocity modifications the same way. 
Sure, I heard of Parachute in Malice, but that is not really what I need. I also should work with horizontal velocity and vertical velocity to make dependence between them like in real glider. I don’t need just to “slow down falling” 
I Thought Wings 
...thought wings were in Nehahra. Every time you tapped jump you lurched up a bit and you slowly drifted back down. Kind of like an infinite double jump. 
You could also set player .gravity to something like 0.4 or 0.5. 
What you want is a MOVETYPE_FLY that's slightly affected by gravity, and with lower friction.

I don't know if sv_friction affects MOVETYPE_FLY, or if the aerial friction is hardcoded. 
I thought about things that should be realized so it could work:
1. I should make flight vector. This vector should follow view angle vector but with a small delay. That makes our flight more realistic. Also it allows to set maneuvering.
2. When player falls down he accelerate, when he looks forward he slows down.

I have some suggestions how it can be done:
1. vector fly_direction, float m;
if(fly_direction != self.v_angle)
if(fly_direction_x != self.v_angle_x)
fly_direction_x += (self.v_angle_x - fly_direction_x)/m;
if(fly_direction_y != self.v_angle_y)
fly_direction_y += (self.v_angle_y - fly_direction_x)/m;

float coef;
//fly acceleration coefficient
coef = ((self.v_angle_x-45)/90);
Please help me to translate that into quakeC properly 
Possible Version 
Here's what I'd do, roughly:

//convert current velocity into speed and direction
speed = vlen(self.velocity);
olddir = normalise(self.velocity);

//convert angles into a normalised heading

//add a small amount of the heading to the current direction of travel
newdir = normalise( v_forward*frametime + olddir*(1-frametime));

//preserve the speed we had, but change the direction
self.velocity = newdir * speed;

//reduce the strength of gravity based on how level we are currently flying
self.gravity = 0.1 + 0.9*abs(v_forward*'0 0 1');

Some of the values might need tuning here and there, but that should get you started. Player movetype should be left as default, because we want gravity to apply (subject to the last line reducing how fast we fall. Haven't tested this, so it may be rubbish... 

should of course be

use dotproducts:
upspeed = self.velocity * v_up;
fwdspeed = self.velocity * v_forward;
rightspeed = self.velocity * v_right;
(vec*vec is a dotproduct).

You can then get back to the original velocity vector with:
self.velocity = v_up*upspeed + v_forward*fwdspeed + v_right*rightspeed;

Of course, if you change some fraction of the force exerted on the underside of your glider before reforming the velocity then you'll reduce the effects of gravity while horizontal, and return to normal when facing vertically down.
Of course, that energy should normally go somewhere - if you add to fwdspeed anything you subtract from upspeed then you should get something a bit glidery.
you'll also need to include some friction somewhere, in order to get some terminal velocity. and yeah, the conversion should probably also not be 100% efficient either, nor should it convert ALL the energy.

but yeah, dotproducts are great if you want to compare two directions. trying to do stuff like this without using them is just going to leave it feeling really hacky.
Unfortunately there's no real way to control the camera from ssqc, but csqc can override the camera angles without changing the client's 'desired' angles. you should be able to implement roll that way, somehow. 
Notes After Testing The Suggested Code 
Had a go with the code from my post on Saturday, it worked pretty well for a first attempt. I did find that it wasn't responsive enough until I doubled frametime everywhere it appeared. One big tip for testing it - use e1m8. Firstly because its one of the few ID maps with enough vertical and horizontal space to glide in properly, secondly because it's low gravity so it's much more fun!

It's got most of the effects you'd want to see in glider physics - you can dive down to gain speed then level off and carry the momentum forward, and if you look up you'll gain height but bleed forward speed. You can look straight up, and you'll quickly stall then crash to the ground. Also if you collide with walls etc your speed is lost which tends to end the flight pretty quick.

One advanced trick: you can accelerate in Quake while in the air. If you're gliding, strafe left while turning in an anticlockwise circle and you'll gain speed (same principle as bunnyhopping works on). You can use this to offset the loss of speed while climbing, and gain height by moving in a big spiral. 
Preach’s Code Test 
Hi Preach, yesterday I arrived to my PC and I got an error after compiling your code. May be I have done something wrong. Could you please post a full file with your code so I could test it out? I think that would be useful for all the community. 
Maybe if you post the error you're getting we can help you out ... 
Skeleton Code 
I tried to post it as skeleton code so that you'd get some practice hooking it up. One thing I did unintentionally was to misspell (well, anglicize) a built-in function name, so make sure you change the spelling to normalize. If that wasn't the error that's stopped you, post it like c0burn says and we can suggest fixes. 
Still no result. I try to use this code if no flag on_ground is false but nothing works. 
New Issue 
Hi Reyond. It sounds like it's a bit further on if the compiler error has gone away. What function are you running the code in? I ran it in PlayerPreThink so that it would happen every frame. You're right to disable the code when the player is on the ground, but from your description I don't know whether the code you have is right.

I used: if(self.flags & FL_ONGROUND) to see if the player was on the ground. I also turned the code off while the player was in water using the check if(self.waterlevel) (although that's a detail to add once the basics work.

If that doesn't help, post the whole text of the code you're using and maybe we can spot what else it could be... 
Tut From InsideQc 
Found an old tutorial from Legion with an Xman version of a FlySimulator. Maybe helpfull as a guide. 
Allright, I found an error. Here is how I use the code:
else // airborn
vector fly_direction; vector new_dir; float fly_speed;
float fly_velocity; '
float koef;
if (wishspeed < 30)
f = wishspeed - (self.velocity * wishdir);
f = 30 - (self.velocity * wishdir);
if (f > 0)
self.velocity - self.velocity + wishdir * (min(f, sv_accelerate) * wishspeed * frametime);
fly_speed = vlen(self.velocity);
fly_direction = normalize(self.velocity);
new_dir = normalize(v_forward*frametime +fly_direction*(1-frametime)); self.velocity = new_dir * speed;
Yes, actually it looks a little bit like gliding but I can’t understand how the code works. Why do I use frametime if this function works every frame? How this code affects the gravity (in-game gravity is 100 now). And how can I improve this code to make it work better?

Also, I would like to make it works without changing the standart “800” value of the sv_gravity variable. Is that possible?

Also, thanks to Preach and to everyone who helps me in making player gliding in quake. 
Try It Out 
Have a go with the second-to-last line changed to

new_dir = v_forward;

This leaves out the bits with frametime. What you should notice is that while gliding, you instantly start moving in exactly the direction you are facing. It's very easy to control, but it's not very realistic for a glider - you can 180 turn instantly at any time.

The idea behind the frametime code is to add the v_forward part more slowly, so that your direction of travel doesn't change instantly. Instead we add the v_forward in a bit at a time. Because the function runs every frame, we need the pieces we add to be smaller when the framerate is higher, otherwise people with higher framerates could execute tighter turns, which would be unfair.

I found that in practice the rate of change was too slow, and that it was better to change that line to:

new_dir = normalize(v_forward*2*frametime +fly_direction*(1-2*frametime));

By making the piece we add each frame twice as large, we get a better trade-off between smooth turning and reaction time.

In terms of making the glider float, I noticed that you don't have the last line from the code I posted:

self.gravity = 0.1 + 0.9*abs(v_forward*'0 0 1');

I expect you were getting a compiler error from this line that you didn't know how to fix. The secret is to add the following to the bottom of defs.qc:

.float gravity;

This warns the compiler that you'd like to be able to store a float called "gravity" on all the entities. The engine uses this to change the gravity just for that entity. So if you are flying in normal 800 strength gravity, but the player has self.gravity = 0.1, for that player gravity will be 80 instead (because 800 * 0.1 = 80). All other entities are unaffected, try firing a grenade while gliding and notice that it falls normally.

Give it a go, see what comes of it! Any more questions, just ask... 
Error: unknown value “abs”. 
To Reyond 
its fabs i think 
Teach me to copy-paste from the sketchy untested post rather than the working code, use fabs and it'll work. 
Finally, we have a nice result!

Watch this:

Thanks to Preach for the code and to st1x51, Baker, madfox, metlslime, Qmaster, Spike, mankrip, c0burn and to all who helped me with this.

Here you can get progs.dat file to check it out:

And here is the source code (use dpextensions.qc or fteextensions.qc to compile it and add .float gravity in to the defs.qc): 
Tried in on E1M7 in FTE and it works nice.

Improving The Code 
Is there any way to slow down flight? I have to make huge maps to make flight works properly.

And is there any way to change the value of horizontal speed loss?

Is there any way to make this work in standard quake without ising fork engines extensions? 
Improving The Code 
Is there any way to slow down flight? I have to make huge maps to make flight works properly.

And is there any way to change the value of horizontal speed loss?

Is there any way to make this work in standard quake without ising fork engines extensions? 
Generic Engines 
In theory, if you set the player's movetype to movetype_none in PlayerPostThink, and back to movetype_walk in PlayerPreThink, then you can insert a call to your (renamed) SV_PlayerPhysics at the start of PlayerPreThink and get a similar result.

In practice, doing so would leave you with no way to determine the user's intents (read: the .movement extension). You can work around this by using movetype_noclip instead of the movetype_none above, and to then try to guess the intents according to how the player's velocity accelerated between postthink->prethink (hint: dotproducts, see my earlier post). You'll also need to unwind those noclip-based velocity changes which will require some kind of shadow field, and clearing the velocity field in playerpostthink will make your .movement guessing logic more reliable.
Either way, it'll screw over prediction and get confused by knockbacks.

.gravity exists in all quake engines since hipnotic. You should be able to knock up a min/max function easily enough. I don't think there's anything else in there that's a problem. 
Engine Neutral 
My code runs fine in standard quake engines (once you define the .gravity field to enable that feature). You just run it in playerprethink, it uses standard player physics but then just rewrites the velocity each frame.

To slow it down, I guess you could do a number of things. One thing would be to reduce gravity further, even while facing down, so that you can't build up speed so well. Another would be to add a cap to fly_velocity after you calculate it:

if(fly_velocity > MAX_FLY_VELOCITY)
fly_velocity = MAX_FLY_VELOCITY;

Without this, the player can achieve speeds up to the global maximum speed an entity can reach, which defaults to 2000! 
On Quake Wiki I read the Trivial of the HellKnight.
The intention was to let Rangers spawn when the Hellknight is hit.

The same applies to the Axe_Ogre, which I managed to give some extra postures.
In this case, the Ogre should laugh when someone dies.
A more peculiar fact was pissing on the player's body.

If I were to start coding ... where should I start?
Something like pissing on the player would mean something to the player.qc and ai.qc.
Laughing when someone dies is a more general topic. 
Take A Leak 
PlayerDeathThink in client.qc, add a while loop that use

spot = find (world,classname,"monster_ogreaxe");
if ( spot ) {

spot.think = ai_leak1;
spot.leakentity = self;


Then set goalentity to the leakentity in ai_leak1 and self.enemy to self.leakentity. Do some ai_run()s inside your ai_leak1, 2, 3, etc. check for distance using vlen and start ai_leaking1 when close to player. In ai_leaking1, 2, 3 do your leak anim frames and play a sound effect maybe. 
Of Course 
You may need to add a .float to act as a bool so that you only check for axeogres in PlayerDeathThink once, something like

if(!foundleakers) {
foundkeakers = 1;
//while loop in here

And then in respawn() maybe add a foundleakers = 0; call. You might need to get fancy with coop though. 
...assumed the idea was that if the ogre killed the player then just that particular ogre would piss on the player, however...

Qmaster is making me think that if the player dies then all the ogres in the map would start making their way over to the player's corpse for a great big ogre gang-corpse-piss-party, and if I'm being totally honest with myself, that idea is too compelling to just pass up. 
Laughing Is A More General Topic. 
Let's assume the idea that if the ogre killed the player then all ogres would laugh.
The same a strange way when they're fighting between themselves and all start laughing when the player dies..

So these extra poses would concern the player only.

If I take PlayerDeathThink, and start adding code exact above respawn();
and under the self.button2 = 0;
the new code looks like:
self.button2 = 0;


spot = find (world,classname,"monster_ogreaxe");
if ( spot ) {

spot.think = ai_leak1;
spot.leakentity = self;



client.qc:805: error: unknown value "spot".
I know I'm a geek what coding concerns,
no idea how to make a spot statement.

laughing Axe_Ogre
lapaz Axe_Ogre 
Christ On A Bike. 
Playing The Fiddle Onehanded 
Make some minor changes to the micturating ogre model to give it a more ejaculatory flavour, and boom - cool new projectile attack. 
local .entity spot; 
That Was A Bit Disturbing Actually 
The way the ogre's balls rhythmically scrunch up on each cycle suggests we're getting something a little bit extra, not just urine. 
Make It Happen Madfox 
I Regret Having Been A Part Of This. 
Don't forget to do a particle(self.leakentity.origin,'0 0 0',60,18); for added effect 
I Screwed Myself Almost Geek On Those Fucking Flies! 
I could have suspect these intimate subroutines would lead to hillaric reactions, but..,

my bike had a leak last christ, and I wonder who'll pay the fiddler off.
I suggest kinn giving it a good smile sound.

Thanks Qmaster, I didn't warn you before I asked your help with my q1test. But you're welcome. I tried your email, but it didn't work.
Right, so I'll start with
local .entity spot;
The extra effects, it's like knowing the name of the statement, but not where to paist it in. 
I Changed 
in PlayerDeathThink after the buttons:

self.button2 = 0;

//===new code===

local float entity spot;

local .entity spot;

spot = find (world,classname,"monster_ogreaxe");
if ( spot ) {find (world,classname,"monster_ogreaxe");

spot.think = ai_leak1;
spot.leakentity = self;


//===end code===

error: no spot value.

then I added to defs qc line 139 :

.float skin;
.float effects;

//===new code==
.float spot;
//===end code==

Client.qc:812: error: type mismatch = (FIELDTYPE and entity) 
local entity spot;
no extra dot
(you want an entity, and not a field reference[of sub-type entity]) 
my bike had a leak last christ, and I wonder who'll pay the fiddler off.
I suggest kinn giving it a good smile sound.

Stumbling Is A Kind Of Laugh 
Appoligize my passionated reaktion, as I'm stupid enough to write down my nonsense before my smart conclusion starts reasoning.:P

Thanks Spike. Now I'm back at start with:

//=========new code===========
local float entity spot;
local entity spot;

spot = find (world,classname,"monster_xogre");
if ( spot ) {find (world,classname,"monster_xogre");

spot.think = ai_leak1;
spot.leakentity = self;

//====================end code==

client.qc:808: error: local not a type
client.qc:808: error: spot not a type
client.qc:808: error: if not a type
client.qc:808: error: self not a type 
local entity spot;
just that.
not 'local float entity spot;' - that's meaningless conflicting keywords. 
yes, but as soon as I add a line in client.qc before ClientObituary I receive the error "local" and "spot not a type".
How do I make them to a right statement? 
I changed some parms

void() ai_leak =
local entity spot;
spot = find (world,classname,"monster_xogre");
if ( spot ) {find (world,classname,"monster_xogre");
spot.think = xogre_leak1;
// spot.leakentity = self;

if I exclude spot.leakentity it compiles well,
warning that "Local "spot" not defined with a name of a global"

Wow, I've got an ai_leak!
What should be the next step? 
if ( spot ) {find (world,classname,"monster_xogre");
local entity pissee;
spot.think = xogre_leak1;
if ( pissee ) {find (world,classname,"monster_donaldjtrump")
spot.enemy = pissee; 
QuakeC Locals And Globals 
local makes that variable only work within the function--inside {} and ONLY after it has been declared (pretty sure about this second part).

Globals are any variable defined outside, e.g. in defs.qc (at the bottom of defs.qc anyways)

You need to define a .entity leakentity; somewhere outside a function and before you use it in client.qc.


.entity leakentity; // entity to remember for later so the monster knows where to go take a leak

void ClientObituary() {
local entity spot; // entity to hold our axe ogre

//your find down here

I'll let you figure out how to make the monster hunt down the player location and then begin the actual taking a leak. 
I'm back in PlayerDeathThink.

spot.think = xogre_leak1;

error: xogre_leak1 unknown value.

I can make a "void() xogre_leak;" at the top of the client.qc list,
but it keeps the error. 
There is something I need to explain first. As I mentioned before I am working in the Q1Test environnement. Also I added the Dragon code, rubicon.qc as some other feathers. I also wanted to add a catapult in stead of an axe.

One thing I would like to keep original to the Q1test mod.
Sounds, conback, weapons, and monsters. Reason I add the Axe ogre and Serpent, Vormitus, as the Shalrath's queer apearance is, because that were the trivial things that were not implemented. The dragon form Megalol had a solution, but the mod from Patrick Martin I included has a more sensitive way.

So I started with the "poor" q1test src, and slowly tried to find a way through the queer qc that was forehand. No Axe, nowammu_cells plz, and other butheads, like no change_level, just the stripped down qc to deathmatch.

Now I'm at the point that I'm testing the monsters, but it gets a little tricky , when I would assume the errors I get involved in are not the ones that apear in normal vqcc106.

Enough, I've got ai_leak that compiles.

After ClientObituary:

local float rnum;
local string deathstring,deathstring2;

local entity spot; // entity to hold our axe ogre

if ( spot ) {find (world,classname,"monster_xogre");
local entity leak;
spot.think = xogre_leak1;

rnum = random();

if (targ.classname == "player")

I had to add a new statement at the top for xogre_leak1 as it was not a value.

How do I make it aware for the player's death? 
Queer Or Queen 
Um, Compile With Fteqccgui? 
I use fteccgui as fteqccgui. I can compile the client.qc but I have no idea how to make it correspond the player's death. I think it needs some more code.

local entity spot; // entity to hold our axe ogre
if ( spot ) {find (world,classname,"player");
local entity leak;
spot.think = xogre_leak1;

I tried your email, but it faints. 
gimmy a hint! 
Set spot.goalentity to player perhaps. 
that does nothing. spot isn't initialised yet. if this was C you'd crash. As this is QC, it'll just always evaluate to false and do absolutely nothing.

find (world,classname,"player");
this does nothing. you're calling the function and finding a player, but as you're throwing away the result you're not getting anything out of it.
Of course, seeing as the player has just died, the return value is probably going to be equal to 'targ' anyway. You probably meant to look for a different classname, like your ogre's classname.

local entity leak;
Variable not referenced: leak
the weirdly named 'spot' variable is used, but leak totally unused...

spot.think = xogre_leak1;
You didn't check that 'spot' is actually alive.
Your dead ogre will suddenly resurrect purely to take a leak!
Lets hope its not a gibbed head. :D
Note that there's no loop, so only one entity could possibly start pissing (except that spot is always world so you're probably just going to crash the server with your assignment to world, if the if statement wasn't there).

Imho, you should shove the check somewhere in ai_run.
When a monster's enemy has died, that function decides whether the monster should resume attacking its oldenemy or whether it should resume walking/standing instead.
So when the enemy dies, delay the standing and switch to the pissy animation instead (make sure its an 'xogre' that's doing the ai_running first, and make sure it doesn't forget its enemy just yet).
That way you don't risk waking monsters from the other side of the map (which might get quite crowded, and really awkward in coop).
and then you can dupe the walking animations to have the monster walk to the player's corpse and then start to pee only when its close.
then once its done pissing, you can have it start to play some point+laugh loop, or just have a constant stream of pee until something else wakes it up by shooting it (or make the looping part call ai_stand to have it wake up if another player gets close). 
Id1 Source Code Circa 2018 
I've taken the plunge into cut and pasting QC. What's the "state of the art" clean id1 source code I should be using in 2018? 
The vanilla source code (version 1.06) can be found at least here:

C0burn had also linked Ultimate Regular Quake Patch's source code to me. It has a lot of fixes/workarounds for problems that may arise with the vanilla code. I borrowed some code from it for one of my maps.

Good luck to your plunge! :) 
Looks like a lot of MP focus in that second link. Thank you! 
Also FWIW: 
For my own purposes I put some QuakeC onto github a while back. There's various places to get these same things, but:

For the original 1.06 QuakeC you can browse it here:

or download a zip of it from here:

For Preach's cleaned-up 1.06 you can browse here:

or download here:

And you can see the differences between them here: 
Eh, one caveat that just occurred to me about those zipfile downloads. If you get the code that way then all the files will use Unix-style line endings. Might cause you issues depending on what text editor you're using. 
The URQP package is neat. I didn't know that that was where the Quake Info Pool fixes ended up. 
Bug Zapping 
I've updated the QuakeWiki with a list of bugs I know about in the 1.06 code.

It's most of the URQP stuff, plus other bits and bobs.

Please amend or ask me to amend if anything is missing! 
What About Solid Fiends? 
Quote from your list:

Rotfish does not become non-solid until the final frame of it's death animation * this is not in line with other monsters, so it is considered a bug

Correct me if I'm wrong, but don't fiends exhibit similar behaviour, too? 
They become non-solid on frame 6/9!

Glancing at some others quickly, hellknight is frame 3, as is the grunt.

I think it should be harmonised. 
Some More Thoughts 
Should we class unused content, such as the death knight grunt sound and unused animations and unused shub sounds, as a "bug"? There's other bits and pieces as well, including unused animations in the knight, soldier and ogre. Can we introduce these in a non gameplay changing manner? Should they be an optional spawnflag/worldspawn flag? 
In the ai.qc i took the ai_run part.

void(float dist) ai_run =
local vector delta;
local float axis;
local float direct, ang_rint, ang_floor, ang_ceil;
local entity spot; //xogre_leak code
movedist = dist;
// see if the enemy is dead
if ( <= 0)
self.enemy = world;
spot = find (world,classname,"monster_xogre");

if ( spot ) {find (world,classname,"monster_xogre");
spot.think = xogre_leak1;
spot.leakentity = self;

and the bastard lays it's blame on me!

Thanks Spike, that was right on target!
Now see if I can switch leak with laughing. 
A Few Other Notes 
Thunderbolt bugs relating to the "three beams"

I assume this bug isn't related to lightning attacks (both thunderbolt and shambler) being able to damage entities through walls? Also, hitchecks with the thunderbolt are kinda weird. (You probably know what I mean with that, but if you don't, just tell me, and I can explain in a reply.)

multiple megahealth rots down too quickly (double rot)

I had learned about this actually, when I tried to make a custom Doom-like health bonus item. My health would rot down super fast after having picked up like ten of those items! @~@ I actually thought that it was a feature, to make supercharged players less OP, or something. :D

targets not fired if the player doesn't take the item (e.g. already has max armour, touching armour should trigger a monster/something, but doesn't)

This is even more so arguable, whether it's a bug or not. I actually prefer it the current way. If I wanted to make 100 % sure about the targets being triggered when touching the item, I'd add a trigger_once brush or something.

(Also there are minor typos here and there in the list.) 
@Johnny Law 
Thanks. I wasn;t aware Preach had a version of his own. I'll most likely use Preach's 106 code when I dive back in. I am using FTEQCCGUI and Notepad++ 
Last year muk0r put together a "clean QC source"... but the readme doesn't say if there is any bugfixes :(

but maybe (i said maybe because i don't know if you want these features) you should start with custents?
It seems to be a mix of all the cool features of the two official mission-packs, like: rotating brushes, earthquakes, particle fields, breakable walls, etc 
Thanks for these links. I am looking at adding some of the custents features for sure. 
I think the "same name texture" crash mentioned on that page is only in GLQuake and derived engines. 
I agree about the item not triggering it's targets if it hasn't been picked up, that is definitely not a bug, it makes total sense for an item to not do anything if the player touches it but can't interact with it for whatever reason, like if their ammo is full or they have full armor or they already have that type of key in their inventory. Not to mention that a vast majority of maps are designed around this mechanic one way or another, like key traps triggering when the player, you know, picks up the key or encounters that get triggered when you pick up a particular weapon or powerup like quad damage

Now if we're talking about keeping the player from picking something up if they already have enough of it that's another story, it would definitely be nice sometimes if some things like ammo or health only gave themselves to you if you actually needed that much, it would definitely help prevent wastefulness by picking them up on accident when you don't really need that much yet 
I agree about the item not triggering it's targets if it hasn't been picked up, that is definitely not a bug, it makes total sense for an item to not do anything if the player touches it but can't interact with it for whatever reason, like if their ammo is full or they have full armor or they already have that type of key in their inventory. Not to mention that a vast majority of maps are designed around this mechanic one way or another, like key traps triggering when the player, you know, picks up the key or encounters that get triggered when you pick up a particular weapon or powerup like quad damage

Now if we're talking about keeping the player from picking something up if they already have enough of it that's another story, it would definitely be nice sometimes if some things like ammo or health only gave themselves to you if you actually needed that much, it would definitely help prevent wastefulness by picking them up on accident when you don't really need that much yet 
Cleaned Up Code 
I should mention that the changes in the cleaned up code are only to eliminate compiler warnings, there aren't any bug fixes or behaviour changes. Just wanted to set the right expectations for it. 
Thanks for the clarification. I am still very much in the copy and paste fingers crossed stage of qc. I believe c0burn wants to release a bug smashed version of the code eventually. That's a great project IMO. 
Result is that a player in fight with an Axe_ogre will get pissed. If player is shot from distance, the ogre won't walk to the player's body. 
the point of doing it in ai_run is that:
a) self is the ogre that should do the widdle. there is absolutely no need to call find (because you can just use self). there is no need to loop etc (each monster will call the function at some point anyway).
however, you really ought to only do that logic if self.classname is actually what you expect. you don't really want scrags trying to widdle.
b) the player that its trying to urinate on is already stored inside self.enemy. This means that you don't need a seperate leakentity field - just use self.enemy! (do note that you'll want to avoid the self.enemy=world line if the ogre is meant to start widdling.) 
Thanks for your answer. Sorry I'm such a noob at coding.
If I use the self argument, how do I make it fit in?

As it is an experimental src, so maybe it is better to show an example
of what I am trying to do.
here's a demo of Qtest

the main problem, the "new" monsters seem too much overpowered (especially vomitus)

noticed a couple of issues, check the demo 
Queer Queen 
Just finished a nice trick to change the serpent into a quaddam.
But don't touch it, cause it lives.., a bit husling with the skin file.

Yes, the src has a MISSILE weaponcode for each monster,
wizard is also much too strong. Number code for weapons won't work. Still beta.

Thanks for the demo, I'll look at it! 
You made your way quiet advanced on hard skill. Spy.
The missing sounds are qc depended.
I turned a bit strayed with the qtest.qc. adding the monsters,
especially the dragons, caused a lot of changes.

I assume the forced demo end had something to do with crashing,
it is still beta version, already glad it runs.

Thanks for taking your time. 
Partial Cross Post 
I am just getting started "cutting and pasting" QuakeC. I followed Preach's revised tutorial on monster spawning here:

I'd like to add a small random delay automatically to each teleporting monster as you can do in Quoth. I am using custents multiple triggers to trigger these delays spawns. Similar to Quoth, it would be nice to have a little variation on the timing if the monsters all share a targetname.

I've tried a few things already, being exceedingly cautious not to mess up this code I can barely comprehend. I'm wondering if anyone would like to give me a hint of how to approach this little addition. 
Add a new function:
void monster_teleport_delay () {
self.think = monster_teleport_go;
self.nextthink =time + self.wait; // or self.delay if you prefer that

Then in your monster_teleport() function change self.use to be monster_teleport_delay; instead of monster_teleport_go.

DISCLAIMER: Untested. 
thank you for the help... I will try this after work this evening! 
Newb question: would this mean I need to add a wait or delay key value to the entities? I don't mind setting it manually but wanted to know if this is how this method works. 
If you don't want to set a wait value manually, instead of using self.wait in that code you can generate a random number between 0 and 1 using random() instead.

Can you see how to adapt the code to use random to create a delay of between 0 and 1 seconds?

How about a delay between 0 and 2 seconds?

What about between 0.5 and 1 seconds? 
Obviously I posted that before reading the other thread. 
No worries thanks for the great tutorials. I am enjoying messing around with QC finally. Next, I am going to try and figure out a silent spawn without the tfog and audio next. I think I can do it. 
Decision Made! 
After trying to implement random timings I felt it better to go with self.delay. More work but more control for the mapper. Thanks everyone! 
Te_lightning, Etc 
void(vector v1, vector v2) te_lightning =
WriteEntity (MSG_BROADCAST, world);
WriteCoord (MSG_BROADCAST, v1_x);
WriteCoord (MSG_BROADCAST, v1_y);
WriteCoord (MSG_BROADCAST, v1_z);
WriteCoord (MSG_BROADCAST, v2_x);
WriteCoord (MSG_BROADCAST, v2_y);
WriteCoord (MSG_BROADCAST, v2_z);

Writing some TE_ helper functions has gotten me curious. WHY is there an entity parameter needed for the lightning, beam, etc? Is it safe to just write world? 
I figured it out. It uses the entity as the start point regardless of the co-ordinates passed. And this is why the lightning beam starts at the origin of the player, regardless of anything else. 
beams last 0.2 seconds. QC respawns them every 0.1 seconds.

the entity argument is just there to avoid the resulting double-beams issue (trying to depend upon precise timing would be too unreliable with network latency etc, hence why they last longer).
Using world would break when you have two players firing beams, although some engines do understand world to mean 'don't replace any beams'.
tbh 99% of the time that entity arg will be self.

ignoring the startpoint and using the player's position is just to smooth things out so that the player doesn't leave the beam behind when moving sideways etc.

note that there's already an engine extension to provide those as builtins (with that name), so beware of potential conflicts if a modder uses *extensions.qc. 
W_FireLightning Start Origin Incorrect On Players? 
original code has

LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);

(even URQP has it that way)

But i had long changed it to

LightningDamage (org, (trace_endpos + (v_forward * 4)), self, 30);

this is especially obvious when shooting from RL window on DM3 and aiming at someone on the lower bridge.
this is because:

org = self.origin + '0 0 16';
traceline (org, org + v_forward*600, TRUE, self); 
The original is "waist lightning". Darkplaces has specific settings to let you pick which style you prefer, waist or gunpoint. 
That only fixes the position of the bolt VISUALLY, which is what Spike was explaining. The above fixes the tracelines/damage as well. 
ya the original deals damage from the gun but visially it came from the hip
i keep confusing myself that sel.origin is the bottom of the model
where the feet touch the floor 
Trigger_push Project 
Still taking baby steps into QC with very little coding background. Wanted to check with experienced coders. This bit of code makes a trigger_push silent with a spawnflag. It appears to be working fine in game and no errors in FTEQCC but I feel like the syntax is still wrong.

Next steps will be to learn how to toggle it and add custom sounds.


float PUSH_ONCE = 1;
float PUSH_SHHH = 2; //DMS push silently

void() trigger_push_touch =
if (other.classname == "grenade")
other.velocity = self.speed * self.movedir * 10;
else if ( > 0)
other.velocity = self.speed * self.movedir * 10;
if (other.classname == "player")
if (!(self.spawnflags & PUSH_SHHH)) //DMS
if (other.fly_sound < time)
other.fly_sound = time + 1.5;
sound (other, CHAN_AUTO, "ambience/windfly.wav", 1, ATTN_NORM);
if (self.spawnflags & PUSH_ONCE)

/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE
Pushes the player
void() trigger_push =
InitTrigger ();
precache_sound ("ambience/windfly.wav");
self.touch = trigger_push_touch;
if (!self.speed)
self.speed = 1000;

You could also check the spawnflags in the spawn function and only precache the sound if needed. 
Quakedroid would be about the only reason not to just precache everything. 
What does this mean?

if ( (rand()&3)==1 
if ( (rand()&3)==1
rand() returns a number between 0 and RAND_MAX.
&3 truncates all but the lowest 3 bits (so a random number between 0 and 3 inclusive).
==1 gives you a 1-in-4 chance of being true.
and there's no closing bracket, so the entire thing is a syntax error and won't even compile.

of course, rand's randomized bits are generally least reliable in the lower bits, so the above might be quite predictable, but it depends upon the rand implementation. 
Truncatorial bitwise AND. Mkay.

So 25%ish chance in movetogoal to "bump around" using the wall following code if the monster can't step in the direction of its .enemy

I guess that makes (rand()&1) evaluate to 50%ish chance. 
lowest 2 bits, sorry. and yeah, bitwise and.

movetogoal is just all kinds of screwed tbh. its very much an attempt to replicate doom's monsters, but in a way that's 5+ times as expensive due to all the floor checks etc. it can't slide along walls so can't deal with narrow passageways, etc. it works well enough, but its far from ideal. 
Its strung out multi-function calling madness yes. Trying to recreate it. 
Which Coordinates Do I Use For ReMStud? 
So I got the save file and the console output, but I can't seem to find the correct coordinates for putting the camera in one place and a place to view it. What set of coordinates do I use for the 3 sets I'm given from the console output? 
Not sure it is what you're aiming, but in a mapeditor with a viewscreen it is easy to turn the view camera and the info_camera aligned.
Just make sure the arrow of both viewpoints are the same. 

Here is a rotfish fix I knocked up for otp. It fixes the fish count, makes fish gibbable, makes them non-solid straight away when dead, and includes a fixed fish.mdl due to the bugged head size in the death frames.

It's all combined in a pak2.pak so it can be used as an id1 fix if you drop it in there.

Source is included, only fish.qc and monsters.qc have been modified however. 

This is a command line based tool which will read a QuakeC progs.src and all .qc source files listed within, and output a .DEF file compatible with a map editor such as TrenchBroom.

This assumes your QuakeC source files contain /*QUAKED*/ style definitions such as those found in the original id software QuakeC sources, as used by the original QuakeEd. For example, from items.qc in the original source:

/*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)

This makes the laborious task of hand creating a .DEF file a thing of the past, as long as you include the relevant entries in your QuakeC sources when adding or amending entities. While not as powerful as .FGD files, .DEF files have a place and can be a quick way to add map editor support for your new mod!

Source code is included as a simple .c file, which should build on any C99 compiler. 
Oh!! That's what those hideous comment blocks are. I figured it was just a way for someone to copy and paste it over into some wierd editor definition in case they lost it. It sounds cool but I still don't understand the use case.

What other formats are there other than .def and .fgd? 
The use case is that the original QuakeEd (that id developed and used on NextSTEP to make the original maps) parsed the .qc files and used those definitions to display what entities were available.

The modern use is that all the entries can be stuffed in a .def file and trenchboom (etc) can use them to populate the entity list.

I'm not aware of anything other than .def and .fgd, but maybe there are other formats in use in some of the more esoteric editors. 
Not Convinced 
This makes the laborious task of hand creating a .DEF file a thing of the past, as long as you include the relevant entries in your QuakeC sources when adding or amending entities. While not as powerful as .FGD files, .DEF files have a place and can be a quick way to add map editor support for your new mod!

This is a bit of a tautology - the reason those comment blocks were there was so that ID could write the .def file inline, and then extract it into a single file using a command line tool. The comments don't do anything for the QuakeC processing of the file. You're basically saying you can take all the effort out of writing the .def file, so long as you've already written the .def file. 
Thats true however I think the original QuakeEd read the QC files directly at launch and there never was a tool to pull the definitions out into a .DEF. I may be wrong though. 
That's True 
quakeEd already supported cleanly ignoring anything that wasn't contained in a /*QUAKED */ comment block, and when I discovered I could just point qe3 at lunsp2/src/*.qc instead of maintaining a separate .def file an angel got its wings

(the other clue to this is that the comment blocks start with /*QUAKED in the first place ...) 
Would Be Nice If 
There could be a utility that generates a list of all functions in the qc like so:
Function(float arg1, vector arg2),called 0 times, precache Yes
W_Attack(),called 1 times,
weapon_blaster(), called 0 times, precache Yes
SUB_Remove Edicts Piling Up 
I have a problem with edicts piling up that have no information other than Think = SUB_Remove and Time = -1. I'm not sure where to look in the qc to find what's causing it. Do TE_STREAM_* ents look like this in the edicts dump? 
Code Request 
Hi Shanjaq. TE_STREAM_ things aren't using up your entity slots, "temporary entity" is just a bad name for them. So the problem must be elsewhere.

Think = SUB_Remove and Time = -1

Can you post the full lines of code that these quoted parts come from? It's hard to tell if they're right or wrong from what you posted. 
ent.nextthink <= 0 means the entity will never think, and thus never get removed. use 0.1 instead, or something.

note that the remove builtin will also set nextthink=-1, clear classname+model, but not clear the remove builtin.
those removed ents will be reused later (no sooner than 0.5 secs). so if you're spawning+removing within the same frame then you're going to have at least 0.5 seconds worth of them building up.
qc can still read+write removed ents (unfortunately), but nextent+find+findradius won't find them, and saved games shouldn't list them so I've no idea if this is what's causing them or what - how are you seeing this list of useless ents? 
Edicts Anonymous 
Thanks all for your insights! I'm wondering if there's a leak somewhere in the edict de-allocation, as I sometimes see models/sprites frozen in mid-animation which have no clipping and findradius can't see them. Here is a snippet from edicts.txt after a crash. note the last two, which I'm seeing in the hundreds:

Fte Quake C Dev 
While changing from ftcq to fte dev compiler I found some small errors. And before get passed with an unknown punctuation, I see for all monsters:

warning F307 type mismatch void entity_pain to void (entity_attacker, float dammage) self.th_pain

What is the statement to catch this error? 
You need to pass inflictor as well:

void (entity attacker, entity inflictor, float damage) th_pain; 
Usually just self. This is used to differentiate between the projectile inflictor (e.g. the rocket, self) and the attacker (self.owner). 
Just add "(entity attacker, entity inflicter, float damage)" to each monster's pain functuon. Example:
void () ogre_pain = {

void (entity attacker, entity inflicter, float damage) ogre_pain = {

WAIT WAIT...just attacker and damage. AD adds inflictor. 
Yes, Thanks! 
Most errors are fading, when I changed it in an addon monster, but it still keeps errors.
They're not major but when I try to change athe Vore's pain it loops back to the self.th_pain string. And for Shub's error I can't find a pain function, but SUB_Null.

The error starts in client.qc (line 552) PutClientIntoServerclient.qc at the statement for
self.th_pain = player_pain; 
I had changed my defs.qc into .void(entity attacker, float damage) th.pain!
Me donkey. 
It needs to be that way, so it's the other way around.
I think fte looks for more loose ends than I thought, while it still passes the progs.dat.
Strange that doors.qc with its self_pain error. 
if you just want to silence the warning, you can do:
self.th_pain = (void(entity,float)) foo_notquitepain;
Such casts are generally not recommended as they'll not catch any future changes to your 'foo_notquitepain' function, and you should only ever ADD arguments to the rhs when casting functions (removing/changing args results in the function getting gibberish for the args that were not passed, or passed as the wrong type).
Such explicit casts should always be seen as a claim by the programmer that they know that the result will be safe despite its inconsistencies.

The vanilla qcc just saw function types, and didn't bother to validate the return types nor parameters. whereas fteqcc is somewhat annoying and warns about any inconsistent code that it sees.
Its worth noting that the vanilla qc code is inconsistent but not otherwise buggy. You could fix it purely using casts if you wanted to, but its cleaner to just add the extra args.
And yes, there is some door or trigger or something entity that mixes up touch functions and pain. You can fix that occurrence with a wrapper, but a cast will perform better - not that its significant enough to matter at all. 
Thanks for the info, that keeps me going! 
New Monster Qc 
I'm trying to make a new monster, that shots nails and launches rockets. When I run the qc the monster shoot nails and launches rockets at a low angle, half from bottom.
Also the two actions bump at the same time and I have no idea where to look.

Where is the statement that give more time between the actions? 
Rabbid Fire 
As long as the player is running the relation between missiles and nails is almost even, but when it is tricked into a corner the thing blasts missiles every 0.5 second.

That's no way of surviving, I know it is called Terminator, but unlimited charge is no fight. 
...half from bottom... try changing the offset amount from '0 0 10' in TermMissile to higher amount such as missile.origin = self.origin + '0 0 24'; or try copying the value you used for org in LaunchZhaser if you want the missiles to fore from the same place as zhasers do.

missiles every 0.5 seconds you have melee set to fire missiles. If you stay back away then he will only shoot zhasers.

Maybe if you want more delay add more frames or add an attack_finished check. 
Or do
self.th_missile = sknt_atk1;
self.th_melee = sknt_atka1;
To switch it. 
What do you mean bump? 
The Enforcer.qc has a code for setting the laser
org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16';
and as far as I can see the v_foreward sets the space that messures the armlength foreward, and v_right is the distance from the entity to the right sideways.

I'm looking for the space upward, as a terminator that launches from under the belt is a bit odd. In game it is not so pronounced as with testing.

I will try your statements in the hope they lead to a better result. For sofar here is the map as far as I have finished it. The scr file is included. I've played the map myself only, and I think the gamepath isn't realy clear.

Vector Upwards 
Hi madfox, have you tried using v_up? That's the "upward" vector I think you're after. 
Belt Blaster 
@-Qmaster Changing the self.th_melee = atka1; worked for splitting the attack in two different shapes. Although I don't see the reason why self.th_melee = sknt_melee won't work.
It is defined as sknt_melee = sknt_atka1; (?!)

@-Preach : sure, but I can't find the place for the statement.
Whatever I add or change it seems 7up for the compiler.
missile.origin = self.origin + '0 0 10'; is the place to look I think? 
That's The Correct Line 
That's the right line to modify, keep playing with it until you get an effect you like. 
Algebra Dabra 
the only way I can make the missile launch higher is when I exclude
//missile.origin = self.origin - normalize(self.velocity);
missile.nextthink = flytime + time;.
Then the changes seem to have effect, although I get an eyeheight missile launching and ending on
missile.origin = self.origin + v_forward * 8 + v_right * 1 + v_up * 10; 
Changing The Order 
Yeah, that would be the problem. Notice how both lines are setting the value of the same thing - missile.origin. The second line completely overrides the first one, like changing your order in a restaurant - you don't get two meals, you just get the second one. 
Right, Uhm Wrong 
missile.origin = self.origin + v_forward * 8 + v_right * -16 + '0 0 24';
returns a launcher that shoots from the launching point left above the player.

missile.origin = self.origin + v_forward * 8 + v_right * -16 + v_up * 16;
returns a missile that explodes left of the player.

I'm thinking I'm changing the end point of the missile hitting the player. It launches from the right point, but it ends up blind. Also the negative parm comes out strange. It's not left handed? 
In TermHome,
dir = normalize(vtemp - self.origin);

I used the enforcer_laser methode to launch the missile.
This way it is the simpelest way to compile for the wanted use.
The code was from the Orb, and I had a hard job on coding the weapon.

Thanks for the hints!
They were helpfull. 
Rubicon 2 question:

You have IT_NO_WEAPON replacing IT_EXTRA_WEAPON in the code. However, I'm not sure how to implement this in a map. Not seeing a spawnflag or other way to enable it. 
Trace Volume? 
Is there a way to trace a volume similar to traceline? I need to find a volume that is not occupied by players or monsters of any size. maybe something like traceline? 
any decent engine will have a tracebox builtin for things like that.

failing that, you can also exploit quirks of droptofloor or walkmove(typically with FL_FLY?), but these are much more limited and may have additional engine-specific quirks that break your mod (at least in DP). 
Something I wrote before on how you might write a tracebox function using the method Spike suggests. His caveats stand 
Spawning with no weapons works but was never used in any of the maps so I didn't finish the part where an info player start can opt in to it. Right now it's just hard coded so to only happen if mapmame == test.bsp

So you would have to make some quakec change to complete the feature, or just change the hard coded string it's looking for -- or name your map test.bsp :) 
3 posts not shown on this page because they were spam
First | Previous | Next | Last
Post A Reply:
Website copyright © 2002-2019 John Fitzgibbons. All posts are copyright their respective authors.