• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Request] Map Rotation
#1
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...

  Reply
#2
CSHARP Code
  1. const int MAPS = 16;
  2. 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" };
  3. string[] mapuser = { "lockdown", "bootleg", "mission", "carbon", "dome", "downturn", "hardhat", "interchange", "fallen", "bakaara", "resistance", "arkaden", "outpost", "seatown", "underground", "village" };
  4. int[] mapweight = { 3, 2, 5, 3, 5, 2, 5, 3, 2, 5, 5, 3, 2, 3, 2, 5 };
  5. int[] maprange = new int[MAPS];
  6. int range;
  7. int nextmap = -1;
  8. Random rnd = new Random(unchecked((int)DateTime.Now.Ticks));
  9.  
  10. public override void OnServerLoad()
  11. {
  12. for (int i = 0; i < MAPS; i++)
  13. {
  14. range += mapweight[i];
  15. maprange[i] = range;
  16. }
  17. }
  18.  
  19. public override void OnMapChange()
  20. {
  21. int prevmap = nextmap;
  22. repeat:
  23. nextmap = FindMap(1 + rnd.Next(range));
  24. if (prevmap == nextmap) { goto repeat; }
  25. File.WriteAllText(@"admin/default.dspl", mapdev[nextmap] + ",FFA_All,1");
  26. }
  27.  
  28. int FindMap(int r)
  29. {
  30. for (int i = 0; i < MAPS; i++)
  31. if (r <= maprange[i])
  32. return i;
  33. return -1;
  34. }
  Reply
#3
(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.
[Image: azuw.jpg]
  Reply
#4
(02-04-2012, 17:11)Yurio Wrote:
CSHARP Code
  1. const int MAPS = 16;
  2. 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" };
  3. string[] mapuser = { "lockdown", "bootleg", "mission", "carbon", "dome", "downturn", "hardhat", "interchange", "fallen", "bakaara", "resistance", "arkaden", "outpost", "seatown", "underground", "village" };
  4. int[] mapweight = { 3, 2, 5, 3, 5, 2, 5, 3, 2, 5, 5, 3, 2, 3, 2, 5 };
  5. int[] maprange = new int[MAPS];
  6. int range;
  7. int nextmap = -1;
  8. Random rnd = new Random(unchecked((int)DateTime.Now.Ticks));
  9.  
  10. public override void OnServerLoad()
  11. {
  12. for (int i = 0; i < MAPS; i++)
  13. {
  14. range += mapweight[i];
  15. maprange[i] = range;
  16. }
  17. }
  18.  
  19. public override void OnMapChange()
  20. {
  21. int prevmap = nextmap;
  22. repeat:
  23. nextmap = FindMap(1 + rnd.Next(range));
  24. if (prevmap == nextmap) { goto repeat; }
  25. File.WriteAllText(@"admin/default.dspl", mapdev[nextmap] + ",FFA_All,1");
  26. }
  27.  
  28. int FindMap(int r)
  29. {
  30. for (int i = 0; i < MAPS; i++)
  31. if (r <= maprange[i])
  32. return i;
  33. return -1;
  34. }

So what do i do with this ?
  Reply
#5
lol, maybe compile it?
  Reply
#6
@Yurio if you don't pass a constructor parameter in the random class it will automatically take the current time as a seed.
[Image: MaEIQ.png]
  Reply
#7
@Pozzuh
OK. But if we want to create multiple instances with different number series? Wink
  Reply
#8
(02-04-2012, 22:20)Yurio Wrote: @Pozzuh
OK. But if we want to create multiple instances with different number series? Wink

Just keep using rnd.next() and it will be fine
[Image: MaEIQ.png]
  Reply
#9
Any development on this chapz Big Grin
  Reply
#10
and.. Yurio code work?
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  bypass map rotation limit kerm007 3 2,751 07-22-2012, 15:23
Last Post: surtek
  [Release] How to add new maps to rotation ;) hillbilly 7 5,918 06-22-2012, 15:24
Last Post: hillbilly
  Crash After First Map Rotation worldclass 6 3,644 06-08-2012, 21:50
Last Post: SuperNovaAO
  Crash After First Map Rotation worldclass 6 3,558 06-08-2012, 20:30
Last Post: SuperNovaAO
  map rotation blueberry9 3 1,852 04-11-2012, 00:40
Last Post: blueberry9
  Help Map rotation - maps are random only? choobie 4 2,535 03-16-2012, 02:06
Last Post: Predje
  mw3 map rotation configurator kerm007 2 2,179 03-01-2012, 02:53
Last Post: kerm007
  Rcon & map rotation xcondex 5 3,779 02-25-2012, 16:45
Last Post: xcondex

Forum Jump:


Users browsing this thread: 1 Guest(s)