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
Attenuation 
I presume the values are?
ATTN_NONE 0.0
ATTN_NORM 1.0
ATTN_IDLE 2.0
ATTN_STATIC 3.0

and is there a chart for how far Attenuation value affects sound range?

-

so to make sure
sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1.00, ATTN_NORM);

1.00 is the volume & I can change ATTN_NORM to a number?

so
sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 0.50, 0.1);

means half volume but 10x the sound range?

and I can also use 0.01 for 100x the range? 
Teams Also 
Do I have to add .float monster_team to defs.qc?

and/or add monster.monster_team to each monster in the mod? 
Sounds Right 
Your code looks correct. I can't quantify exactly how much further the sound goes when you set attenuation to 0.1, but it will be a long way. Give it a try, and you can always adjust it later.

I'd recommend downloading the source code for Qreate and see how they did it. I mentioned that the built-in function in the Quake engine is called "checkclient", and the function which calls it in QuakeC is called "FindClient" found in the ai.qc file. If you look for that in the mod source, you should get some idea how they did it.

Adding field definitions to the bottom of defs.qc is a good choice. You should only define a field once. It can be used from that point onwards in the compilation. defs.qc is a particularly good choice because it's usually the FIRST file to be compiled, so all your code will be able to see the definition. 
Compiler For QC? 
noob question, but how do i compile the QC code to progs.dat? 
Resources 
The short version:
https://quakewiki.org/wiki/Compiling_QuakeC
The slightly longer version with an example to try out and check you got it working:
https://www.quaddicted.com/webarchive/minion.planetquake.gamespy.com/tutorial/tutor7.htm

The two differ in which compiler they recommend. I agree with the recommendation in at the first link, FTEQCC is the better of the options. 
I'm So Confused With The Monster Team/faction Code 
this is what I have/did - in monsters.qc (and does this also solve infighting?)


void() AssignFaction =
{
if (self.classname == "monster_ogre" || self.classname == "monster_fiend") {
self.faction = "Goliath";
} else if (self.classname == "monster_knight" || self.classname == "monster_dog" || self.classname == "monster_hell_knight") {
self.faction = "Juggernaut";
} else if (self.classname == "monster_shambler" || self.classname == "monster_wizard" || self.classname == "monster_zombie") {
self.faction = "Atlantean";
} else if (self.classname == "monster_enforcer" || self.classname == "monster_soldier1") {
self.faction = "Goliath"; // Adding Enforcer and Soldier to Goliath
} else if (self.classname == "monster_demon1" || self.classname == "monster_scrag") {
self.faction = "Juggernaut"; // Adding Demon1 and Scrag to Juggernaut
} else if (self.classname == "monster_tarbaby" || self.classname == "monster_shalrath2") {
self.faction = "Atlantean";
}
// If a monster isn't listed, it won't have a faction.

// Default faction if none assigned above (optional)
if (self.faction == "")
self.faction = "Neutral"; // Or choose a default team
};

void () monster_use =
{
// ... (Existing code for health and target checks)

// Team Check
if (activator.classname != "player" && activator.faction != self.faction && activator.faction != "Neutral" && self.faction != "Neutral")
{
self.enemy = activator;
self.nextthink = time + 0.1;
self.think = FoundTarget; // Make sure FoundTarget is defined
return;
}

// ... (Existing code for player attack)
}; 
Also How Does Dynamic Light Work? 
I can't find how the rocket emits light?

(trying to use as a reference to see how to attach dynamic light to objects using qc)

but there's no reference to any "light" in weapons.qc? 
@ranger 
That one is actually hard-coded in the engine, any model file with EF_ROCKET flag will get a rocket smoke trail and have a dynamic light attached to it. The flag can be set in model editors like qME.

But a glow can also be added in QC, for example enforcer lasers are implemented that way. Check out LaunchLaser in enforcer.qc for an example. 
@metlslime 
seems I cannot find the setting in qc for the weapons/r_exp3.wav?

there's only a BecomeExplosion, but I don't see any sound attached..... 
@ranger 
weapons/r_exp3.wav seems to be directly called by some explosions in QC. But for rockets, it's hard-coded in the engine as part of TE_EXPLOSION 
@metlslime 
oh so cannot adjust attn for explosion sound?

wanted explosion sound range to go further 
Dynamically Spawn/replace Items? 
I saw some mods do this IIRC but it seems complex because quake has a "compiler order" it seems?

I can't have health kits spawn nearby enemies because it would say monster_zombie() is unknown but i cann't move monster_zombie.qc higher up in the "compiler order" because it then has multiple errors?

basically I want the game to have a chance of dynamically spawning nearby zombies at health kits - and it should by realtime/so works with any map 
Forward Declaration 
What you need is a forward declaration of void monster_zombie().

https://en.wikipedia.org/wiki/Forward_declaration

Then you can keep zombie.qc lower in the compiler order and use it with healthkits.

For your explosion, you could maybe opt into the mission pack features and use TE_EXPLOSION2 which I think is silent so you can pair it with your own sound. Otherwise there's a hack posted by a scoundrel called Preach in the previous pages of this thread
https://www.celephais.net/board/view_thread.php?id=60097&start=1911&end=1935 
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.