|
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. |
|
|
MapSearch & Inky's Hexen II Mapping Corner
#2810 posted by Inky on 2020/05/05 09:55:58
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 : http://earthday.free.fr/Inkys-Hexen-II-Mapping-Corner/MapSearch.html
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
#2811 posted by Mezmorki on 2020/05/16 18:58:11
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";
self.skin = 1;
}
Let's take one question at a time. Any idea how I can assign skins to the bots?
Taking The First Exit
#2812 posted by Preach on 2020/05/16 23:54:55
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!
#2813 posted by Mezmorki on 2020/05/17 15:49:41
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)
{
makevectors(self.angles);
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 (self.skin == 0) centerprint(self, "Respawning as... Quakeguy"); else
if (self.skin == 1) centerprint(self, "Respawning as... Doomguy"); else
if (self.skin == 2) centerprint(self, "Respawning as... Arnold the Terminator"); else
if (self.skin == 3) centerprint(self, "Respawning as... Arnold the Conan (4)");
//LINES REPEAT FOR ALL 32 SKINS...
// *************************************************************************
// ** **
// ** 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?
Hmm
#2814 posted by Preach on 2020/05/17 23:49:47
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.
#2815 posted by Mezmorki on 2020/05/18 01:33:19
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 (self.skin == 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.
Hmmm
#2816 posted by Mezmorki on 2020/05/19 12:55:15
The message is getting printed to the console if I have the console open when I die.
Centerprint
#2817 posted by Preach on 2020/05/19 22:25:31
You got the self part right, I was worried you might have done something like
if (self.skin == 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
#2818 posted by Mezmorki on 2020/05/22 04:10:49
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. :)
Trigger_changemusic + Saves
Alright. Thanks to Johnny Lew I have a trigger_changemusic in progs_dump however, I have no idea how to get this to work with savegames. Any guidance?
//thanks to Johnny Lew via changemusic.rar --dumptruck_ds
void() trigger_changemusic_touch =
{
if (!(other.flags & FL_CLIENT))
{
return;
}
if (!self.sounds)
{
objerror("ERROR: trigger_changemusic needs valid track number in sounds field");
return;
}
WriteByte(FL_SWIM, FL_MONSTER);
WriteByte(FL_SWIM, self.sounds);
WriteByte(FL_SWIM, self.sounds);
self.touch = SUB_Null;
self.nextthink = (time + 0.1);
self.think = SUB_Remove;
};
void() trigger_changemusic =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
InitTrigger();
self.touch = trigger_changemusic_touch;
};
@mezmorki
#2820 posted by R00k on 2020/05/29 06:30:48
con_logcenterprint 1 is the option to print centerprint messages to console. setting it to 0 obv turns that off.
;)
Dumptruck:
#2821 posted by metlslime on 2020/05/29 07:45:07
you mean, you want to remember which music track was playing and restore that when the savegame loads?
Check out rubicon 2 source code, the function LoadSaveGameCallback, the logic to call in StartFrame, and the special variable loadsavegamecallback_done -- this setup allows you to do any necessary work after loading a save game, such as re-triggering client side looping sound effects.
In theory you can save the desired music track in some variable, and then when the game is reloaded, check that variable and re-trigger the music in your own version of LoadSaveGameCallback.
Metlslime
yep. I was looking through other mods yesterday. I should've known to start with Rubicon 2! thanks.
More Trigger_changemusic
I'm posting this for those who come after. It should plug into mods easily. As I was looking over Rubicon 2 code and overheating my pea-brain, Spike posted this on Discord. It works well so far but I need to test in various source ports. This isn't as flexible as what metl posted above but it works for this implementation. NOTE the & and * are correct below
add this to worldspawn in world.qc
world_sounds = &world.sounds; //Spike not read-only yet...
add this to defs.qc
nosave float *world_sounds; //via Spike fun times! nosave=noclobber
add to bottom of triggers.qc
void(float newtrack) changemusic =
{
*world_sounds = newtrack; //changing the field via a pointer
//world.sounds has now been changed via our pointer, newly connecting players (like those connecting after the game is loaded) will get sent the new cd track's number.
//let everyone currently on the server know.
WriteByte(MSG_ALL, SVC_CDTRACK);
WriteByte(MSG_ALL, newtrack); //initial track
WriteByte(MSG_ALL, newtrack); //looped track... should generally be set the same as the initial track as most engines ignore it entirely so it might as well be sane for those that care.
};
//thanks to jleww via changemusic.rar --dumptruck_ds
void() trigger_changemusic_touch =
{
if (!(other.flags & FL_CLIENT))
{
return;
}
changemusic(self.sounds);
self.touch = SUB_Null;
self.nextthink = (time + 0.1);
self.think = SUB_Remove;
};
void() trigger_changemusic =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
if (!self.sounds)
{
objerror("ERROR: trigger_changemusic needs valid track number in sounds field");
return;
}
InitTrigger();
self.touch = trigger_changemusic_touch;
};
Correction
oops I just noticed
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
that is in progs_dump only - you won't need it elsewhere and it will cause an error on compile
How Does Size Work?
#2825 posted by Inky on 2020/06/21 20:35:39
Hi everybody,
I'd like to put in some extra-large monsters to make usual lesser threats a far more scary danger.
From what I can see, seems the size is dealt with code looking like that:
setsize (self, '-32 -32 -24', '32 32 40');
where the 2nd and 3rd parameters correspond to VEC_HULL_MIN and VEC_HULL_MAX respectively.
Yet I can't figure out what the term "hull" actually refers to, nor how a size could possibly be "negative" (unless maybe it's lovecraftian non euclidean geometry brought in QuakeC by Shub-Niggurath herself???)
Your help to my comprehension would be extremely appreciated. Thank you a lot in advance ! :-)
Tale Of Two Halves
#2826 posted by Preach on 2020/06/21 21:27:02
OK, so this is a bit complicated. For almost all purposes, you have exact control over the bounding box of an entity - but the one exception is really, really important!
The normal bounding box is a cuboid which doesn't ever rotate as the entity moves. The two vectors are relative offsets - they say how far the corners of the bounding box should be from the origin of the entity. The negative ones put the lower corner to the left, back and below the origin of the entity, the positive ones specify a position to the right/front/above the origin.
Interesting to note that those parameters mean the origin isn't dead centre of the cuboid, the bottom of the bounding box is 24 units below the origin, but the top is 40 units above it.
One place where the exact bounding box is used is when colliding with...another bounding box. The exact size of the bounding box is also tested to check if traces from e.g. shotguns have hit something.
However, the one place where the bounding box is (sorta) ignored is calculating collisions against BSP objects. To run faster on Pentium 90s, Quake only computes the spaces that three sizes of object can fit around BSP objects:
• point-sized
• man-sized
• shambler-sized
The precomputed spaces are called "hulls". If the bounding box isn't one of those three sizes, the Quake engine picks a "best-fit" from the available hulls. If you want to get consistent collision, you have to pick one of those three sizes, and the constants are there to make that easier.
My Triviant
#2827 posted by madfox on 2020/06/21 22:23:25
r_drawviewmodel 1 makes a lot clear.
I try to make a monster launch an attack with three projectiles. One straight forward and two sideways parallel to the player. I studied Wiz_StartFast but I can't make the sideways parallel in line. The outside projectile always aims to the player, not aside.
Where should I start?
Thank You Preach!
#2828 posted by Inky on 2020/06/21 22:46:11
Your explanation is crystal clear and I would not have guessed that alone, thank you so much!
Now just need to find where the reference hulls for Hexen II are defined (I'm mapping for H2) and I'm done. :-)
Madfox
#2829 posted by Preach on 2020/06/22 00:26:31
Have you tried looking at the Hell Knight code? I think he does what you're asking for - just spread out over multiple frames instead of all at the same time...
Ah
#2830 posted by madfox on 2020/06/22 00:59:55
Yes Preach, that makes sense.
It don't has to be a simillar shot, although it would look fine.
#2831 posted by yhe1 on 2020/08/08 13:16:36
I will ask this for Madfox here:
So in version 2.38 of the chasm mod, the Mong does not react after being hit by a stratos. However, they will infight on rare occasions. But I cannot figure out what these occasions are. I managed to capture a saved game of them infighting, attached below, maybe somebody could take a look at it? This issue is really weird, monsters either infight or don't infight, but not infight rarely.
The saved games are here:
https://www.dropbox.com/s/1t1f4mi780x957w/chasm%20quake%20saved%20game.rar?dl=0
2.38 is here:
http://home.kpn.nl/lo2kf8/quake/Quasm_dev2.38.zip
Yhe1
I figured it out, tagged madfox on discord...
The monsters first frame of run animation has a ai_walk in it.... change it to ai_run and it works just fine.
#2833 posted by Drugod on 2020/08/10 10:33:22
Hi, everyone im doing my first code for quakec and I need some help
I would like make a 1920's wall lamp, my entity works but i would like instead a common light a flickering one, i use this code but seems doesnt works properly (compiling is ok), any suggestion? Thanks a lot in advance!
My code:
/*QUAKED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20)
Short wall torch
Default light value is 200
Default style is 7
*/
void() light_wall_lamp =
{
precache_model ("progs/lamp.mdl");
setmodel (self, "progs/lamp.mdl");
FireAmbient ();
self.style = 3;
lightstyle(self.style, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
makestatic (self);
};
How looks on quake
https://imgur.com/73NlC7s
Drugod
#2834 posted by metlslime on 2020/08/10 16:42:16
If you want to make a custom light style you should give it a new number not already used and place it with the other light style definitions (forgot where — world.qc)?
Then, it seems bad to hard-code the style in the entity spawn function since it prevents a mapper from changing it per instance in the map. You could do a check “if self.style == 0 then self.style = 3” which would let mappers use different styles but also add the convenience of if being automatic for lazy mappers.
|
|
You must be logged in to post in this thread.
|
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.
|
|