Talk:Trigger

From Valve Developer Community
Jump to navigation Jump to search

One little question: What do the Flags refer to? The objects that cause the trigger to activate? - Chase

Yes...I'll add that here—ts2do 13:46, 14 Apr 2006 (PDT)

I know this is no forum, but for some reason these flags don`t seem to work. They never react on physics objects, just clients. There are no websites that deal with these topics, so it would be great if you could give me any hind. Chas0r 14:05, 14 Apr 2006 (PDT)

I checked the code and it should definitely work with ANY object marked with MOVETYPE_VPHYSICS movetype. If it doesn't work for sure, try trigger_vphysics_motionts2do 14:33, 14 Apr 2006 (PDT)
The trigger_vphysics_motion doesn't work either. I also checked the flags of my prop_physics object, and made sure Debris with trigger interaction is unchecked while Force server-side is checked. Can this be realated to the mod? I'm mapping for Hidden (HL2-based)- which gives exclusive pickup-rights to one player. Chas0r 23:37, 14 Apr 2006 (PDT)
You have to have Debris with trigger interaction if you want to have debris that affects triggers...otherwise make it nondebris—ts2do 23:38, 14 Apr 2006 (PDT)
Well, that doesn't work either. I just found the article Physics Entities on Server & Client. Maybe the mod totally disables collisions between physic objects and other entities to save performance..Chas0r 00:08, 15 Apr 2006 (PDT)

Well...that wouldn't make any sense...I think that mod is made in the Skeletal SDK tho...wonder if that has anything to do with it—ts2do 00:44, 15 Apr 2006 (PDT)

Ok, now it gets even more strange: The reaction of the trigger depends on its events -> the event OnStartTouch just reacts on players while the OnEndTouchAll event also regards the other entities, like prop_physic. Any explanation ? Chas0r 02:44, 15 Apr 2006 (PDT)

Finally here's the riddle's solution: I tested all the events just by using a game_text entity. For some reason this entity just displays its message if the event was caused by a player. Even if it's a chain of events (e.g. change a logic value, and react on this change afterwards) the message won't be displayed. I haven't ever coded for Source, not even taken a look at it - but i suppose that the Event Class (if there is one) has something like a priority. This is passed on when calling other events. Anyway, this may be a usuful addition for the game_text article, however it should be confirmied by someone more experienced. (I started mapping yesterday, thats all) Thanks for helping me ts2do ! Chas0r 02:58, 15 Apr 2006 (PDT)

Did you try checking game_text's flag?—ts2do 14:40, 15 Apr 2006 (PDT)

Here's how game_text works:

void CGameText::Display( CBaseEntity *pActivator )
{
	if ( !CanFireForActivator( pActivator ) )
		return;

	if ( MessageToAll() )
	{
		UTIL_HudMessageAll( m_textParms, MessageGet() );
	}
	else
	{
		// If we're in singleplayer, show the message to the player.
		if ( gpGlobals->maxClients == 1 )
		{
			CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
			UTIL_HudMessage( pPlayer, m_textParms, MessageGet() );
		}
		// Otherwise show the message to the player that triggered us.
		else if ( pActivator && pActivator->IsNetClient() )
		{
			UTIL_HudMessage( ToBasePlayer( pActivator ), m_textParms, MessageGet() );
		}
	}
}

You have to either have the flag checked or have the activator be the client—ts2do 14:52, 15 Apr 2006 (PDT)