I need a little help with some SLIC I'm using.
The following gives no errors with debugslic=yes, everything works fine everytime except the army doesn't group at the end. Is there something wrong with the code, or is the problem with the group commands? I've seen some kind of workaround for it in the Magnificant Samurai scenario where the AI is detached first? But it has some errors with the source code, so I wanted to try it the easy way first.
Please point out any other errors or inefficient code so I can improve it.
Also is there a way to force the AI to attack a location/city with SLIC (rather than goals/strategies)? I have FrenzyAI working but I also need to force the AI to attack sometimes.
The following gives no errors with debugslic=yes, everything works fine everytime except the army doesn't group at the end. Is there something wrong with the code, or is the problem with the group commands? I've seen some kind of workaround for it in the Magnificant Samurai scenario where the AI is detached first? But it has some errors with the source code, so I wanted to try it the easy way first.
Please point out any other errors or inefficient code so I can improve it.
Code:
HandleEvent(CaptureCity) 'kishinevTrig' pre { //if kishinev captured by germans, spawn germans around kirovgrad and russian partisans around kishinev unit_t tmpUnit; unit_t tmpUnit1; army_t tmpArmy; location_t randomkishinevLoc; location_t randomkirovgradLoc; if (PlayerCivilization(player[0]) == CivilizationIndex("German") && PlayerCivilization(city[0].owner) == CivilizationIndex("Russian") && city[0].location==kishinevLoc ){ GetRandomNeighbor(kishinevLoc, randomkishinevLoc); CreateUnit(1, UnitDB(UNIT_PARTISANS_RF), randomkishinevLoc, 0, tmpUnit); if (tmpUnit.valid) { Event:EntrenchUnit(tmpUnit); } if (tmpUnit.valid) { message(city[0].owner,'kishinevpartisansMsg'); } GetRandomNeighbor(kirovgradLoc, randomkirovgradLoc); CreateUnit(5, UnitDB(UNIT_WEHRMACHT_RF), randomkirovgradLoc, 0, tmpUnit1); CreateUnit(5, UnitDB(UNIT_WEHRMACHT_RF), randomkirovgradLoc, 0); CreateUnit(5, UnitDB(UNIT_WEHRMACHT_RF), randomkirovgradLoc, 0); CreateUnit(5, UnitDB(UNIT_15CMFELD_RF), randomkirovgradLoc, 0); CreateUnit(5, UnitDB(UNIT_15CMFELD_RF), randomkirovgradLoc, 0); CreateUnit(5, UnitDB(UNIT_15CMFELD_RF), randomkirovgradLoc, 0); CreateUnit(5, UnitDB(UNIT_ROMINF_RF), randomkirovgradLoc, 0); if (tmpUnit1.valid) { GetArmyFromUnit(tmpUnit1, tmpArmy); Event:GroupOrder(tmpArmy); DisableTrigger('kishinevTrig'); } } }
Comment