Anubhav Posted March 23, 2014 Share Posted March 23, 2014 Is it a way to start random map? Something with my own script? Link to comment
HerculePoirot Posted March 23, 2014 Share Posted March 23, 2014 I think u should use tables and then extract a random entry from it using math.random and use the map assigned to that entry. Link to comment
Anubhav Posted March 23, 2014 Author Share Posted March 23, 2014 I know but how should i do that? Link to comment
cheez3d Posted March 23, 2014 Share Posted March 23, 2014 local maps = {} for k,resource in ipairs (getResources()) do if getResourceInfo(resource,"type") == "map" then table.insert(maps,k,resource) end end startResource(maps[math.random(1,#maps)]) Link to comment
Anubhav Posted March 23, 2014 Author Share Posted March 23, 2014 =__=. Will get the maps from each resource? I need it only for one resource name : tdmMaps Link to comment
Anubhav Posted March 23, 2014 Author Share Posted March 23, 2014 Lock the topic please . Did it myself! Link to comment
Moderators IIYAMA Posted March 23, 2014 Moderators Share Posted March 23, 2014 Before you let somebody lock it, you also can use mapmanager. function setNextRound () local mapmanager = getResourceFromName ( "mapmanager" ) if mapmanager then local maps = call (mapmanager,"getMapsCompatibleWithGamemode",thisResource) if maps then call (mapmanager,"changeGamemodeMap",maps[math.random(#maps)]) end end end Link to comment
Recommended Posts