View previous topic :: View next topic |
Author |
Message |
Junrall

Joined: 21 Sep 2009 Posts: 136 Location: North West Oregon, USA
|
Posted: Wed Apr 21, 2010 1:48 am Post subject: SUB_UseTargets |
|
|
Hello every one!
I'm not understanding what the function SUB_UseTargets is being used for.
Can someone explain this function to me? Particularly it's usage in the weapon_touch function?
Thanks for any wisdom thrown my way! _________________ Good God! You shot my leg off! |
|
Back to top |
|
 |
qbism

Joined: 04 Nov 2004 Posts: 82
|
Posted: Wed Apr 21, 2010 3:02 am Post subject: |
|
|
An item may have a self.target or self.killtarget activated by touch. Example in E3M6, touching the item_sigil opens a door.
Someone else may know where or if weapon_touch is used anywhere in the ID maps. _________________ http://qbism.com |
|
Back to top |
|
 |
r00k
Joined: 13 Nov 2004 Posts: 483
|
Posted: Wed Apr 21, 2010 3:25 am Post subject: |
|
|
Also, an item can have it's .message field applied and a CENTERPRINT message will be displayed.
Code: |
if (((activator.classname == "player") && (self.message != "")))
{
centerprint (activator, self.message);
if (!self.noise)
{
sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
}
}
|
|
|
Back to top |
|
 |
Junrall

Joined: 21 Sep 2009 Posts: 136 Location: North West Oregon, USA
|
Posted: Thu Apr 22, 2010 1:14 am Post subject: |
|
|
Oh, ok... now I get it.
Well, whether any of the ID maps uses this for weapons or not, I can see this being useful in similar situations as item_sigil is used... or maybe for traps and what not. Another idea would be to let the player know they just upgraded a weapon to the next level? _________________ Good God! You shot my leg off! |
|
Back to top |
|
 |
Wazat
Joined: 15 Oct 2004 Posts: 732 Location: Middle 'o the desert, USA
|
Posted: Sun Apr 25, 2010 7:31 pm Post subject: |
|
|
The target system in quake is basically a way to activate other objects in the level. As said above, target pairs with a targetname to tell objects "you have something to do with each other".
Some examples:
*Doors open/close when activated by a button or trigger
*Monsters get angry at the player when he touches a trigger that targets them
*Chthon comes out of the lava when triggered by grabbing the rune.
*Monsters activate their targets when they die. So, you could trigger a door to open when the ogre is killed.
*"func_train"s do not trigger their targets; instead they use target to point to their waypoint. Likewise, each waypoint uses target to point to the next waypoint. However, trains can be activated by something targeting them to tell them to start moving.
*Counters count up each time they are activated by something that targets them. When they hit their limit, they activate their own target. This is best seen in the first level in the game (e1m1, not start). You have to push all the buttons to get the door at the bottom to open.
Likewise you could force the player to kill X number of monsters, which activates a func_door to move up in a "teleport room". This pushes the monsters on top of the door into a teleporter, causing them to teleport into the room with the player.
SUB_UseTargets is the function responsible for activating these target relationships. It's an important function.  _________________ When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work. |
|
Back to top |
|
 |
Wazat
Joined: 15 Oct 2004 Posts: 732 Location: Middle 'o the desert, USA
|
Posted: Sun Apr 25, 2010 7:39 pm Post subject: |
|
|
Junrall wrote: | Oh, ok... now I get it.
Well, whether any of the ID maps uses this for weapons or not, I can see this being useful in similar situations as item_sigil is used... or maybe for traps and what not. Another idea would be to let the player know they just upgraded a weapon to the next level? |
Typically, you would want to modify the QC to tell the player if he's upgraded a weapon. i.e. when he goes from level 2 to level 3, you can tell him that with a simple centerprint in the upgrade code.
Health, ammo, weapons, armor, keys, powerups, and other pickupables should be able to activate a target when grabbed, if a target is specified. So you could, for example, teleport monsters into the room when the player wants to heal, so he has to decide if it's worth the trade-off. For example, he can see health boxes and ammo inside an unholy shrine, and if he defiles it and enters to get them, then either the ammo/health touch function or a trigger encompassing the shrine can spawn monsters in.
Or activate another deadly trap.
Often when you want something to happen when a player goes near something, you'll do it by a trigger surrounding the object/area instead of pickupables. The difference is that Quake doesn't pick up items for the player when he's full. If he has 100 shells and 100 health, he won't pick up the shells or health box, but he would still activate a trigger surrounding them. That's important to know when you want to distinguish between them (for example, don't punish the player if he doesn't actually pick up the shells). _________________ When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2004 phpBB Group
|