Posts: 34
Threads: 4
Joined: May 2011
Reputation:
0
Ello ...
Would it be possible to make a plugin that can set a certain map rotation perfectly with no random map changing at all ??
I have kinda got my rotation almost flawless BUT i do occasionally have the same map pop up every few maps..
Hope someone can make this as it drives me mad...
Posts: 124
Threads: 6
Joined: Dec 2011
Reputation:
14
CSHARP Code
const int MAPS = 16; string[] mapdev = { "mp_alpha", "mp_bootleg", "mp_bravo", "mp_carbon", "mp_dome", "mp_exchange", "mp_hardhat", "mp_interchange", "mp_lambeth", "mp_mogadishu", "mp_paris", "mp_plaza2", "mp_radar", "mp_seatown", "mp_underground", "mp_village" }; string[] mapuser = { "lockdown", "bootleg", "mission", "carbon", "dome", "downturn", "hardhat", "interchange", "fallen", "bakaara", "resistance", "arkaden", "outpost", "seatown", "underground", "village" }; int[] mapweight = { 3, 2, 5, 3, 5, 2, 5, 3, 2, 5, 5, 3, 2, 3, 2, 5 }; int[] maprange = new int[MAPS ]; int range; int nextmap = -1; Random rnd = new Random (unchecked((int)DateTime. Now. Ticks)); public override void OnServerLoad() { for (int i = 0; i < MAPS; i++) { range += mapweight[i]; maprange[i] = range; } } public override void OnMapChange() { int prevmap = nextmap; repeat: nextmap = FindMap(1 + rnd.Next(range)); if (prevmap == nextmap) { goto repeat; } File.WriteAllText(@"admin/default.dspl", mapdev[nextmap] + ",FFA_All,1"); } int FindMap(int r) { for (int i = 0; i < MAPS; i++) if (r <= maprange[i]) return i; return -1; }
Posts: 1,323
Threads: 24
Joined: Nov 2010
Reputation:
91
(02-04-2012, 15:50)fookaa Wrote: Ello ...
Would it be possible to make a plugin that can set a certain map rotation perfectly with no random map changing at all ??
I have kinda got my rotation almost flawless BUT i do occasionally have the same map pop up every few maps..
Hope someone can make this as it drives me mad...
Not sure if this is possible since game is always checking default.dspl after each map.
Posts: 34
Threads: 4
Joined: May 2011
Reputation:
0
(02-04-2012, 17:11)Yurio Wrote: CSHARP Code
const int MAPS = 16; string[] mapdev = { "mp_alpha", "mp_bootleg", "mp_bravo", "mp_carbon", "mp_dome", "mp_exchange", "mp_hardhat", "mp_interchange", "mp_lambeth", "mp_mogadishu", "mp_paris", "mp_plaza2", "mp_radar", "mp_seatown", "mp_underground", "mp_village" }; string[] mapuser = { "lockdown", "bootleg", "mission", "carbon", "dome", "downturn", "hardhat", "interchange", "fallen", "bakaara", "resistance", "arkaden", "outpost", "seatown", "underground", "village" }; int[] mapweight = { 3, 2, 5, 3, 5, 2, 5, 3, 2, 5, 5, 3, 2, 3, 2, 5 }; int[] maprange = new int[MAPS ]; int range; int nextmap = -1; Random rnd = new Random (unchecked((int)DateTime. Now. Ticks)); public override void OnServerLoad() { for (int i = 0; i < MAPS; i++) { range += mapweight[i]; maprange[i] = range; } } public override void OnMapChange() { int prevmap = nextmap; repeat: nextmap = FindMap(1 + rnd.Next(range)); if (prevmap == nextmap) { goto repeat; } File.WriteAllText(@"admin/default.dspl", mapdev[nextmap] + ",FFA_All,1"); } int FindMap(int r) { for (int i = 0; i < MAPS; i++) if (r <= maprange[i]) return i; return -1; }
So what do i do with this ?
Posts: 1,519
Threads: 107
Joined: Dec 2011
Reputation:
48
Posts: 5,135
Threads: 241
Joined: Nov 2010
Reputation:
100
@ Yurio if you don't pass a constructor parameter in the random class it will automatically take the current time as a seed.
Posts: 124
Threads: 6
Joined: Dec 2011
Reputation:
14
@ Pozzuh
OK. But if we want to create multiple instances with different number series?
Posts: 5,135
Threads: 241
Joined: Nov 2010
Reputation:
100
(02-04-2012, 22:20)Yurio Wrote: @Pozzuh
OK. But if we want to create multiple instances with different number series?
Just keep using rnd.next() and it will be fine
Posts: 34
Threads: 4
Joined: May 2011
Reputation:
0
Any development on this chapz
Posts: 76
Threads: 12
Joined: Feb 2012
Reputation:
0
|