Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: Sirbomber on February 04, 2010, 01:50:27 PM

Title: Destroying Units As An Objective
Post by: Sirbomber on February 04, 2010, 01:50:27 PM
I want an objective to be "destroy all waves of incoming enemy units" but sadly OP2 has no "EnemyGroupDestroyed" trigger.

Any suggestions?

Edit 3: I'm going to try using a Set Trigger to combine a Time Trigger with a Vehicle Count Trigger.  I'll let you know if it works.

Edit: Unrelated to the above problem, but part of the same project.

Code: [Select]
    Unit Unit1;
    for (short s = 23; s < 39; s++)
    {
        TethysGame::CreateUnit(Unit1, mapScorpion, LOCATION(s+31, 1-1), 1, mapEnergyCannon, 2);
            Unit1.DoSetLights(1);
            SD.Wave4.TakeUnit(Unit1);
    }

    SD.Wave4.SetAttackType(mapCommandCenter);
    SD.Wave4.DoAttackEnemy();

Any idea why that only spawns 2 Scorpions (or sometimes none at all)?  I have nearly identical code that works, which makes it even more confusing...

Edit 2: Problem solved due to Arklon.  Apparently, OP2 deletes units if you try to put them in a full attack group...
Title: Destroying Units As An Objective
Post by: Hooman on February 07, 2010, 05:33:53 PM
I wonder if SetDeleteWhenEmpty would be of any use? Maybe you can check if a group gets destroyed, which should happen when all the units in it are killed. I believe in certain cases with the Unit variable, the internal ID is cleared to 0 if the unit is no longer valid. Perhaps there is similar behavior with groups. Maybe check the stubIndex periodically, and see if it changes when all units in the group are destroyed.