News | Forum | People | FAQ | Links | Search | Register | Log in
Teaching Old Progs.dat New Tricks.
You know about the info_notnull explosion hack. You know about making monsters drop weapons or alternate ammo using the .weapon and .ammo_whatever hacks. You know about making items float in the air by spawning them on a temporary platform. Let's have a thread where we talk about new ways to use existing behavior and get novel gameplay. If you're a "retired" mapper, this is a great time to do some armchair level design and suggest ideas you'll never have a chance to use yourself.
First | Previous | Next | Last
Well, Try It Anyway 
I thought items are spawned/drop after 0.2 seconds. I've never encountered problems with this value anyway. 
 
I thought it was 0.1 so, yeah, this should work... 
0.2 After The Spawning Frame 
But time starts at 1, not 0 
Scripting Languages Besides QuakeC 
Has any work been done to incorporate, say, Lua into a progs? 
The Horror, The Horror 
I wouldn't recommend it.

AFAIK it wouldn't be difficult, but Lua gets messy over time and, to me at least, is harder to debug than qc. 
Other Langs In Quake 
The reason I ask is because I love programming in highly-expressive languages, specifically Scheme and Haskell. I know Lua isn't "all that", but something nicer than QC would make me happy. After all it's a hobby, and hobbies should be f.u.n.! 
 
Haskell is pretty fun. Studied it in the first year of Uni up in Edinburgh. Phil Wadler, the designer of Haskell was the lecturer, and I'll never forget the first lecture, when he tore off the shirt he was wearing to reveal a t-shirt with a giant lambda symbol on it.

He also shouted LAAAMBAAAA!!!. Dude really loved lambda calculus. Think I laughed at that for a solid week. For reference he also looks like this:
http://homepages.inf.ed.ac.uk/wadler/Pics/philtiebig.jpg 
 
That is awesome. I've noticed that a lot of people worship the lambda. Have you heard the story about how Feynman, for his intro physics class, hung a bowling ball from the ceiling? He stood up against the wall, pulled the ball up to touch his nose -- and let it go. Of course, on the return swing, it did not touch smash into his face. His point was that physics works, and you have to get an intuitive feel for it to be good at it.

There's a nice thread here about 'why did Church pick lambda?':

http://groups.google.com/group/plt-scheme/browse_frm/thread/d8a31482f811a0e8/42064e654a20887d?tvc=1 
Triggering From A Monster 
is it possible to trigger a target with a monster as the activator?

i've tried spawning the monster on top of a trigger_teleport, having the monster walk onto the trigger_teleport (with path corners) and lowering a monster into a trigger_teleport with a func_door.

the trigger_teleport had a target, but somehow i was still the activator when the monster would go through the teleporter.

all i can think of would be to make a dummy monster that targets the entity, and make the spike_touch hack kill the dummy with the owner pointing to the activator monster, but that's convoluted as hell and really ugly. 
Yes, It Can Happen 
For example, if a monster kills another through infighting, and the dead monster had a target, then the killer will be the activator of the target. This caused a very tricky to identify bug in a recent map whose author will remain nameless here...
So it can happen.

Making it happen on demand is a bit trickier. I think I've come up with a hack that will do it though. Add an info_notnull and set its enemy field to the entity number of the monster in question. Then set its use field to trigger_multiple. Then if you use the info_notnull, it will fire its targets with its enemy as the activator.

How it works: originally I was going to try doing it with the "naked trigger_multiple" hack, where you make a trigger that monsters can touch, and have the teleporting monster touch it. That trick relies on short-circuiting the multi_touch function which usually guards against non-player touches.

Unfortunately, skipping that function also skips the line which sets the trigger's enemy to the touching monster/player/fireball. This enemy is then used as the activator - so you still wouldn't get the monster as the activating entity. Instead you get whatever was in the enemy field to being with - world being the default. I got half way through typing up a solution involving the spike_touch hack setting off a trigger_multiple with health, before I saw the short cut that would save an entity...

Not properly tested it btw, but I'm pretty sure that will work as intended! 
Thanks 
that sounds like a much better solution. this brings me to another question i should have asked: how *do* you find the edict numbers?

typing edicts in the console outputs ALL the edicts, and even with condumping, it only actually prints the last 80-100 or so. (the map has over 600 edicts).

all i can think of is to maybe make a progs, but can you even bprint() the edict number? 
Oh 
this always happens, i figure out how to do it after i ask. :P 
Aannnd 
it works. thanks!

btw, it's 'use' 'multi_trigger', not 'trigger_multiple' 
Edict Hunting 
This is actually reminds me of something I've had in the back of my mind as a desirable feature for a "development" quake engine. Better searching of the entity list with the edict command. The biggest improvement would be to be able to specify a classname, like

edicts monster_knight

would output a list of every knight in the map.

Once you have that, partial matches would be the next most handy feature, so that

edicts monster_

would return a list of all the monsters in your map. If you really needed flexability, you could extend it to match other fields instead, like

edicts targetname skulldoor

would give you all the entities targeted by "skulldoor". If anyone other than myself would be interested in that, I might take a look at hacking it together...

