I cannot handle the data editor, and so I'm making "land mine" and "napalm" abilities with the trigger editor. I do this by making a unit group called "Land Mines" and then picking each one every .0625 seconds and doing a scan for enemies nearby. If an enemy is near the land mine, I blow it up. If an enemy is near a napalm unit I give it an "on fire" buff.
My repeat trigger picks every unit in the unit group Land Mine and then calls this function:
This isn't urgent, as I have stumbled upon a fix, but I would like to understand what is happening here if someone knows.
For completeness, the code that calls this action is given below:
My repeat trigger picks every unit in the unit group Land Mine and then calls this function:
-
Land Mine Hits
- Options: Action
- Return Type: (None)
-
Parameters
- Land Mine = No Unit <Unit>
- Grammar Text: Land Mine Hits(Land Mine)
- Hint Text: (None)
- Custom Script Code
-
Local Variables
- Point = (Position of Land Mine) <Point>
- tempUnitGroup = (Empty unit group) <Unit Group>
-
Actions
-
Unit Group - Pick each unit in (Units in (Empty region) having alliance Any with player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
- Actions
- ------- Above removes a bug where "picked unit" below doesn't work for some reason... works on napalm fire, but not on cars.
- General - If (Conditions) then do (Actions) else do (Actions)
-
General - If (Conditions) then do (Actions) else do (Actions)
-
If
- (Unit type of Land Mine) == Napalm Fire
-
Then
-
Unit Group - Pick each unit in (Units in (Region(Point, 1.0)) having alliance Any with player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
-
Actions
-
General - If (Conditions) then do (Actions) else do (Actions)
-
If
- (Unit type of (Picked unit)) == Napalm Fire
- Then
-
Else
- Environment - Deal damage using Firebat - Flame Thrower (Damage) on (Picked unit) from Land Mine with 10.0 extra damage
- Unit - Add 1 On Fire to (Picked unit) from Land Mine
-
If
-
General - If (Conditions) then do (Actions) else do (Actions)
-
Actions
-
Unit Group - Pick each unit in (Units in (Region(Point, 1.0)) having alliance Any with player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
- Else
-
If
-
Unit Group - Pick each unit in (Units in (Empty region) having alliance Any with player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
This isn't urgent, as I have stumbled upon a fix, but I would like to understand what is happening here if someone knows.
For completeness, the code that calls this action is given below:
-
Unit Group - Pick each unit in Land Mines and do (Actions)
-
Actions
-
General - If (Conditions) then do (Actions) else do (Actions)
-
If
- (Count of units in (Region((Position of (Picked unit)), 0.6)) having alliance Any with player Any Player matching Required: Ground; Excluded: Air, Hover, Missile, Dead, Hidden, with at most Any Amount) > 0
-
Then
- Land Mine Hits((Picked unit))
- Else
-
If
-
General - If (Conditions) then do (Actions) else do (Actions)
-
Actions