Setting control point owner immediately

Skylark

Super Gay Developer
aa
Aug 9, 2018
163
373
I am working on a gamemode which requires that points start off as set to neither team and then 2 are assigned to each team. These points need to be contiguous so using the random setting on the point will not work, I also need to set up other things so I need to do it manually.

The issue is, setting a control point owner immediately does not seem to work. Setting control point owner during waiting for players doesn't work, then once the round starts it seems to need a second.

The owners of the points are known during the waiting for players and at the end of the previous round, so I figured that I could set the default owner ahead of time but this change is reset on the new round.

So the current plan is that I would have 2.5 seconds setup time. Make everyone spawn in their own temporary spawn room (maybe also blind everyone, I have another idea to mask a teleport). Then on finish points and spawns are set up and everyone is teleported. However this is a bit clunky and it's more work to set this up, and it's weird going from end of a round to 2.5s in limbo then spawn just because the points couldn't have owner set.

Just tested a method that has 4 team control point rounds and it seems to be the best but just requires a lot of AddOutputs.


Is there a better way of setting control points, ideally before players spawn? Or immediately, fast enough that players don't really notice/not distracting
 
Last edited:

Da Spud Lord

Occasionally I make maps
aa
Mar 23, 2017
1,339
994
Maybe place 2 red and 2 blu points outside the map, and randomly teleport them into place on a new round?
 

Box Of Paper

L3: Member
Jul 15, 2019
111
143
The owners of the points are known during the waiting for players and at the end of the previous round, so I figured that I could set the default owner ahead of time but this change is reset on the new round.

If you need stuff to be remembered between rounds you can use these
https://developer.valvesoftware.com/wiki/S_PreserveEnts

I've attached a .vmf that uses these classnames to set the control points' owner back to the one from the previous round.
 

Attachments

  • preserved_entities.vmf
    43.1 KB · Views: 64

Skylark

Super Gay Developer
aa
Aug 9, 2018
163
373
If you need stuff to be remembered between rounds you can use these
https://developer.valvesoftware.com/wiki/S_PreserveEnts

I've attached a .vmf that uses these classnames to set the control points' owner back to the one from the previous round.

That is really neat behavior that could be used somewhere, the issue is that I have tried it with both spawns and control points and they bug out and I'm not sure if it would mess things up for people who join the map after it is started.

What I meant by the text that was quoted was more about setting up spawns and setting the default owner ahead of time and those details are saved so on the next round the correct spawn is selected and the points use the default owner which has changed. The point almost works, I set it so on capture it sets the default owner and the classname is changed to env_sprite, on the next round the env_sprite point shows as the team previously but not on the HUD and the point still exists.
hl2_2021-12-23_20-43-47.png
(the 2 points show upon starting the map and having the classname set to env_sprite)

Is there anything that can be done about this aspect?
 

Box Of Paper

L3: Member
Jul 15, 2019
111
143
Making the team_control_point preserved is not a good idea, the game likes to crash when two points have the same index, even if one is killed off.

I think it's inevitable that the point duplicates so I wouldn't act on that...

If you need the respawn points to be set before the round starts, then how about preserving a "trigger_teleport"?

Basically make the players always spawn in a box where they immediately touch a preserved "trigger_teleport" and are teleported (with a relative offset) to a second box associated to a spawn room where they are then teleported again to the correct location (this time with an absolute offset that allows to set the angles).
Every time you want to update where the players spawn you'll simply update the "target" keyvalue of the preserved "trigger_teleport" through an AddOutput (I mean update it to one of the info_teleport_destination inside the boxes associated to the spawn rooms).

The teleport is so fast that you can't even see it for a frame!

This... doesn't fix the problem that the default owner isn't set, but the info is still in the logic_branch, and with this you can avoid associating the control points to the respawn point.

Hope I was clear enough, here's a .vmf with exactly this, in this one the respawn point is set to the last control point captured.
(Note that there are only 2 spawn points instead of 16).
 

Attachments

  • preserved_spawn.vmf
    197.1 KB · Views: 61
Last edited:

Skylark

Super Gay Developer
aa
Aug 9, 2018
163
373
how about preserving a "trigger_teleport".

Genius and slightly ashamed that I didn't think about this. Thank you.

I will just add into the plan that control points just have to be set 2.5s after starting. I guess it may be possible to have a fake HUD to display 1 of 4 configurations for those 2.5s. I tried adding 4 points that only exist to be shown in those first 2.5s before being replaced by the real points but double whammy of needing to use a comma in an add output and it doesn't even seem to work anyway.

Really appreciate your time and have learnt a lot. I might try and persue the 4 stages method, it just requires a bunch of workarounds (including spawning everyone in a teleport) and might do what I did with the campaign gamemode and make a program which generates all of those outputs to make everything work with a bunch of automatic things needing to be managed but every stage can share a state machine at least.