@bloodshot
#2285 posted by Spike on 2017/03/01 10:20:20
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
#2286 posted by Bloodshot on 2017/03/01 23:03:18
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
#2287 posted by R00k on 2017/03/02 04:48:50
i seem to have 3.1 ill look for a zip or i can make one i guess. I know i have it somewhere
#2288 posted by muk on 2017/03/02 04:52:45
#2289 posted by PRITCHARD on 2017/03/02 11:24:59
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?
#2290 posted by anonymous user on 2017/03/04 15:12:07
Fteqcc
#2291 posted by Spike on 2017/03/04 15:37:08
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
#2292 posted by Qmaster on 2017/03/06 18:28:51
#2293 posted by PRITCHARD on 2017/03/06 22:27:06
Make the thread sticky on its 10 year anniversary.
Blood Splat Question
#2294 posted by Ruin on 2017/03/08 06:11:31
Ok, I was in the wrong thread last time...
Do you know how to make a blood splat on the walls in quake that will align with the wall? I've seen it done before, but I cannot cite my sources, unfortunately. I'd be happy to pay someone to make a .qc file for this.
Thanks.
Blood Splat Question
#2295 posted by Ruin on 2017/03/08 06:11:37
Ok, I was in the wrong thread last time...
Do you know how to make a blood splat on the walls in quake that will align with the wall? I've seen it done before, but I cannot cite my sources, unfortunately. I'd be happy to pay someone to make a .qc file for this.
Thanks.
Untested Suggestion
#2296 posted by Preach on 2017/03/08 08:40:37
Try adding the following to SplatTouch above the line which changes self.velocity:
//fire a trace in the direction of movement to
//try and hit what we collided with
traceline(self.origin, self.origin + self.velocity, 0, world);
//if we hit a surface with the trace
//face the angle of the surface normal
if(trace_fraction < 1)
����self.angles = vectoangles(trace_plane_normal);
It's ever so slightly hacky, because we need to try and reconstruct the collision. So we have a bit of logic to guard against failure, and we don't change the angle if it fails.
This code will fix the angle relative to the facing of the wall, but you may need to add a constant angle if it's consistently turned 90 degrees from true.
Preach
#2297 posted by Ruin on 2017/03/09 06:17:51
Preach, you brilliant bastard!
Can I compensate you for your help?
Thank you so much!
Nah, Cheers
#2298 posted by Preach on 2017/03/09 19:53:01
I'd risk getting a bit mercantile if I accepted that!
Bit Subtraction
#2299 posted by R00k on 2017/03/24 00:13:23
okay, I'm not a novice to QuakeC but, i have a question.
float FOO 64
float foo2 128
float foo3 256
so
is it incorrect to use:
value = value - FOO
vs
value = value - (value & FOO)
logically the first just subtracts 64.
I'm looking at OLD code and finding stuff like this.
I have always done it
value = value - (value & FOO);
to just turn off a value.
#2300 posted by Kinn on 2017/03/24 00:22:36
is it incorrect to use:
value = value - FOO
I imagine you'll find instances of this in the old code only in places where they knew 100% that the bit was set, so just needed to subtract it.
Even so, it's still always better to use
value = value - (value & FOO)
because it shows the coder intent.
#2301 posted by Spike on 2017/03/24 00:32:01
if you know that its already set then just subtracting it is fine...
How Do I Get...
#2302 posted by ijazz2 on 2017/03/26 09:12:12
After killing something,it drops a weapon,out of which some can be picked-up.Just like AD but with vanilla QC code.How do I get this?
I tried adding rubicon2's code for g_axe and g_shotgun in my mod but it didn't work.So now I am starting with a clean source in a few days,how do I make this code from scratch?
Is there a shortcut way to add frames for a monster in qc? I heard it was there in some tutorial online but I can't find it.
#2303 posted by khreathor on 2017/03/26 10:00:24
Maybe start from checking out DropBackpack in items.qc
#2304 posted by R00k on 2017/03/29 04:33:21
Like khreathor says,
when the mod drops a backpack, it spawns an entity, (with a timer to remove it).
To drop a gun seperate from the pack, like the gun in hand with *some* ammo, you need to spawn a new entity, with a PRECACHED model. and give that entity a .ammo amount, and create a touch function for that gun-entity.
I had done this once long ago. I will dig up some code and try to point you to your goal.
It only helps you to become a better coder with hints and not code cut/paste. But I can give you a detail list of what you need to get this working.
Ijazz2
#2305 posted by Mike Woodham on 2017/03/29 09:49:22
Not exactly what you want but you may find some of the coding useful to get what you are after:-
http://www.insideqc.com/qctut/qctut-60.shtml
http://www.insideqc.com/qctut/lesson-10.shtml
Lightningdamage
#2306 posted by R00k on 2017/03/30 20:12:43
does anyone know why IDsoftware made the trace for the lg start at the feet not +16?
```
org = self.origin + '0 0 16';
traceline (org, org + v_forward*600, TRUE, self);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
WriteEntity (MSG_BROADCAST, self);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
WriteCoord (MSG_BROADCAST, trace_endpos_x);
WriteCoord (MSG_BROADCAST, trace_endpos_y);
WriteCoord (MSG_BROADCAST, trace_endpos_z);
LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);
```
Lightning Position
#2307 posted by Preach on 2017/03/31 08:45:59
First thing to note is that the player's self.origin is at crotch level, not feet level. However, you are correct that the visual beam projects from a height of 16 units above the damage beam.
The sad truth is that the lightning bolt code is kinda buggy, and that's not even the worst bug. If you look through LightningDamage you'll notice it performs 3 traces in a row. The intent seems to be making the beam wider and allowing it to hit multiple enemies in the path. In fact, the vector calculations for the 2nd and 3rd are completely wrong, and the beams just fire into parts of the level that can't be seen by the player.
The buggy extra beams do fire in a way that is predictable based on the player's origin and facing angle. The following video shows a speedrun which exploits this! At about 50 seconds in, the player rides a lift down, faces in a very specific direction, and starts shooting the Thunderbolt. The specific location and direction of the shot causes a second beam to hit the Shalrath at the end of the level, which kills it before the doors open. This lets you grab the rune early, speeding up the run...
https://www.youtube.com/watch?v=D_P35WtpAwY
origin is at crotch level
So that's realistic then.
Lightning Buggy
#2309 posted by Qmaster on 2017/04/01 00:33:46
Sounds like a fast 4 wheeler.
Anyhow, is there a fixed version of the code somewhere?
|