There are workarounds until such things are available. If you save the game instead of running the edicts command, you can open the save file in a text editor and get essentially the same information out of it - or even run -condebug and read through the output file at the same time. The only thing that the save game lacks is...entity values themselves! So the latter method is needed for those 
That Would Be Pretty Badass 
except that it's only real use would be for hacks, correct? 
That Would Rock 
It could also be useful for checking targetnames and goalentities etc. Though I would probably use it only for hacks, yeah. 
QC Application 
I'd also find it really useful when debugging mods, although not so many people are going to care about that. I'm gonna go away now and see if I can get the new version of fitz to compile... 
Half Way 
The following replacement code will perform partial matches on classname. Find the function in pr_edict.c and replace it entirely with this. I've only tested it in fitzquake085 so far, but I don't see any reason why it wouldn't work in the original source. Other engines might have changed the functions that it calls, but I'd say even that is unlikely...


/*
=============
ED_PrintEdicts

For debugging, prints all the entities in the current server
PREACH: If supplied with a second argument, only reports entities whose classname initially match the argument
=============
*/
void ED_PrintEdicts (void)
{
�int i;
�edict_t *ent;
�switch (Cmd_Argc())
�{
��case 1:
��{
���for (i=0 ; i<sv.num_edicts ; i++)
����ED_PrintNum (i);
����Con_Printf ("returned %i entities\n", sv.num_edicts);
���break;
��}
��default:
��{
���int j,len;
���len = strlen(Cmd_Argv(1));
���j = 0;
���for (i=0 ; i<sv.num_edicts ; i++)
���{
����ent = EDICT_NUM(i);
����if( !strncmp(Cmd_Argv(1),pr_strings + ent->v.classname,len) )//match initial substring
����{
�����ED_Print(ent);
�����++j;
����}
���}
���Con_Printf ("returned %i of %i entities\n", j, sv.num_edicts);
���break;
��}
�}
}


Getting it to match against any field is a little bit more tricky, so I'm gonna keep working on that now. Once I get that, I'll post the code and a binary. 
And A Follow Up 
Phew, not too bad. You can grab the following function added to fitzquake085 from:

http://www.btinternet.com/~chapterhonour/fhack085.zip


void ED_PrintEdicts (void)
{
�int i;
�edict_t *ent;
�switch (Cmd_Argc())
�{
��case 1: //regular call
��{
���for (i=0 ; i<sv.num_edicts ; i++)
����ED_PrintNum (i);
���Con_Printf ("returned %i entities\n", sv.num_edicts);
���break;
��}
��case 2: //match against classname
��{
���int��j,len;
���len = strlen(Cmd_Argv(1));
���j = 0;
���for (i=0 ; i<sv.num_edicts ; i++)
���{
����ent = EDICT_NUM(i);
����if( !strncmp(Cmd_Argv(1),pr_strings + ent->v.classname,len) )
����{
�����ED_Print(ent);
�����++j;
����}
���}
���Con_Printf ("returned %i of %i entities\n", j, sv.num_edicts);
���break;
��}
��default: //match against given entity field
��{
���int j,len;
���int *v;
���ddef_t *search_field;
���search_field = ED_FindField(Cmd_Argv(1));
���if(!search_field)
���{
����Con_Printf ("Bad field name\n");
����break;
���}
���
���j = 0;
���len = strlen(Cmd_Argv(2));
���for (i=0 ; i<sv.num_edicts ; i++)
���{
����ent = EDICT_NUM(i);
���//this is ugly as hell, WTF Carmack?
����v = (int *)((char *)&ent->v + search_field->ofs*4);
����if( !strncmp( Cmd_Argv(2),PR_UglyValueString( search_field->type, (eval_t *)v),len)) //match initial substring
����{
�����ED_Print(ent);
�����++j;
����}
���}
���Con_Printf ("returned %i of %i entities\n", j, sv.num_edicts);
���break;
��}
�}
}


Only minor bugbear I have with it is that tab still activates autocomplete on the second parameter, but it completes commands, which is unhelpful. Otherwise, it's cool. 
 
//this is ugly as hell, WTF Carmack?
lol

nice work! :) 
Nice One 
Let's see how this works out in the field. 
 
"//this is ugly as hell, WTF Carmack? "

Well, Carmack's reply would probably be something like, "We were trying to ship a game on new technology. This ugliness was maybe .00000001% of the workload. Unimportant." :) 
 
we've covered removing items from the inventory via a func_door function hack.

is it possible to co-opt sigil_touch() to remove runes from the player?

i was thinking if you gave built a trigger from scratch with a touch function of sigil_touch and gave it a spawnflags # corresponding to the appropriate rune (1, 2, 4, 8) except negative, it might be possible to subtract it out of the serverflags global variable.

except that the way they added the flag is in a form i'm not familiar with (and i don't know much about bitwise manipulation except what i've learned here).

serverflags = serverflags | (self.spawnflags & 15);

except that serverflags = serverflags | (serverflags & self.spawnflags);
would have seemed to me the correct way of adding the flag in.
what does the actual line do? will it prevent subtracting the flag off? 
 
serverflags = serverflags | (self.spawnflags & 15);

first, the & character is bitwise AND operator, which means that for each bit, the result is 1 only if both inputs are 1 for that same bit. 15 is 1 + 2 + 4 + 8, So self.spawnflags & 15 is going to only allow those first four bits in self.spawnflags to be used in the next step.

The next step: | is the bitwise OR operator, which means that for each bit, the result is 1 if either input has a 1 for that bit. So serverflags = serverflags | x is going to turn on any bit in serverflags that is in x, and leave on any bit that was already turned on before.

So basically, only the first four bits in serverflags can be turned on with a rune, and, you can't turn any bits off. 
Ah 
damn shame, thanks though :) 
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.