Random Start Position? /Zufällige Start Position?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Random Start Position? /Zufällige Start Position?

      Hi all, im trying to find out how in can randomize the start position of registering players?
      Sorry for typos, this keyboard is on its way out.

      edit: version 2moons 2.0


      Hi, Ich versuche die Start Position von neuen Spieler zufällig zu machen, wo finde ich diese Einstellung?
      Bitte entschuldigt meine Schreibfehler, meine Tastatur streikt.

      edit: Version 2moons 2.0

      The post was edited 1 time, last by SkyCaptain ().

    • replace

      PHP Source Code: includes/classes/PlayerUtil.class.php

      1. do {
      2. $position = mt_rand(round($config->max_planets * 0.2), round($config->max_planets * 0.8));
      3. if ($planet < 3) {
      4. $planet += 1;
      5. } else {
      6. if ($system >= $config->max_system) {
      7. $system = 1;
      8. if($galaxy >= $config->max_galaxy) {
      9. $galaxy = 1;
      10. } else {
      11. $galaxy += 1;
      12. }
      13. } else {
      14. $system += 1;
      15. }
      16. }
      17. } while (self::isPositionFree($universe, $galaxy, $system, $position) === false);
      Display All


      with

      PHP Source Code: includes/classes/PlayerUtil.class.php

      1. do {
      2. $position = mt_rand(round($config->max_planets * 0.2), round($config->max_planets * 0.8));
      3. $planet = $position;
      4. $system = mt_rand(1,$config->max_system);
      5. $galaxy = mt_rand(1,$config->max_galaxy);
      6. } while (self::isPositionFree($universe, $galaxy, $system, $position) === false);


      ps: and line 101 - 103 into

      PHP Source Code: includes/classes/PlayerUtil.class.php

      1. $galaxy = mt_rand(1,$config->max_galaxy);
      2. $system = mt_rand(1,$config->max_system);
      3. $planet = mt_rand(1,$config->max_planets);
    • after thinking about it one more time, i think
      change line 101 - 103 into

      PHP Source Code: includes/classes/PlayerUtil.class.php

      1. $galaxy = mt_rand(1,$config->max_galaxy);
      2. $system = mt_rand(1,$config->max_system);
      3. $planet = mt_rand(1,$config->max_planets);
      is all you need.