moving a platform based on a capture point

Mâché

Big Ferret
aa
Sep 7, 2015
396
319
Currently working on an A/D stage where one of the points features a dynamic platform (the point is not on the platform itself though). Right now it's just a move_linear, but maybe it'll need to be upgraded to a tracktrain, we'll see. Either way, the way I need it to work is as follows:
  • If only BLU is on the point, the crane moves forward from its starting point.
  • If both teams are on the point (aka, RED is blocking the cap), the crane stops in place.
  • If BLU isn't on the point at all, the crane moves back to its starting point.
  • Once the point is capped, the crane moves to its end point on its own and stays there permanently.
The way I had it set up was having triggers filtered for each team overlapping with the capture zone trigger, the blue one tied to whether the platform moves forward or backward and the red one changing its speed to 0, with the red trigger only needing to be active if the blue trigger is being touched. I imagine for some folks vscript could just do the job somehow, but I haven't ever touched vscript.

What would be the simplest logic/vscript setup to make this work? Thanks.
 

Box Of Paper

L3: Member
Jul 15, 2019
127
158
No need for VScript on this one: a OnNumCappersChanged2 SetValueCompare does the trick.

You need a
  • trigger_capture_area with
    • Can RED Cap? = No
    • OnNumCappersChanged2 compare_cappers_amt SetValueCompare
    • OnCapTeam2 compare_cappers_amt SetCompareValue -999
  • logic_compare with
    • Name = compare_cappers_amt
    • Compare value = 0 (the default)
    • OnEqualTo moving_block SetSpeedDir -1
    • OnGreaterThan moving_block SetSpeedDir 1
    • OnLessThan moving_block SetSpeedDir 0
  • func_tracktrain with
    • Name = moving_block
    • Initial Speed = 0
    • Max Speed = ??? (your choice)
  • Everything else to make the capture point work... The usual stuff.
The OnCapTeam2 is triggered before OnNumCappersChanged2 so there shouldn't be issues with the order or the moving_block going the wrong direction.

I've attached a demo .vmf. Shoot the orange blocks to spawn a corresponding team's engineer to simulate someone capping or blocking the cap.

1732224646613.png
 

Attachments

  • mache_crane.vmf
    42.9 KB · Views: 16
Last edited:

Mâché

Big Ferret
aa
Sep 7, 2015
396
319
excellent! admittedly i ended up just recreating the logic based on the bulleted list and what i needed, but this is a good general resource