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
#2268 
surely that doesn't even compile... 
Well 
it does, and it has a rather fancy skinn anim as the model in screenshots #14579 shows.
Why it is I don't know. I thought anim skin wasn't possible.

I think I screwed up the blrg.atk1 and balrog.atk names.
I thought the knight.qc and hknight.qc were ttached somewhere to the statue code only. 
Found It 
missed semicolon. 
Angles_x Question 
Hi, please refer to this post where I describe a difference I found between how NetRadiant interprets angles versus how Quake 1 does (with regard to the orientation of models):

http://www.celephais.net/board/view_thread.php?id=61357&start=75

relevant image here:
http://i.imgur.com/KpBsWHB.png

I assume NetRadiant is geared up to conform to Quake 3's interpretation of angles. Is there a difference then between how Quake 1 and 3 do it - namely to do with angles_x being inverted? 
 
inverted pitch angles is an 'unfixable' clientside bug that was present in the original software renderer, that was replicated in glquake and all quake engines since.
bsps and sprites pitch correctly - like in *Radiant, and mdls (and by extension md3+iqm - hurrah for consistent inconsistencies) pitch the wrong way.

makevectors uses 'proper' angles, but vectoangles is also affected by the bug.

it was fixed for hexen2 and quake2, but if you want to run quake mods properly then things must remain 'broken', especially if you want to join a public server.

probably the easiest way to deal with it is to create two separate entity types or something, then the mdl/md3/iqm version can just do self.angles_x *= -1.

there shouldn't be any other angle issues, just that one. 
Spike 
Thanks - very useful info. 
 
"I just literally pulled all the precache calls from worldspawn out into a new method:

void precacheSounds() =
"
are you still calling precacheSounds() within worldspawn or else where? 
Calling It In Worldspawn Exactly Where The Precaches Were Originally. 
 
Randomized Velocity In A Range 
Forgive me if this is more a general coding question but, is there a way to find a random number within a certain range? Like if I want a randomized x velocity from 150 to 300 for a gib 
Or Rather 
-150 to 300, sorry for not editing, forgot i had a login 
#2278 
(Random() * 450) - 150;

where Random() returns a random number from 0-1 - i assume QC has that? 
A Better Answer 
so yeah the general case for getting a random number between min and max is:

(random() * (max - min)) + min

where random() would be a builtin function returning a random number in the range 0-1 
Thank You 
How do i put a negative number in there? Like say i want a range from -250 to 250 
 
It's no different, "min" is -250, "max" is 250, so that would be

(random() * 500) - 250 
Thanks 
First time i did it with negatives i must've entered something wrong, now it's working thank you 
Any Way To Set Model Flags Through QC? 
Hexen 2 has some extra model flags for trails that I can't set unless I merge models with QME, but I still can't get exactly what I want 
@bloodshot 
random:
random(-250, 400) will give you a random number between -250 and 400.
this will work with any HexenC compiler, as well as fteqcc even when not targetting hexen2.

model flags:
fte and dp both have some .float modelflags; field.
unfortunately the networking only supports the first 8 bits, and isn't supported by any (non-fte) hexen2 engines, so it won't get you anyhwere.
you may need to resort to a hex editor. you want the 32bit int at offset 0x4c.
although I'd like to think that later versions of qme allowed setting arbitrary flags... 
Good Point About QME 
I've been using 30 because I couldn't find the download again for 31, but I think I might be able to grab it from my laptop and check 
 
i seem to have 3.1 ill look for a zip or i can make one i guess. I know i have it somewhere 
 
 
It's been about 5 months since the last time this was asked, that's a pretty good run I guess. Maybe six next time? :p 
Can You Make Anonymous Functions In Qc? 
 
Fteqcc 
void() foo =
{
entity e = spawn();
e.think = (void()){
dprint("I THOUGHT!\n");
remove(self);
};
e.nextthink = time + 1;
};

such functions may still have undefined behaviour when it comes to saved games, especially when the progs itself is changed. so while you should probably still avoid it, the above works in most cases.
note that there's no enclosures - so you can't access the locals of the parent (static locals should work though). 
+1 Sticky This Thread 
 
 
Make the thread sticky on its 10 year anniversary. 
First | Previous | Next | Last
You must be logged in to post in this thread.
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.