//SLO file for NEXUS taking over players stuff //cam3A-BX.SLO /* ******************** */ /* Declared Variables */ /* ******************** */ public int player, enemy, numStructs, structCount[10], power, expLev, numLaughs, laughChance; public STRUCTURESTAT structs[10]; public SOUND powTransSnd, laughSnd[2]; public int factoryIndex, cyborgIndex, VTOLIndex, maxAbsorb, absorbNum; public int numTemplates, numCyborgs, numVTOLs; public TEMPLATE templates[4], cyborgs[4], VTOLs[4]; public RESEARCHSTAT playerRes; private int count, count2, temp, numBases, curBase, tempX, tempY, absorbCount; private int strucCount1, strucCount2; private STRUCTURE base, structure; private RESEARCHSTAT researchDone; trigger factoryTrig(every, 300); //nexus factory trigger trigger nexusTrig(every, 300); //30sec time between taking over structures trigger changeDroidsTrig(every, 100); //10sec time between taking over droids trigger resDoneTrig(CALL_RESEARCHCOMPLETED, ref researchDone, ref structure, -1); //check if player has researched resistance circuits //player wins by first researching resistance circuits, then having no enemy structures or enemy units trigger delayWinTrig((not anyStructButWallsLeft(enemy)) and (getDroidCount(enemy) == 0), 41); event powStuff(wait, 5) { //Increase player's power (has to be done outside of GameInit, for savegame reasons!) addPower(power, player); playSound(powTransSnd, player); } //keep taking over structures until player does correct research event nexus(wait, 20) { initEnumStruct(FALSE,structs[strucCount1], player, player); base = enumStruct(); if (base != NULLOBJECT) { tempX = base.x; tempY = base.y; takeOverStructsInArea(player, enemy, tempX - 64, tempY - 64, tempX + 64, tempY + 64); strucCount2 = strucCount2 + 1; if ((strucCount2 >= structCount[strucCount1]) and (structCount[strucCount1] > 0)) { strucCount2 = 0; strucCount1 = strucCount1 + 1; } } else { if (structCount[strucCount1] > 0) { strucCount2 = 0; strucCount1 = strucCount1 + 1; } } setEventTrigger(nexus, nexusTrig); } event changeDroids(wait, 600) { setEventTrigger(changeDroids, changeDroidsTrig); takeOverDroidsInAreaExp(player, enemy, 0, 0, 8192, 16384, expLev, absorbNum); } //allow Nexus to build from newly acquired factory (light?) //what about cyborg and vtol factories? event nexusFactory(factoryTrig) { initEnumStruct(FALSE,structs[factoryIndex], enemy, enemy); structure= enumStruct(); // find factory. while(structure != NULLOBJECT) { if (structureIdle(structure)) { buildDroid(templates[random(numTemplates)], structure, enemy, 1); } structure= enumStruct(); // find factory. } } event nexusCyborgFactory(factoryTrig) { initEnumStruct(FALSE,structs[cyborgIndex], enemy, enemy); structure= enumStruct(); // find cyborg factory. while(structure != NULLOBJECT) { if (structureIdle(structure)) { buildDroid(cyborgs[random(numCyborgs)], structure, enemy, 1); } structure= enumStruct(); // find cyborg factory. } } event nexusVTOLFactory(factoryTrig) { initEnumStruct(FALSE,structs[VTOLIndex], enemy, enemy); structure= enumStruct(); // find cyborg factory. while(structure != NULLOBJECT) { if (structureIdle(structure)) { buildDroid(VTOLs[random(numVTOLs)], structure, enemy, 1); } structure= enumStruct(); // find cyborg factory. } } event makeLaugh(every, 600) { if (random(100) < laughChance) { playSound(laughSnd[random(numLaughs)], player); } } event makeLaugh2(CALL_ELECTRONIC_TAKEOVER) { if (random(100) < laughChance) { playSound(laughSnd[random(numLaughs)], player); } } event delayWin(inactive) //player must research before can win! { extraVictoryFlag = TRUE; setEventTrigger(delayWin, inactive); } /* event weatheredAttack(missionTimeRemaining() < 100, 10) { extraVictoryFlag = TRUE; setEventTrigger(weatheredAttack, inactive); } */ event resDone(resDoneTrig) { if (researchDone == playerRes) { //allow player to win if this research topic has been done setEventTrigger(delayWin, delayWinTrig); setEventTrigger(changeDroids, inactive); setEventTrigger(nexus, inactive); setEventTrigger(resDone, inactive); } }