SUB_UseTargets
Moderator: InsideQC Admins
6 posts
• Page 1 of 1
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!
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!
-

Junrall - Posts: 191
- Joined: Mon Sep 21, 2009 12:27 am
- Location: North West Oregon, USA
Also, an item can have it's .message field applied and a CENTERPRINT message will be displayed.
- Code: Select all
if (((activator.classname == "player") && (self.message != "")))
{
centerprint (activator, self.message);
if (!self.noise)
{
sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
}
}
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
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?
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!
-

Junrall - Posts: 191
- Joined: Mon Sep 21, 2009 12:27 am
- Location: North West Oregon, USA
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.
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.
- Wazat
- Posts: 771
- Joined: Fri Oct 15, 2004 9:50 pm
- Location: Middle 'o the desert, USA
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.
- Wazat
- Posts: 771
- Joined: Fri Oct 15, 2004 9:50 pm
- Location: Middle 'o the desert, USA
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest