Skip to content

[TF2] The responses "CartMovingForwardDefense..." don't play #4912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Ashetf2 opened this issue Apr 21, 2023 · 2 comments · May be fixed by ValveSoftware/source-sdk-2013#1168
Open

[TF2] The responses "CartMovingForwardDefense..." don't play #4912

Ashetf2 opened this issue Apr 21, 2023 · 2 comments · May be fixed by ValveSoftware/source-sdk-2013#1168

Comments

@Ashetf2
Copy link

Ashetf2 commented Apr 21, 2023

This is the response and rule from demoman.txt in scripts/talker

Response CartMovingForwardDefenseDemoman                                                       
{
	scene "scenes/Player/Demoman/low/7716.vcd"
	scene "scenes/Player/Demoman/low/7717.vcd"
}
Rule CartMovingForwardDefenseDemoman                                                       
{
	criteria ConceptCartMovingForward IsOnDefense IsDemoman DemomanNotSaidCartMovingForwardD IsNotDisguised 75PercentChance                                                                                                                                                            
	ApplyContext "SaidCartMovingForwardD:1:20"
	Response CartMovingForwardDefenseDemoman                                                       
}

Nothing is mispelled, everything seems ok, however, these voicelines never play in the game. I don't think the VCD files are broken or missing because there is no error displayed in the console (like: Scene "....vcd" missing! / missing from scenes.image)

These are the criteria for the cart

Criterion "DemomanNotSaidCartMovingBackwardD" "SaidCartMovingBackwardD" "!=1" "required" weight 0
Criterion "DemomanNotSaidCartMovingBackwardO" "SaidCartMovingBackwardO" "!=1" "required" weight 0
Criterion "DemomanNotSaidCartMovingForwardD" "SaidCartMovingForwardD" "!=1" "required" weight 0
Criterion "DemomanNotSaidCartMovingForwardO" "SaidCartMovingForwardO" "!=1" "required" weight 0
Criterion "DemomanNotSaidCartMovingStoppedD" "SaidCartMovingStoppedD" "!=1" "required" weight 0
Criterion "DemomanNotSaidCartMovingStoppedO" "SaidCartMovingStoppedO" "!=1" "required" weight 0

and these are from response_rule.txt

criterion "ConceptCartMovingForward" "Concept" "TLK_CART_MOVING_FORWARD" required          
criterion "ConceptCartMovingStopped" "Concept" "TLK_CART_STOP" required          
criterion "ConceptCartMovingBackward" "Concept" "TLK_CART_MOVING_BACKWARD" required    

Again, nothing wrong. The criteria works for the other responses (cart not moving, cart moving forward offense, etc.), so, I don't understand why these specific responses don't play.

@Ashetf2
Copy link
Author

Ashetf2 commented Aug 1, 2023

So, for reference, the name of the criteria is misleading. It actually plays when the player (defending) is standing near the payload and an enemy (attacking) touches the payload. The cart doesn't move because it's being defended (it actually does: #3578), so idk why its name is "CartMovingForwardDefense"

@Ashetf2
Copy link
Author

Ashetf2 commented Aug 5, 2023

This is the code in team_train_watcher.cpp that controls when the concept should play CartMovingForwardDefense when the payload is moving forward

			if ( TeamplayRoundBasedRules() )
			{
				if ( m_iTrainSpeedLevel == 0 && iOldTrainSpeedLevel != 0 )
				{
					TeamplayRoundBasedRules()->HaveAllPlayersSpeakConceptIfAllowed( MP_CONCEPT_CART_STOP );
					m_flNextSpeakForwardConceptTime = 0;
				}
				else if ( m_iTrainSpeedLevel < 0 && iOldTrainSpeedLevel == 0 )
				{
					TeamplayRoundBasedRules()->HaveAllPlayersSpeakConceptIfAllowed( MP_CONCEPT_CART_MOVING_BACKWARD );
					m_flNextSpeakForwardConceptTime = 0;
				}
			}
		}

		if ( m_iTrainSpeedLevel > 0 && m_flNextSpeakForwardConceptTime < gpGlobals->curtime )
		{
			if ( m_hAreaCap.Get() )
			{
				for ( int i = 1; i <= gpGlobals->maxClients; i++ )
				{
					CBaseMultiplayerPlayer *pPlayer = ToBaseMultiplayerPlayer( UTIL_PlayerByIndex( i ) );
					if ( pPlayer )
					{
						if ( m_hAreaCap->IsTouching( pPlayer ) )
						{
							pPlayer->SpeakConceptIfAllowed( MP_CONCEPT_CART_MOVING_FORWARD );
						}
					}
				}
			}

			m_flNextSpeakForwardConceptTime = gpGlobals->curtime + 3.0;
		}

As you can see, the code checks that the player is touching the payload (m_hAreaCap->IsTouching( pPlayer )). This is completely fine for BLU, but it doesn't have any sense for RED, since when a RED player touches the payload, it shouldn't be supposed to move, but since it's bugged: #3578, it plays.

I think it should be like this for RED.

			if ( TeamplayRoundBasedRules() )
			{
				if ( m_iTrainSpeedLevel == 0 && iOldTrainSpeedLevel != 0 )
				{
					TeamplayRoundBasedRules()->HaveAllPlayersSpeakConceptIfAllowed( MP_CONCEPT_CART_STOP );
					m_flNextSpeakForwardConceptTime = 0;
				}
				else if ( m_iTrainSpeedLevel < 0 && iOldTrainSpeedLevel == 0 )
				{
					TeamplayRoundBasedRules()->HaveAllPlayersSpeakConceptIfAllowed( MP_CONCEPT_CART_MOVING_BACKWARD );
					m_flNextSpeakForwardConceptTime = 0;
				}
				else if ( m_iTrainSpeedLevel > 0 && iOldTrainSpeedLevel == 0 )
				{
					TeamplayRoundBasedRules()->HaveAllPlayersSpeakConceptIfAllowed( MP_CONCEPT_CART_MOVING_FORWARD_DEFENSE );
					m_flNextSpeakForwardConceptTime = 0;
				}
			}

It should also be necessary to add a check if the player is on defense, however, this can be added also in the response rules with the criterion IsOnDefense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants