Grapjas 61 Posted January 29 Report Share Posted January 29 (edited) *Up to date and working with A24* ** Mod is also available ingame at settings > mod selection > download mods ** Hi all, After quite some time, i can finally share my mod i've been working on. With this mod you will be able to randomize starting positions on skirmish maps, so that each playthrough feels different and more unpredicatable. The randomnization only repositions units+CC (all resources are untouched), will keep teams together automatically, and it works with the current Petra AI. To infuse the mod with your skirmish map is not a difficult task but it does require some setup. I've done my best to make it as simple as possible. Before i forget, this mod also includes some templates you can use with atlas, which are obstruction templates. This is useful to make sure ships cant ungarrison over obstacles they shouldn't be able to- like ridges- by building an invisible wall with the obstruction templates. Preventing them to be able to get close enough to ridges to do so. Lastly, this mod also includes my own maps which will be "X", and "A Path Beyond II" on this first release, and i will likely add more. They are also working examples of both the new templates, aswell as randomnization. If this is what you came for, just download and play Lets start infusing, Start by making a backup of your map (xml, pmp files), just in case. 1. to infuse the SkirmishRandomizer into your skirmish map one first needs to create a script file for the map with the same name (optional) as the map. 2. Copy the following code in there: Spoiler /* General info: The skirmish randomizer supports max 10 organic starting units. 5 support units (4 females + special starting unit), infantry units (2 melee, 2 ranged), and 1 cavalry. For more info check the forum: https://wildfiregames.com/forum/topic/35914-new-mod-grapejuice/ */ /* Map X and Z coördinates for CC here. You can find the CC coördinates in your map.xml file. Only change the values, not the variable names. It's important to follow this rule of thumb: Position A needs to have player 1's CC coördinates. Position B, Player 2 etc etc. Please also note that in your map.xml it is important that SkirmishRandomizer.js gets loaded before map.js*/ var civilCentrePositions = { Ax: [450], Az: [541], Bx: [511], Bz: [912], Cx: [563], Cz: [1384], Dx: [911], Dz: [1347], Ex: [1272], Ez: [1381], Fx: [1301], Fz: [914], Gx: [1281], Gz: [502], Hx: [878], Hz: [514] }; // Setting this to true returns player entities to their original spot before randomnization (useful for atlas). var g_atlasEditor = "false"; // Set this to false if you want to disable my custom iber defenses but note this: /* My custom iber structures are spawned (they are not placed in atlas). Iber defenses placed in atlas will NOT be repositioned by the randomizer. Maybe in A24 i can work that out (because of more visible classes). Setting this to false leaves the iber civ without starting defensive structures */ var g_grapjasIber = "true"; /* If set to true the randomizer will try to break the circular pattern (e.g. A Path Beyond II, Mainland) for better spawning randomnization IF there are only 2 teams. Otherwise the map will always be devided the same way between teams if there are only 2. In other words, set this to true if your map does NOT need teams to be on specific locations (e.g. duelling cliffs, X). For this to work correctly, players need to have been positioned in either ascending or descending (doesnt matter which) order in atlas, like: 1, 2, 3, 4 etc. Not: 1, 3, 4, 2 etc. */ var g_breakCircularPattern = "true"; // Set the max number of players the map can be played with (important for breakCircularPattern) var g_mapMaxPlayers = "8"; SkirmishRandomizer.Randomize(civilCentrePositions, g_atlasEditor, g_grapjasIber, g_breakCircularPattern, g_mapMaxPlayers); I've made comments in the code to give you directions on what you need to do, but for the people that will need more details here we go: 3. Open up your map .xml and find the civil centre of player 1. Now paste the value of x into Ax, and the value of z into Az. Do the same for player 2 civil centre but paste it into Bx, Bz etc etc. You will only need to do this for civil centres and not for any other units. 4. Set atlasEditor to true or false, read the comment on what it does. 5. Set grapjasIber to true or false, whichever you want. Examples below of how my custom iber defenses look like: The outposts give some extra vision range for the player to see incoming danger (right side is with upgrade). 6. The 'breakCircularPattern' perhaps needs some more explaining so i've made some visuals: If there are only 2 teams playing on the map, the map would always be divided the same way between 2 teams. To break this you can set breakCircularPattern to true. Now the map will be sliced randomly and makes sure the randomnization is 100%. If your map needs teams on specific locations, set this to false. 7. Set mapMaxPlayers to the maximum amount of players your map supports. 8. Open up your map in the scenario editor. Before doing this step, make sure each player has 4 females, 1 special starting unit, 2 melee, 2 ranged and 1 cavarly units like usual. In the scenario editor, place all skirmish entities from all players into the border of the map. This is needed because otherwise the old spot before randomnization will be visible. Would love a function where we could reset explored data to none. Anyway, 9. Save the changes you just made and close the scenario editor. Now open up your map's .xml file and add the following code in there: "TriggerScripts": [ "scripts/SkirmishRandomizer.js", "scripts/TriggerHelper.js", "skirmishes/A Path Beyond II (8).js" ], adjust the A Path Beyond II (8).js line with the name of your map's scriptfile. 10. Done. Doing all this could be done in less than 5 minutes. Especially after doing it a few times. Making this mod challenged me alot because im not a good scripter at all and have never done any scripting work in the past (only used them). But i like the result and will probably try to make the code more compact and optimise it by trying to learn techniques. Massive thanks to @Stan` @badosu @nani @wraitii for explaining/giving directions. grapejuice.zipgrapejuice.pyromod or Mod.io Most people think my name has something to do with grapejuice... might aswell embrace it Edited Sunday at 21:57 by Grapjas Update 6 2 Quote Link to post Share on other sites
Grapjas 61 Posted February 5 Author Report Share Posted February 5 Small update. Added a new variable to a map's script: // Setting this to true returns player entities to their original spot before randomnization (useful for atlas). var g_atlasEditor = "false"; It does what the comment says. I also recommend loading in TriggerHelper.js in your map's xml file so atlas editor can open the map without any errors. Check my maps in the mod as examples. Updated the OP download. Quote Link to post Share on other sites
wowgetoffyourcellphone 6.421 Posted February 9 Report Share Posted February 9 On 29/01/2021 at 3:22 PM, Grapjas said: Would love a function where we could reset explored data to none. Anyway, Indeed. On skirmish maps, non-Iberian players can get the FOW lifted where the skirmish replacer Iberian walls had been placed. Would be nice if this were not so (perhaps when the map is loaded vision can be initialized after the skirmish replacer units have been set, or something). Quote Link to post Share on other sites
Grapjas 61 Posted February 9 Author Report Share Posted February 9 16 hours ago, wowgetoffyourcellphone said: Indeed. On skirmish maps, non-Iberian players can get the FOW lifted where the skirmish replacer Iberian walls had been placed. Would be nice if this were not so (perhaps when the map is loaded vision can be initialized after the skirmish replacer units have been set, or something). It's pretty much the only thing that keeps my mod from being entirely automated. I already have the code finished to do all the location mapping automatically but i cant use it because the previous spot will be visible without a manual workaround. Maybe one of the devs want to make a function in the future for us to reset exlored areas, but i'm sure they are busy enough as is already. Still hoping though 1 Quote Link to post Share on other sites
wraitii 1.471 Posted February 10 Report Share Posted February 10 I created #5970 for that. No promise whatsoever that it will be worked on for A25, but it seems like it would be useful for campaigns, which are aimed for A25, so maybe. 2 Quote Link to post Share on other sites
Grapjas 61 Posted February 22 Author Report Share Posted February 22 Mod is now up to date with A24. Updated the download links in the original post. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.