|
Posted by metlslime on 2007/08/08 04:57:56 |
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. |
|
|
#1800 posted by Spike on 2015/11/13 09:12:29
tweaking those two cvars (via the cvar_set builtin or via default.cfg) is basically equivelent to replacing the wavs with silence.
and silence works in more engines, so either go with silent wav files or just live with the noise.
"while" Loop On A Monster Attack As Long As The Target Is On Sight
#1801 posted by aDaya on 2015/11/13 10:28:48
I'm continuing on my singleplayer mod, and after the two guns I made I finished doing the assets of the Nail Infantry (now reduced to an enforcer reskin, trying to fuse the original model with another one spawns more difficulties than necessary), all I need is a tweak for the attack so that he attacks like the ChainGunner in Doom 2, as in he continues firing as long as the target is on sight.
I know for one thing it's something like "while ["target" is on sight"]=>[attack sequence]", but how should I write "while ["target" is on sight"]"?
#1802 posted by Lunaran on 2015/11/13 18:49:36
if(visible(self.enemy))
don't use while, or he'll dump all his ammo in a single frame. or, use while just to see that happen first.
Personally
#1803 posted by ijed on 2015/11/13 18:57:28
I'd have him cycle between a few frames of animation - one which fires the projectile and one which checks to see if his target is visible. And then either some padding frames in between to make it less likely that he stops afiring s soon as the player is out of sight, or store a value and use a counter to do the same, resetting the count each time he starts firing again.
You might want to look at the scrag shooting - it has a couple of clever ideas in there, like firing at where the player was before they went out of sight.
You could get leading from chthon as well, but leading sucks.
Paralyze
#1804 posted by madfox on 2015/11/14 20:35:29
Maybe I'm not the first one that comes up with the idea, but would it be possible to give a monster an attack that freezes the player?
Just for a few frames, one second would be enough. I imagine it would be strange effect, because for the player it would be as if the game screen blocks, while after that time monsters would be on a different place. If the player survives the damage meanwhile.
Maybe it is just an insane idea, with all that crap like server messages and all, but anyway.
Would it even be possible?
#1805 posted by necros on 2015/11/14 20:54:17
It would be, but would probably be quite complex.
If you just need to make it look like monsters have moved while you were standing still, you could duplicate all monsters and replace them with stationary models with the same frame, angles, etc...
Then, make the real monsters temporarily have no model (change to a sprite with 255 frames and a transparent image) and keep running ai functions as normal.
then, when the effect ends, remove all the fake monsters and restore the normal models to the real monsters.
but yeah, very complex.
Ah
#1806 posted by madfox on 2015/11/14 21:33:44
feels like an Alice touch.
I think I first go for a bucket of coffee in the AIcafe before I start that!
Thanks anyway!
Rotten Cells
#1807 posted by madfox on 2015/11/14 22:55:54
I made a cell ammubox bsp that leaks.
It shows up in game by adding it to items.qc.
What does it need to fool the player, so it won't charche an amount,
or better make the amount less?
For now it works just like ammu_cell adding 5.
Monster Spawning Properly In Maps
#1808 posted by aDaya on 2015/11/15 14:16:09
So I've done coding for my chaingunner-like, he's visible in TrenchBroom, but when I play the map he's nowhere to be seen. I assume it's because I missed some qc file that stores monster classes, or at least a qc file that stores the qc files themselves, but as far as I know I can't find such a thing.
I followed this tutorial: http://www.insideqc.com/qctut/qctut-49.shtml and instead of telling what's the proper way to spawn an independant monster, he just tells to just replace a monster. That's shitty.
Classnames
#1809 posted by Preach on 2015/11/15 15:00:54
Hi Daya, I may be teaching you to suck eggs or whatever, but here's the basic idea that lets you spawn an entity in Quake:
classname in the map editor corresponds to a function name in QC
So if you look at the function called monster_shambler (in shambler.qc), the instructions there are followed at every point that you add an entity to your map whose classname is monster_shambler.
So if you've already written the code for your monster, you should have an equivalent function in your qc which sets the health, model, animations etc for your chaingunner. If you have called this function monster_chaingunner, you need to add an entity whose classname is monster_chaingunner. If you can't get that working, rerun your map with "developer 1" in the console and look out for the error message
Bonus Post
#1810 posted by Preach on 2015/11/15 15:19:08
The linked tutorial commits a sin, a subtle but important piece of bad design. If you run the mod, load a map and find a mage, make a save game. If you keep reloading the game, at random all the models will go wrong when you load a save game. Why?
Well, it's because of the randomisation, which will occur differently each time you run the map. The save file does not actually stored the list of precached models, and instead regenerates it by loading the map from scratch, before loading the saved data. Whether the first monster on the map is a mage or a vore will change the order of precaches, and if the decision goes different ways between the initial load and the re-load, you get mismatched models!
There are a few ways you could fix this. You could precache all the models for the vore and the mage before rolling the dice to see which one you get. You could make the method of switching pseudo-random rather than random so that the same order occurs each time you load the map. The important lesson is that when it comes to the map initialisation sequence, you can't allow anything random to affect a precache.
No Dice
#1811 posted by aDaya on 2015/11/15 15:54:46
I forgot to mention I based my coding by making a copy of enforcer.qc and did the modifications fromp here. I actually did that "monster_nailinf" stuff before, and tried to remove the 2s the precache code had from the enforcer code, but still to no avail.
Running darkplaces with "developer 1" in, and it says this:
http://image.noelshack.com/fichiers/2015/46/1447599239-infantry20151115155014-00.jpg
I'd also like to note the guy's supposed to be following pathcorners in front of me, if that information can help.
#1812 posted by necros on 2015/11/15 16:01:36
Is it included in the progs.src file?
Nalinf.qc Included While I'm At It
#1813 posted by aDaya on 2015/11/15 16:04:00
Necros
#1814 posted by aDaya on 2015/11/15 16:08:50
Thank you, that was exactly what I was looking for! Now the monster spawns with no problem.
Now the only thing that needs fixing is the idle sound and death sound not playing, as well as the rate of fire and him stopping shooting when the target's dead.
#1815 posted by necros on 2015/11/15 16:33:27
Idle will only play when walking, not standing. And you precached death but play death1.
One Last Thing
#1816 posted by aDaya on 2015/11/15 17:13:51
in the line that checks if the target is on sight, how should I write "or if the target's health equals or is inferior to 0"?
More Like "or If The Target's Health Is Superior To 0"
#1817 posted by aDaya on 2015/11/15 17:18:18
Code
#1818 posted by Preach on 2015/11/15 17:28:36
if(self.enemy.health > 0)
It translates into code quite directly. Also you want use AND here, not OR, because you only want to continue firing if your enemy is visible and is alive, so in total you need:
if(visible(self.enemy) && self.enemy.health > 0)
Thanks A Lot Preach!
#1819 posted by aDaya on 2015/11/15 17:49:29
Opening A Can Of Worms
#1820 posted by aDaya on 2015/11/16 11:35:19
So the next step in my mod is to add my lines of code into the latest quoth release by decompiling it. I could stop here and just have the Infantry Gun, Gatling Gun and Nail Infantry, but for what I want to do I'd love to use quoth's expansion as well as my stuff on top of it, stuff like more base monsters (or hell, more monsters in general), rotating doors, teleporting enemies... all of that good stuff.
So I've been doing a bit of research. I tried this: http://quakeone.com/files/10-miscellaneous/95-mrelusives-quakec-compiler-1999/ but it says the directories don't exist despite what seems to be a clean command line ("path to progs.dat" -d). Then I red this: http://www.quakewiki.net/archives/botshop/code/plus.txt and downloaded said software. When executing it, Windows says the program is not compatible with my current version of W8.1.
Going back to the first software, I grabbed its progs.dat on the software's directories, but it says after analyzing progs.dat "DEC_CalcProfiles - No parameter names with offset 377".
Anybody can help me there?
Man, Is Decompiling Such A Taboo Thing?
#1821 posted by aDaya on 2015/11/17 10:01:13
#1822 posted by Spike on 2015/11/17 10:47:31
"DEC_CalcProfiles - No parameter names with offset 377".
that basically means that the qcc stripped out the names (and very probably types too) of locals.
this means that if you can find a decompiler that makes stuff up, you'll still end up with what is basically gibberish.
You do NOT want to have to maintain that.
I have a private fork of frikdec which will try to decompile anything. nothing is fatal, it just writes out a best-effort instead. which is gibberish.
I don't give it out for a few reasons:
1) I don't want the flak from modders pissed at me for opening up their closed mods.
2) I don't want to have to maintain it.
3) I REALLY REALLY REALLY DO NOT want to have to help other people get it to compile.
4) any encouragement to get people to work on decompiled code is a baaaad idea.
5) unmodified frikdec is good enough for most purposes. mods that it can decompile generally have enough usable hints to not result in gibberish.
6) this way madness lays.
years ago, I did toy with the idea of 'appending' to a progs.dat file. load an existing progs, compile some new code, write out a new one with the extra code added (with some functions wrapped or whatever).
I didn't get very far with it though.
by the way, decompiled code sucks.
Daya
#1823 posted by Kinn on 2015/11/17 15:40:07
If the mod is closed source, your best bet is to approach the authors and ask nicely.
Decompiling isn't really the way forward.
Changeroll ()
Anyone know where I can find a good QC written function for this one that ID left out? I found one in another forum but its usinf a function called anglemod_view () which has a lot of while statements and seems prone to runaway loops. Mostly because it seems to have problems with a 360 degree roll.
|
|
You must be logged in to post in this thread.
|
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.
|
|