function createnpc() { // Chance of creating NPC player if ($this->npc || rand(0, 100) < 25) { return; } $free = rand($this->round['min_planets'], $this->round['max_planets']); $starsystem_id = $this->availablestarsystem($free); if (empty($starsystem_id)) { return; } $npc = new Join($this->data, $this->smarty, array($free)); $npc->selectplanets(); }