Raised This Month: $32 Target: $400
 8% 

[Nuclear Dawn] Swap Teams at Round End


Post New Thread Reply   
 
Thread Tools Display Modes
Author
senseit
Member
Join Date: Aug 2009
Plugin ID:
2526
Plugin Version:
1.03
Plugin Category:
Gameplay
Plugin Game:
Nuclear Dawn
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Completely swaps teams after the end of a round.
    Unapprover:
    Reason for Unapproving:
    No longer necessary, built in.
    Old 08-30-2011 , 00:41   [Nuclear Dawn] Swap Teams at Round End
    Reply With Quote #1

    The 2 nuclear dawn maps released with the beta were both kind of one sided. Due to benefits/downside of each class. Using a swap team plugin the players might be able to recover their honor after the slaughter they just experienced.

    As an example empire is better on downtown as only a few relay towers are needed for those long stretches to get to forward points. On the flip side due to consortium's non-LOS nature of their power propagation they only need 2 relay towers to get to mid on metro.

    This will work on any game that uses round_win as the event name and uses team id # 2 and 3 as the 2 team IDs. However, I may add subclass memory (where it will automatically assign the subclass to the last subclass the user was using). When that happens the plugin will only work for nuclear dawn.

    As of posting this there is a bug with nuclear dawn where the round_win event only fires after the first round end and not on any successive round ends. So your server should be set to max rounds of 2 (default).

    Installation:
    Drop the plugin file into your sourcemod's plugin directory and change the map.

    Update: cleaned up some of the code

    Update: Fixed a possible bug

    Update: Fixed a bug that happens in conjunction with [Nuclear Dawn] Team Balancer plugin.
    Attached Files
    File Type: sp Get Plugin or Get Source (nd-round-teamswap.sp - 754 views - 957 Bytes)

    Last edited by psychonic; 12-17-2011 at 11:01. Reason: set Game to Nuclear Dawn
    senseit is offline
    tcviper
    Veteran Member
    Join Date: Oct 2005
    Location: Netherlands
    Old 12-17-2011 , 07:59   Re: [Nuclear Dawn] Swap Teams at Round End
    Reply With Quote #2

    I think this needs an update:

    L 12/16/2011 - 00:47:15: [SM] Native "SetConVarInt" reported: Invalid convar handle 0 (error 4)
    L 12/16/2011 - 00:47:15: [SM] Displaying call stack trace for plugin "nd-round-teamswap.smx":
    L 12/16/2011 - 00:47:15: [SM] [0] Line 23, /home/groups/alliedmodders/forums/files/5/8/2/6/8/91704.attach::event_RoundEnd()
    __________________
    tcviper is offline
    Send a message via MSN to tcviper
    Calystos
    Member
    Join Date: Jan 2011
    Location: Terra
    Old 12-29-2011 , 19:05   Re: [Nuclear Dawn] Swap Teams at Round End
    Reply With Quote #3

    Simple enough fix, just had to add some if statements to check if the variable exists or not. (Same fix can be applied to nd-warmup-round too)

    I've attached the same file from above just with the two if lines added to error check for that variable. Probably a better way to do it but its after midnight an am exhausted, so its a quick an dirty fix, lol, ;)

    EG:
    Code:
    if (FindConVar("sm_nd_balancer_enable")) { SetConVarInt(FindConVar("sm_nd_balancer_enable"), 0, false, false); }
    An at the end:
    Code:
    if (FindConVar("sm_nd_balancer_enable")) { SetConVarInt(FindConVar("sm_nd_balancer_enable"), 1, false, false); }
    Have just changed a few other bits, not sure if its better or not but seems to work quite well on my server now,

    Code:
    	for(new i=1; i <= MaxClients; i++) {
    		if(IsClientInGame(i) && !IsFakeClient(i)) {
    			new team = GetClientTeam(i);
    			if (team == 2) {
    				ChangeClientTeam(i, 3);
    			}
    			if (team == 3) {
    				ChangeClientTeam(i, 2);
    			}
    		}
    	}
    Changed to:
    Code:
    	// Swap the teams
    	for (new i=1; i <= MaxClients; i++) {
    		if (IsClientInGame(i) && !IsFakeClient(i)) switch (GetClientTeam(i))
    		{
    			case TEAM1: ChangeClientTeam(i, TEAM2);
    			case TEAM2: ChangeClientTeam(i, TEAM1);
    		}
    	}
    Got that code from advcommands.sp (also two defines at the top for TEAM1/TEAM2 of course) but added the fakeclient bit from this addon. Seems to work okay.

    Also added a little alert to let players know its happening.
    Code:
    PrintToChatAll("\x01\x04[SM]\x01 Round Ended: Swapping Teams");
    Attached Files
    File Type: sp Get Plugin or Get Source (nd-round-teamswap.sp - 547 views - 1.4 KB)

    Last edited by Calystos; 12-29-2011 at 20:09.
    Calystos is offline
    Send a message via ICQ to Calystos Send a message via AIM to Calystos Send a message via MSN to Calystos Send a message via Yahoo to Calystos Send a message via Skype™ to Calystos
    Ultrix Prime
    Junior Member
    Join Date: Apr 2011
    Old 01-06-2012 , 23:13   Re: [Nuclear Dawn] Swap Teams at Round End
    Reply With Quote #4

    Good plugin - running it on 4 servers.

    One small issue - when the players get swapped after the end of the first map round, everyone gets a death and another at the next end of map when the map is actually going to change and no swap is necessary.

    I've used a different sourcemod plugin in the past for switching players (teamswitch I think it's called) and it didn't kill them to do it (use mani for that now on CSS, but a manual teamswitch plugin for ND would be good along with a teambalance based upon rank).

    For servers that keep ranks through Gameme, etc, the extra deaths are relevant and even without additional stats, some players find the unearned death annoying.

    All in all, I'm very satisfied with the plugin as are most players that come to our servers and would like to thank you for having contributed it.


    thank you again,


    Ultrix
    Ultrix Prime is offline
    Calystos
    Member
    Join Date: Jan 2011
    Location: Terra
    Old 02-16-2012 , 01:40   Re: [Nuclear Dawn] Swap Teams at Round End
    Reply With Quote #5

    Ultrix, try this version.

    Not sure if it'll tell the stats systems to update right or not, but it does update the TAB->Scores info anyways so should update things like gameme & hlstatsx:ce I think.

    EDIT: Oopsy, forgot something. Fixed & working version upped.
    Also added "sm_swapteams" command, so you may now manually swap (handy for testing an stuff).

    EDIT: Changed a few things, updated force anytime swap system to also backup & restore not only deaths but also kills/frags & who was a Commander (if anyone was). NOTE: This includes some functionality from ND Commander Management plugin.

    Okay, here's my alternate version of the plugin. (hope its okay posting this, if not lemme know an will remove it or start new thread or something) I've added a load of things to this one including force swapping which not only remembers commanders, but also soon will do squads too. I've also added a nucleardawn.inc include file which can be used by other plugins to gain access to various functions that myself and others have come up with (such as the commander stuff aforementioned here) and will get more stuff added as an when more is uncovered,

    This build adds a console command. "sm_swapteams" can be ran by an admin (plus you can add it to the adminmenu_custom.txt file if wished) which will force-swap all players immediately (normally waits til a round end). The difference between a normal swap and a force swap is that a force swap will remember who was commander, and put them back to commander as well as other things.

    Got a few more things going to be added to this but figured release for everyone to enjoy,
    Attached Files
    File Type: smx nd_swapteams.smx (5.6 KB, 172 views)
    File Type: inc nucleardawn.inc (12.3 KB, 178 views)
    File Type: sp Get Plugin or Get Source (nd_swapteams.sp - 185 views - 6.8 KB)

    Last edited by Calystos; 02-26-2012 at 23:10.
    Calystos is offline
    Send a message via ICQ to Calystos Send a message via AIM to Calystos Send a message via MSN to Calystos Send a message via Yahoo to Calystos Send a message via Skype™ to Calystos
    Reply


    Thread Tools
    Display Modes

    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 06:51.


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