So I have units shoved into a wave via data table. Then these units are added to a unit group. Every unit in this unit group (when they are about 10 spaces from a hatchery) are ordered to morph. This works.. sort of...
Some of the first few units that reach a hatchery are ordered to morph as normal, but the others are magically removed from the unit group (tested via chat output of number of units in UGroup).
How are these units magically getting removed from the unit group?
Side notes:
- A computer player controls the units.
- Trigger code below:
SunkenRushChildEventsTimer-Every1.2secondsofAITimeLocalVariablesPos=0.0<Real[1]>
Player = 2 <Integer>
Wave = (Empty unit group) <UnitGroup[8]>
Conditions
Actions
Unit Group - Add all units in (Units of (("SR" + "2") from the Global data table)) to Wave[2]
UI - Display (Combine ("Checking for sunken spot with ", (Text((Get the number of units in wave (("SR" + (String(2))) from the Global data table)))), " or ", (Text((Number of Living units in Wave[2]))), " drones.")) for (All players) to Subtitle area
General - While (Conditions) are true, do (Actions)
Conditions
Player < 9ActionsUnitGroup-PickeachunitinWave[Player]anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Distancebetween(Positionof(Pickedunit))and(StartlocationofplayerPlayer))<10.0ThenUnit-Create1PhotonCannonforplayer1at(Positionof(Pickedunit))usingdefaultfacing(UnderConstruction)Variable-SetPos[0] =(Xof(Positionof(Lastcreatedunit)))Variable-SetPos[1] =(Yof(Positionof(Lastcreatedunit)))Unit-Remove(Lastcreatedunit)fromthegameUnit-Order(Pickedunit)to(Stop)(ReplaceExistingOrders)Unit-Order(Pickedunit)to(Drone-MutateintoSpineCrawlertargeting(Point(Pos[0],Pos[1])))(ReplaceExistingOrders)-------Forcedronestowanderarounduntilfindaspottosunkenon.General-If(Conditions)thendo(Actions)elsedo(Actions)If0<=(Distancebetween(Positionof(Pickedunit))and(StartlocationofplayerPlayer))<=3ThenGeneral-Wait0.7AITimesecondsUnit-Order(Pickedunit)to(Movetargeting(Centerof(Playablemaparea)))(ReplaceExistingOrders)ElseUnit-Order(Pickedunit)to(Movetargeting(StartlocationofplayerPlayer))(AfterExistingOrders)ElseVariable-ModifyPlayer:+1-------Deletewavesonceallsunkensaremadeordronesdied.General-Waitfor(Conditions),checkingevery2.2GameTimesecondsConditions(NumberofLivingunitsin(DroneunitsinWave[2]ownedbyplayer1matchingExcluded:Missile,Stasis,Dead,Hidden,withatmostAnyAmount))==0(NumberofLivingunitsin(DroneunitsinWave[3]ownedbyplayer1matchingExcluded:Missile,Stasis,Dead,Hidden,withatmostAnyAmount))==0Variable-SetPlayer =2General-While(Conditions)aretrue,do(Actions)ConditionsPlayer<9ActionsAIAdvanced-Deletewave(("SR"+(String(Player)))fromtheGlobaldatatable)Variable-ModifyPlayer:+1Trigger-Turn(Currenttrigger)Off
P.S. I dropped all the units from the Waves (Data Table) into unit groups because I figured the computer was pulling them out of the waves and couldn't do that to unit groups. Neither is confirmed, it was just a guess.
Nvm, fixed. Gah, talking problems through with peeps on the IRC really helps (even if they don't know the answer XD).
The problem was the unit group was local and was getting units rehashed into it every time the trigger ran, so basically it had the exact same units as the waves. From that, the computer was removing units from the waves and therefore removing units from the unit group. The fix? Creating a global unit group that only gets the units of each wave added to it once.
Done!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
So I have units shoved into a wave via data table. Then these units are added to a unit group. Every unit in this unit group (when they are about 10 spaces from a hatchery) are ordered to morph. This works.. sort of...
Some of the first few units that reach a hatchery are ordered to morph as normal, but the others are magically removed from the unit group (tested via chat output of number of units in UGroup).
How are these units magically getting removed from the unit group?
Side notes:
- A computer player controls the units.
- Trigger code below:
P.S. I dropped all the units from the Waves (Data Table) into unit groups because I figured the computer was pulling them out of the waves and couldn't do that to unit groups. Neither is confirmed, it was just a guess.
Nvm, fixed. Gah, talking problems through with peeps on the IRC really helps (even if they don't know the answer XD).
The problem was the unit group was local and was getting units rehashed into it every time the trigger ran, so basically it had the exact same units as the waves. From that, the computer was removing units from the waves and therefore removing units from the unit group. The fix? Creating a global unit group that only gets the units of each wave added to it once.
Done!