Preach
#3533 posted by blaGGer on 2005/04/18 14:42:14
Words of wisdom thank you.
I started looking at code back about front as I wanted to see how to compile before I had written anything to compile. So I decompiled some progs.dat to play with which is why I ended up with code without comments. So now I try to do it right.
I now have the source code and it is yours. What is the extension .$$$ used for? The code in these files includes shalrath_tele. Does the $$$ files get compiled just the same?
How does the game know that the code for monster_shalrath_tele as entered in the map file is in the shalrath qc file, is this defined somewhere else? I am not clear because you say in the readme file that if the shalrath is not to teleport away than use the ordinary shalrath so I think that both will be compiled.
I am really interested in learning about this code so I am sorry if all of this is too simple for you but will be pleased if you will help.
Make $$$ Quick!!!!!
#3534 posted by Preach on 2005/04/18 16:44:52
Arrrgh, I shouldn't have left the $$$ files in there. They are backup files that get automatically generated by the program I use to edit qc files, you can safely ignore them or delete them.
The idea behind the monster_shalrath_tele is this: When a map is loaded, the engine looks at the name of every entity that is included in the map. It then tries to find a function in the QC with the same name as the entity, and runs that function(or produces an error message if it can't find the function). The function is usually designed to set up the entity in question, set it's model, it's behaviour and so on. The engine sets the entity called self to be the entity in the map, so by setting self.health in the function you affect the health of the thing in the map.
When you run this mod along with a map that has a monster_shalrath_tele entity, it runs the function
monster_shalrath_tele();, which basically makes a vore in the right place in the map, with a special death animation that looks like a teleport.
Because there's a new function for this kind of shalrath, the old one is still present, and unchanged. So any monster_shalrath in the map will be just like the ones in the original quake. I could have programmed it differently, so that you just set a flag on a normal monster_shalrath in the map, that makes it teleport out on death, but I did it this way because that's what the original recipient requested.
If you wanted to make, say, a new monster, so that the entity you added to a map was called monster_troll, then you'd call all the animation functions and so on whatever you like(although it's usual to stick to the conventions in the existing code). Then just ensure the spawn function was called monster_troll().
Hope that clears up how the game knows what code to use for which entites.
Preach
#3535 posted by blaGGer on 2005/04/18 23:18:17
Great, I understand now. Thank you.
Preach
#3536 posted by blaGGer on 2005/04/19 13:16:27
Well, I am quite pleased because I managed to find your error tutorial hidden in the shambler.qc file ;-)
monster_shambler_tele_set
and
monster_shambler_set_tele
I stared at it for a long time before I could see it!
I didnot try the progs.dat supplied as I was adding some code so I cannot say if is OK or not. But it compiles good now and works fine. Thanks again.
Preach
#3537 posted by blaGGer on 2005/04/19 13:17:03
Well, I am quite pleased because I managed to find your error tutorial hidden in the shambler.qc file ;-)
monster_shambler_tele_set
and
monster_shambler_set_tele
I stared at it for a long time before I could see it!
I didnot try the progs.dat supplied as I was adding some code so I cannot say if is OK or not. But it compiles good now and works fine. Thanks again.
Preach
#3538 posted by blaGGer on 2005/04/19 13:17:47
Well, I am quite pleased because I managed to find your error tutorial hidden in the shambler.qc file ;-)
monster_shambler_tele_set
and
monster_shambler_set_tele
I stared at it for a long time before I could see it!
I didnot try the progs.dat supplied as I was adding some code so I cannot say if is OK or not. But it compiles good now and works fine. Thanks again.
Preach
#3539 posted by blaGGer on 2005/04/19 13:18:25
Well, I am quite pleased because I managed to find your error tutorial hidden in the shambler.qc file ;-)
monster_shambler_tele_set
and
monster_shambler_set_tele
I stared at it for a long time before I could see it!
I didnot try the progs.dat supplied as I was adding some code so I cannot say if is OK or not. But it compiles good now and works fine. Thanks again.
Preach
#3540 posted by blaGGer on 2005/04/19 13:26:36
Well, I am quite pleased because I managed to find your error tutorial hidden in the shambler.qc file ;-)
monster_shambler_tele_set
and
monster_shambler_set_tele
I stared at it for a long time before I could see it!
I didnot try the progs.dat supplied as I was adding some code so I cannot say if is OK or not. But it compiles good now and works fine. Thanks again.
Preach
#3541 posted by blaGGer on 2005/04/19 13:26:47
Well, I am quite pleased because I managed to find your error tutorial hidden in the shambler.qc file ;-)
monster_shambler_tele_set
and
monster_shambler_set_tele
I stared at it for a long time before I could see it!
I didnot try the progs.dat supplied as I was adding some code so I cannot say if is OK or not. But it compiles good now and works fine. Thanks again.
Preach
#3542 posted by blaGGer on 2005/04/19 13:27:04
Well, I am quite pleased because I managed to find your error tutorial hidden in the shambler.qc file ;-)
monster_shambler_tele_set
and
monster_shambler_set_tele
I stared at it for a long time before I could see it!
I didnot try the progs.dat supplied as I was adding some code so I cannot say if is OK or not. But it compiles good now and works fine. Thanks again.
Preach
#3543 posted by blaGGer on 2005/04/19 13:28:06
Well, I am quite pleased because I managed to find your error tutorial hidden in the shambler.qc file ;-)
monster_shambler_tele_set
and
monster_shambler_set_tele
I stared at it for a long time before I could see it!
I didnot try the progs.dat supplied as I was adding some code so I cannot say if is OK or not. But it compiles good now and works fine. Thanks again.
Preach
#3544 posted by blaGGer on 2005/04/19 13:28:13
Well, I am quite pleased because I managed to find your error tutorial hidden in the shambler.qc file ;-)
monster_shambler_tele_set
and
monster_shambler_set_tele
I stared at it for a long time before I could see it!
I didnot try the progs.dat supplied as I was adding some code so I cannot say if is OK or not. But it compiles good now and works fine. Thanks again.
Preach
#3545 posted by blaGGer on 2005/04/19 13:28:25
Well, I am quite pleased because I managed to find your error tutorial hidden in the shambler.qc file ;-)
monster_shambler_tele_set
and
monster_shambler_set_tele
I stared at it for a long time before I could see it!
I didnot try the progs.dat supplied as I was adding some code so I cannot say if is OK or not. But it compiles good now and works fine. Thanks again.
Lol
#3546 posted by Kinn on 2005/04/19 13:31:39
Holy Fuck,
#3547 posted by - on 2005/04/19 14:15:00
a new record!
blaGGer, please don't hit submit a bunch of times, or refresh or whatever the hell you did.
Hahahahahahaha
#3548 posted by pjw on 2005/04/19 18:31:18
A dectuple-post!!
Hell yeah. If you're going to do something, then by golly, just go all out with your bad self.
I'm home sick today and feel kind of shitty, and that made me feel better.
#3549 posted by madfox on 2005/04/19 21:12:05
I am not in the trunc dreath?
I am not in the grunt breath?
I am not in the drunk thread?
Blagger Is Just Simply Quite Pleased!
#3550 posted by Friction on 2005/04/19 22:15:09
;-)
Sorry, Sorrry, Sooorrrry
#3551 posted by blaGGer on 2005/04/19 22:43:41
So sorry times many times!
BlaGGer
#3552 posted by JPL on 2005/04/19 23:06:48
I really think you need to take medical advice from a neurologist to solve your restlessness problem... believe me... ;)
Flawless Victory!
#3553 posted by Lunaran on 2005/04/20 09:04:01
blagh!
Trigger_teleport Sound
#3554 posted by blaGGer on 2005/04/22 15:40:30
I there a problem with the SILENT flag in the trigger_teleport routine as it makes no difference if it is set or not.
I am looking in the triggers.qc file and the only reference I can see is
if (!(self.spawnflags & SILENT))
Is that right? & or ==
Silence Is Golden
#3555 posted by Preach on 2005/04/22 16:09:38
It may be that the flag is working, just not how you expect. Silent teleporters still make the noise when something teleports in, they just don't make the ambient teleporter hum near to the trigger. It's intended for trigger_teleports that sit outside the main level, for teleporting monsters in, as the sound out there would be pointless, unless it spilled over into the real level, which would be confusing.
Preach
#3556 posted by blaGGer on 2005/04/23 01:00:42
What I am wanting is for no sound at all when I teleport my extra monsters in. I am happy for there to be sound when the player uses a trasporter. I have some triggers that teleport monsters into places the player has been to once and I do not want the player to know that by hearing sounds.
I thought that was what the flag SILENT was for . Can you guide me how I may stop the teleport sound?
The Sound Of Silence
#3557 posted by Preach on 2005/04/23 11:11:14
Ok, the first function to look at is play_teleport, which selects a random teleport sound and plays it. However, we cannot change this function, because it is a think function for a temporary entity. This means we have no way to check whether it was spawned by a trigger_teleport that is silent or not. So, we need to look at the code that calls this bit.
The next function is spawn_tfog, which spawns a new entity s, who's only purpose is to play the sound in the right place in 0.2 seconds. Ideally we would have an if statement around that spawn function, but again we can't be sure what function has called spawn_tfog. If it was the trigger_teleport, then we'd know the trigger was the "self" entity. But another entity might call spawn_tfog, and so modifying this function might cause problems in other places.
So, we go back one more function, to teleport_touch. So, above this function add the line
float NONOISE = 4;
This is just defining a new constant for the flags on a teleporter; if you set flag 4 then the trigger_teleport, then anything teleported will be silent.
Then go down into the function, and find the lines
makevectors (t.mangle);
org = t.origin + 32 * v_forward;
spawn_tfog (org);
and replace it with
if(!(self.flags & NONOISE))
{
makevectors (t.mangle);
org = t.origin + 32 * v_forward;
spawn_tfog (org);}
Notice that this gets rid of spawn_tfog totally, so you get no flash as well as no sound. I assume that if the monsters are meant to teleport in without informing the player, no teleporter flash is needed.
If you did want silent teleports that included the flash, you'd need to add
else
{
makevectors (t.mangle);
org = t.origin + 32 * v_forward;
spawn_tfog_silent(org);
}
after the if statement, and make a copy of spawn_tfog called spawn_tfog_silent, which omitted the sound spawning lines.
As a side note for mappers, it turns out that play_teleport is a function like barrel_explode that can be called by the func_notnull trick. So if you want to spam false teleport sounds at the player, you now have the power! Well, I'll confess I've not actually tried it in a map, but it looks like it should work.
|