// General rules for cam 4-1 // // * Enable unit design and minimap only when an HQ exists // Modded by Goth for Cam 4 to enable technologies function eventStartLevel() { // Disable by default setMiniMap(false); setDesign(false); // Array.concat() -- https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat // Array.forEach() -- https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach enumStruct(me, HQ).concat(enumStructOffWorld(me, HQ)).forEach( function(structure) { eventStructureBuilt(structure); } ); // apply structure limits setStructureLimits("A0LightFactory", 5, me); setStructureLimits("A0PowerGenerator", 8, me); setStructureLimits("A0ResearchFacility", 5, me); setStructureLimits("A0CommandCentre", 1, me); setStructureLimits("A0ComDroidControl", 1, me); setStructureLimits("A0CyborgFactory", 5, me); setStructureLimits("A0VTolFactory1", 5, me); // stuff to make cyborgs work ([ // propulsion "CyborgLegs", // engineers "CyborgSpade", "CyborgSpade2", "CyborgSpade3", "CyborgSpade4", "HvyCybSpade", "HvyCybSpade2", "HvyCybSpade3", "HvyCybSpade4", // mechanics "CyborgRepair", "CyborgRepair2", "CyborgRepair3", "CyborgRepair4", "HvyCybRepair", "HvyCybRepair2", "HvyCybRepair3", "HvyCybRepair4", // various weapons "Cyb-Wpn-Atmiss", "CyborgCannon", "CyborgChaingun", "CyborgFlamer01", "Cyb-Wpn-Grenade", "Cyb-Hvywpn-A-T", "Cyb-Hvywpn-Acannon", "Cyb-Hvywpn-HPV", "Cyb-Hvywpn-Mcannon", "Cyb-Hvywpn-PulseLsr", "Cyb-Hvywpn-RailGunner", "Cyb-Hvywpn-TK", "Cyb-Wpn-Laser", "Cyb-Wpn-Rail1", "CyborgRocket", "CyborgRotMG", "Cyb-Wpn-Thermite", "CyborgFlamer01", "Cyb-Wpn-MortarInc", "HvyCyb-Wpn-MortarRot", "HvyCyb-Wpn-Cannon-HPVAslt", "Cyb-Wpn-Cannon-HPVLgt", "HvyCyb-Wpn-Cannon-Shotgun", "Cyb-Wpn-Cannon-Sniper", "HvyCyb-Wpn-EMP", // flamers "HvyCyb-Wpn-Flamer1", "HvyCyb-Wpn-Flamer2", "HvyCyb-Wpn-Flamer3", // lasers "Cyb-Wpn-Laser-AP1", "HvyCyb-Wpn-Laser-AP1", "Cyb-Wpn-Laser-AT1", "HvyCyb-Wpn-Laser-AT1", "Cyb-Wpn-Laser-AP3", "HvyCyb-Wpn-Laser-AP3", "Cyb-Wpn-Laser-AT3", "HvyCyb-Wpn-Laser-AT3", // mgs "HvyCyb-Wpn-MG3", "HvyCyb-Wpn-MG4", "HvyCyb-Wpn-MG-AntiTank", "HvyCyb-Wpn-MG-AntiTank2", "Cyb-Wpn-MG3Inc", "HvyCyb-Wpn-MG3Inc", "Cyb-Wpn-MG4Inc", "HvyCyb-Wpn-MG4Inc", // railguns "HvyCyb-Wpn-Railgun-Gattling", "HvyCyb-Wpn-Railgun-Shotgun", "Cyb-Wpn-Railgun-Sniper", "HvyCyb-Wpn-Railgun-Aslt", // rockets "HvyCyb-Wpn-Rocket-Pod", "HvyCyb-Wpn-Rocket-Pod2", "HvyCyb-Wpn-Rocket-Pod3", "HvyCyb-Wpn-Rocket-LtA-T", "Cyb-Wpn-Rocket-HvyA-T", "HvyCyb-Wpn-Rocket-MRL", "Cyb-Wpn-Rocket-Sunburst", "HvyCyb-Wpn-Rocket-Sunburst", // missiles "HvyCyb-Wpn-Missile-MdArt", "HvyCyb-Wpn-Missile-LtSAM", "HvyCyb-Wpn-Missile-HvySAM", // other "HvyCyb-Wpn-Rocket-TopAttack", "Cyb-Wpn-Rocket-Cherub", "HvyCyb-Wpn-Rocket-Cherub", // nexus link "Cyb-Wpn-SpyTurret01", "Cyb-Wpn-SpyTurret02", "Cyb-Wpn-SpyTurret03", "HvyCyb-Wpn-SpyTurretNEXUS", ]).forEach( function(component) { makeComponentAvailable(component, me); } ); } // new subroutines to enable the right tech when we choose it's research path - if I can get them working. >:-( // eventResearched() is a strange beast indeed. Gonna do this in the .slo instead. function eventStructureBuilt(struct, droid) { // Note: This event is only called for structures owned by 'me' (the player the script is associated with) if (!struct) return; // not interested console("debug: struct.player = "+struct.player+", selectedPlayer = "+selectedPlayer+", me = "+me); console("debug: struct.stattype = "+struct.stattype+" (HQ = "+HQ+"), struct.name = "+struct.name); if (struct.name == "Repurposed_Scavenger_Sensor") { // Enable minimap ONLY when we have one of these, not design too setMiniMap(true); } else if (struct.stattype == HQ) { // Enable unit design and minimap when an HQ gets built setMiniMap(true); setDesign(true); } } function eventDestroyed(victim) { // eventDestroyed() is one of the only events that will be called with all players // objects so you do need to check player here... if (victim.player != me) return; // not interested if (victim.type == STRUCTURE && victim.stattype == HQ) { // Disable unit design and minimap when the HQ gets destroyed setMiniMap(false); setDesign(false); } }