Raised This Month: $ Target: $400
 0% 

[TF2] Setting the active team_control_point_round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 08-11-2016 , 17:38   [TF2] Setting the active team_control_point_round
Reply With Quote #1

I pretty much tried a lot of hack jobs involving messing with the memory table and using tons of gamedata to call a bunch of functions, and none of them managed to succeed. I want to be able to select which team_control_point_round is active on the current map. I have ABSOLUTELY NO IDEA when or how the game decides this.

Relevant sources of information:

CTeamControlPointMaster::SelectSpecificRound
CTeamControlPointMaster::GetControlPointRound ToPlay

I would like a clean way to jump a map to a specific round without having to force all the control points on the prior rounds to a specific team (which causes the whole victory/failure humiliation moment and all that stuff that I don't want).

My guess is CTFGameRules::m_iszRoundToPlayNext stores the string of the team_control_point_round entity name to play next, and then after some event (?) occurs, the game will set that round active next. However, (1) I have no idea how to forcefully set that string (which I think is located at gamerules + 640), and (2) even if I could set that string, I have no idea what function to call to respawn all players and entities on the right round.

Forcefully resetting the map jumps the players back to stage 1. To jump forward to the desired round, the control points on the prior stages need to be marked as owned by a team. For example, to jump to dustbowl stage 3, all cps on stage 1 & 2 must be set to be owned by BLU. This causes the whole "you failed" humiliation phase to be played, which I want to avoid.

I managed to get the players to go to a specific stage on the map, but it messed up the master control point entity and the whole cp logic was outright broken.

Any suggestions or pointers on what I should do would be great. Thanks!

EDIT: I have some feeling that C++ detours may be needed for this, but ideally I do not want to go that route since this is the last piece to the puzzle and I haven't used any detours.

Last edited by Potato Uno; 08-11-2016 at 17:42.
Potato Uno is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 08-12-2016 , 05:59   Re: [TF2] Setting the active team_control_point_round
Reply With Quote #2

The current problem, with this, is the control points, also the team_train_watchers on payload maps.
Because the last path_track disable and enable some entities for the next round. So it's impossible to jump directly to the last stage, without triggering what the last path_track has to trigger.
My guess would be, to force the last path_track to fire the OnPass output, either by teleporting to cart on, and making it recede then move forward, or using some black magic to force the path_track to fire OnPass,
https://forums.alliedmods.net/showthread.php?t=285977 only an update to the sm core would help us on this part.
And after triggering the path_track, we move to the next stage (I don't want a winning team phase to force the next stage).

The bad points are:
-Players will obliviously notice it.
-It's slow


Edit: I probably found one solution, even if it's nasty.

CTeamplayRoundBasedRules::GetBonusRoundTime()

This fuction is virtual so we can probably use DHooks we already used it for something else.

I know the cvar mp_bonusroundtime can set the duration, but it has a min of 5sec.
So we can probably change the return to 0, and use the winning phase to jump to the next stage, until the desired one.
__________________

Last edited by Benoist3012; 08-12-2016 at 06:11.
Benoist3012 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-12-2016 , 06:01   Re: [TF2] Setting the active team_control_point_round
Reply With Quote #3

I can kind of tell you the how it decides.

The game always chooses one of the eligible rounds with the highest priority value (m_nPriority datamap).

If you have multiple eligible rounds, the game chooses one of them at random. On non-TC maps, there's usually only one choice.

Note: A full reset makes the game forget which rounds are eligible and always play the round with the highest priority. This is usually done using a game_round_win entity with its Full Map Reset property set to true.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 08-12-2016 , 06:24   Re: [TF2] Setting the active team_control_point_round
Reply With Quote #4

Quote:
Originally Posted by Powerlord View Post
I can kind of tell you the how it decides.

The game always chooses one of the eligible rounds with the highest priority value (m_nPriority datamap).
We already tried the priority trick, but we are sent back to the 1st stage, once the round ends :\

I'm going to try my trick with CTeamplayRoundBasedRules::GetBonusRoundTime() if I get something nice I will share the soluce, and release a plugin for server operator, to select their stage.
__________________

Last edited by Benoist3012; 08-12-2016 at 06:26.
Benoist3012 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-12-2016 , 06:50   Re: [TF2] Setting the active team_control_point_round
Reply With Quote #5

Quote:
Originally Posted by Benoist3012 View Post
We already tried the priority trick, but we are sent back to the 1st stage, once the round ends :\

I'm going to try my trick with CTeamplayRoundBasedRules::GetBonusRoundTime() if I get something nice I will share the soluce, and release a plugin for server operator, to select their stage.
Even if it did work, you're still going to run into one major problem:

TF2 has too much of the map logic tied into entities and their inputs/outputs.

Since we're on the subject of changing the round order around, most A/D CP maps have their final trigger_capture_area's OnCapTeam2 ouput tied into the BLU team game_round_win's RoundWin input. Said entity does a full map reset.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 08-12-2016 , 06:55   Re: [TF2] Setting the active team_control_point_round
Reply With Quote #6

Well I thought this, if the player is a stage 3 but wants the stage 2, the plugin will keep moving to next stage until one of them trigger a map reset, and then move to the desired stage.
I don't want to support TC though, no one plays TC anyway.
__________________

Last edited by Benoist3012; 08-12-2016 at 06:56.
Benoist3012 is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 08-12-2016 , 07:43   Re: [TF2] Setting the active team_control_point_round
Reply With Quote #7

Ok for now it works fine, sadly if I'm on stage 1 and I want to go on stage 3.
The game will instantly change to stage 2, and will take 3sec to move on stage 3.
I think the issue is from a cooldown, similar to how you can't spam mp_restartgame 1 to restart a single-stage map, you will still have a delay of 3sec, I just have to find where the cooldown is set, and change its value.

Edit: Solved, the problem is from the cvar mp_enableroundwaittime its default value is 1, it adds a cooldown of 5 seconds, setting it on 0 solve the problem, now my plugin moves to the desired stage instantly.
__________________

Last edited by Benoist3012; 08-12-2016 at 07:58.
Benoist3012 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:06.


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