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 Qc 
it's void dprint (string text).
Plus you need to set the cvar developer to 1. 
ai.qc defs or elsewhere? 
To Be Honest 
i am guessing myself, looked it up once for someone who was new to qc.
In ai.qc there should be an commented out example in t_movetarget, line 147.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

I am curious about these things:

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

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

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

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

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

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

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

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

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

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

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

Here's the things I want to achieve:

#1 - Add custom skins to bots

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

I tried this, but it doesn't work:

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

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

return "Vincent";

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

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

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

Here's the code:

// GeN >

player_stand1 ();

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

spawn_tdeath (self.origin, self);

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

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

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


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


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

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

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

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

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

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

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

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

Is the change to sprint because you are centerprinting something else at the same time? If so, try disabling that for a moment and see if the sprint starts working. 
Dang Engine Issue 
turns out it was a quake engine issue of some sort. I was running and older version of qrack and I tried out a different engine and it worked. Updated Qrack and now it works in that too. :) 
First | Previous | Next | Last
Post A Reply:
Website copyright © 2002-2020 John Fitzgibbons. All posts are copyright their respective authors.