AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2] Assister Domination Quotes (1.3, 2013-08-02) (https://forums.alliedmods.net/showthread.php?t=215449)

Powerlord 05-07-2013 23:38

[TF2] Assister Domination Quotes (1.3, 2013-08-02)
 
4 Attachment(s)
Description
Are you tired of getting a domination on an assist and not hearing the sweet domination quotes? Or getting a revenge on an assist and not getting to tell off the person who had been dominating you? Well, no more!

See Also: Force Domination Quotes, Spy Fake Dominations

Feature List
  • If you get a domination on someone via an assist, you will now get to spout one of TF2's great domination one-liners.
  • If you get a revenge on someone via an assist, you will now get to spout an insulting retort to your former dominator.
CVAR/Command List
  • assisterdomination_version - Plugin version
  • assisterdomination_enabled - [0/1] - Set to 0 to disable
This is a really basic plugin and doesn't do anything else.

Changelog
  • 2013-08-02 (v1.3)
    • New cvar to disable.
    • Standardized code between this and Spy Fake Dominations
  • 2013-08-02 (v1.2)
    • Fixed a typo that was preventing this from ever working
    • Now checks if a kill was a silent kill and doesn't play the assist domination or revenge sound if it was.
  • 2013-05-11 (v1.1)
    • Fixed an issue where the wrong command was being called, which logged an error in the console
  • 2013-05-07 (v1.0)
    • Initial Release
Installation Instructions
Copy the plugin into your addons/sourcemod/plugins/ directory.

Dependencies
SourceMod 1.4 and its SDKTools extension

Plans
I've considered making a command to let admins force other players to play their domination/revenge lines, but decided not to do that. Perhaps another plugin could be written for that...

Powerlord 05-07-2013 23:39

Re: [TF2] Assister Domination Quotes (1.0, 2013-05-07)
 
Technical information on manipulating the TF2 Response System.

This plugin uses TF2's own Response system to work.

Inside tf2_misc_dir.vpk is the directory scripts/talker/ with has a number of .txt files.

These text files control the Valve response system.

To get characters to say their in-game lines, you can look up the response concept you want it to play and figure out what contexts have to be in place before it will work.

This plugin uses the SpeakResponseConcept input instead of DispatchResponse. This is because DispatchResponse does not appear to work correctly in TF2.

Here's an example of how to get a specific response working:

For this, I chose to play the Medic's Melee Dare. The first step is to open up scripts/talker/medic.txt and search for the word Dare. Ignore the first one you find, as it's the Duel version. Eventually, you'll find this:

Code:

Response MeleeDareCombatMedic
{
    scene "scenes/Player/Medic/low/661.vcd"
    scene "scenes/Player/Medic/low/669.vcd"
    scene "scenes/Player/Medic/low/672.vcd"
    scene "scenes/Player/Medic/low/667.vcd"
    scene "scenes/Player/Medic/low/677.vcd"
    scene "scenes/Player/Medic/low/680.vcd"
    scene "scenes/Player/Medic/low/1241.vcd"
    scene "scenes/Player/Medic/low/679.vcd"
}
Rule MeleeDareCombatMedic
{
    criteria ConceptPlayerBattleCry IsWeaponMelee IsMedic IsCrosshairEnemy
    Response MeleeDareCombatMedic
}

The Rule is the important one. See the "criteria" line there? Everything after criteria is a space separate list of contexts defined in response_rules.txt

So, open up scripts/talker/response_rules.txt and look for ConceptPlayerBattleCry
Code:

criterion "ConceptPlayerBattleCry" "Concept" "TLK_PLAYER_BATTLECRY" required
The second argument (Concept) is the rule type. Concepts are special and we'll be sending it to SpeakResponseConcept later. The third ("TLK_PLAYER_BATTLECRY") is its value. The last argument tells us this is required (but pretty much all criteria are).

Now, unfortunately IsMedic isn't really overridable, as the game resets it too quickly for us to override it.

UPDATE: The above may not be true. However, when you define two contexts of the same type, only the first one applies. However, you can remove a context like this:

Code:

SetVariantString("playerclass");
AcceptEntityInput(client, "RemoveContext");

You can remove all existing contexts like this:
Code:

AcceptEntityInput(client, "ClearContext");
END UPDATE
Lets take a look at it anyway. Here's the definitions for this context:
Code:

criterion "IsMedic" "playerclass" "Medic" "required"
This context isn't a Concept, meaning that it could (in theory) be set using AddContext. We'll talk more about AddContext in a moment.

Lets look at the last two contexts: IsWeaponMelee and IsCrosshairEnemy

Code:

criterion "IsWeaponMelee" "weaponmode" "melee" required
criterion "IsCrossHairEnemy" "crosshair_enemy" "Yes" "required"

Remember what I said about AddContext? This is where you want it. It takes a single string argument, which is in format key:value. You can set these contexts by doing this:

Code:

#include <sdktools>

...

SetVariantString("weaponmode:melee");
AcceptEntityInput(client, "AddContext");

SetVariantString("crosshair_enemy:Yes");
AcceptEntityInput(client, "AddContext");

Once you have the contexts set, it's time to call our Concept whose name we saw earlier... and remember to clear the contexts again afterwards.

Code:

SetVariantString("TLK_PLAYER_BATTLECRY");
AcceptEntityInput(client, "SpeakResponseConcept");
   
AcceptEntityInput(client, "ClearContext");

I haven't tested this code, so the melee weapon context may be reset too quickly for us to fake it using this method... YMMV.

Edit: My tf2-data respository contains the talker files, which did not change in the Gun Mettle Update.

FlaminSarge 05-09-2013 00:48

Re: [TF2] Assister Domination Quotes (1.0, 2013-05-07)
 
Good to see this ended up working.

Powerlord 05-10-2013 11:16

Re: [TF2] Assister Domination Quotes (1.0, 2013-05-07)
 
Quote:

Originally Posted by FlaminSarge (Post 1948529)
Good to see this ended up working.

It now has a sister plugin, Force Domination Quotes. I thought about making them the same plugin, but realized that some server admins will want this plugin and not the other.

It also occurred to me that I may be able to change which class's quotes are played if I removecontext on the one that sets the player class and then add a new one of my choice...

cool_myll 05-11-2013 08:02

Re: [TF2] Assister Domination Quotes (1.0, 2013-05-07)
 
Got a lot of error and uninstalled it. Will reinstall to report the exact errors.

EDIT:
Quote:

1/2013 - 15:04:09: [SM] Displaying call stack trace for plugin "assister-dominations.smx":
L 05/11/2013 - 15:04:09: [SM] [0] Line 46, /home/groups/alliedmodders/forums/files/3/8/9/9/6/119618.attach::Event_PlayerDeath()

Powerlord 05-11-2013 12:49

Re: [TF2] Assister Domination Quotes (1.0, 2013-05-07)
 
1 Attachment(s)
Quote:

Originally Posted by cool_myll (Post 1949843)
Got a lot of error and uninstalled it. Will reinstall to report the exact errors.

EDIT:

Oh wow, I really derped while creating this... I really wish GetClientUserId and GetClientOfUserId were named more differently.

Anyway, try this version.

Powerlord 08-01-2013 12:03

Re: [TF2] Assister Domination Quotes (1.1, 2013-05-11)
 
Hmm, this plugin may not be working at the moment. Either that or it got disabled on my primary server when I wasn't looking.

Thought it was weird when I got an assist domination last night and didn't hear my Medic say anything.

Powerlord 08-02-2013 12:01

Re: [TF2] Assister Domination Quotes (1.2, 2013-08-02)
 
OK, thanks to psychonic for pointing out a typo (deathflags should be death_flags). Now, hopefully this plugin will actually work.

Released version 1.2, changelog is in first post.

Powerlord 08-02-2013 20:15

Re: [TF2] Assister Domination Quotes (1.3, 2013-08-02)
 
Another release already... this time some code improvements, plus there's a new cvar that allows you to disable the plugin.

This version is also compatible with Spy Fake Domination Quotes v1.0.

Teamkiller324 02-24-2021 21:15

Re: [TF2] Assister Domination Quotes (1.3, 2013-08-02)
 
1 Attachment(s)
Updated to new syntax.


All times are GMT -4. The time now is 16:10.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.