Giving a speed penalty to the flag carrier

T

The Asylum

I remember way back in the early days it was possible to assign a speed penalty to a flag carrier. Is it possible now, and if so, does it involve Vscript?
 
Solution
D
Doesnt seem to be working, at least with what I've got
I am not sure as to why this wouldn't work as I've made a nearly identical set-up that does work without flaws.
background.png


Might be worth checking out the developer console for any errors.

EDIT: I found out why it doesn't work - you have a typo in the OnPickup1 output's parameter: you misspelled "penalty" as "pentalty".
D

Deleted member 33500

I don't think there is any in-game speed penalty for flag carriers besides the one inflicted while playing Mannpower.

To answer your second question, you can add your own movement speed penalty with VScript using the AddCustomAttribute and RemoveCustomAttribute methods to add and remove the move speed penalty attribute to the flag carrier whenever it is picked up and dropped (OnPickup1 and OnDrop1 outputs).
 

Tiftid

the Embodiment of Scarlet Devil
aa
Sep 10, 2016
613
476
You can also do it pretty simply with map logic:
  1. Create two trigger_add_or_remove_tf_player_attributes with your desired slowdown percentage (i.e. "move speed bonus 0.4"), one called logic_flagcarrier_nerfs_add and one called logic_flagcarrier_nerfs_remove, and hide them inside a clipbrush so the player can never touch them manually

  2. Cover all spawn points in a trigger_multiple with these outputs:

    OnStartTouch
    !activator
    AddOutput
    OnUser1 logic_flagcarrier_nerfs_add:StartTouch::0:-1:

    OnStartTouch
    !activator
    AddOutput
    OnUser2 logic_flagcarrier_nerfs_remove:StartTouch::0:-1:

  3. Add these outputs to your item_teamflag:

    OnPickup1
    !activator
    FireUser1

    OnCapture1
    !activator
    FireUser2

    OnDrop1
    !activator
    FireUser2
 
D

Deleted member 33500

Note you could also do VScript directly in map logic for convenience and cleanliness.

You could add these outputs to the flag entity to achieve the same results without having to set-up a trigger system:
Output: OnPickup1
Target: !activator
Input: RunScriptCode
Parameter: self.AddCustomAttribute(`move speed penalty`, [Move speed multiplier here], -1)

Output: OnCapture1
Target: !activator
Input: RunScriptCode
Parameter: self.RemoveCustomAttribute(`move speed penalty`)

Output: OnDrop1
Target: !activator
Input: RunScriptCode
Parameter: self.RemoveCustomAttribute(`move speed penalty`)

Note the backticks (`) are used instead of quotes since quotes would corrupt your map.
 
Last edited by a moderator:
T

The Asylum

Note you could also do VScript directly in map logic for convenience and cleanliness.

You could add these outputs to the flag entity to achieve the same results without having to set-up a trigger system:
Output: OnPickup1
Target: !activator
Input: RunScriptCode
Parameter: self.AddCustomAttribute(`move speed penalty`, [Move speed multiplier here], -1)

Output: OnCapture1
Target: !activator
Input: RunScriptCode
Parameter: self.RemoveCustomAttribute(`move speed penalty`)

Output: OnDrop1
Target: !activator
Input: RunScriptCode
Parameter: self.RemoveCustomAttribute(`move speed penalty`)

Note the backticks (`) are used instead of quotes since quotes would corrupt your map.
Doesnt seem to be working, at least with what I've got

speed penalties how do they work.png
 
D

Deleted member 33500

Doesnt seem to be working, at least with what I've got
I am not sure as to why this wouldn't work as I've made a nearly identical set-up that does work without flaws.
background.png


Might be worth checking out the developer console for any errors.

EDIT: I found out why it doesn't work - you have a typo in the OnPickup1 output's parameter: you misspelled "penalty" as "pentalty".
 
Solution