• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Fix my triggers

Status
Not open for further replies.
Level 9
Joined
Jul 20, 2009
Messages
427
PLease fix these triggers, make them leakless if they're not already..am I doing them right?
  • create house props
    • Events
      • Unit - A unit owned by Player 1 (Red) Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to House
    • Actions
      • Set IntegerA = (Random integer number between 1 and 100)
      • Set Temp_Point = ((Position of (Constructed structure)) offset by (50.00, 80.00))
      • If (IntegerA Less than or equal to 25) then do (Destructible - Create a Crates at Temp_Point facing (Random angle) with scale 0.50 and variation 0) else do (Do nothing)
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = ((Position of (Constructed structure)) offset by (50.00, -100.00))
      • If (IntegerA Less than or equal to 50) then do (Destructible - Create a Barrel at Temp_Point facing (Random angle) with scale 0.50 and variation 0) else do (Do nothing)
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = ((Position of (Constructed structure)) offset by (-100.00, -50.00))
      • If (IntegerA Less than or equal to 30) then do (Destructible - Create a Crates at Temp_Point facing (Random angle) with scale 0.60 and variation 0) else do (Do nothing)
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Set Temp_Point = ((Position of (Constructed structure)) offset by (-100.00, 50.00))
      • If (IntegerA Less than or equal to 35) then do (Destructible - Create a Barrel at ((Position of (Constructed structure)) offset by (-100.00, 50.00)) facing (Random angle) with scale 0.50 and variation 0) else do (Do nothing)
      • Custom script: call RemoveLocation (udg_Temp_Point)
  • fog Copy Events
    • Game - The in-game time of day becomes Equal to 4.00
    • Conditions
    • Actions
      • Environment - Create at (Playable map area) the weather effect Dungeon White Fog (Heavy)
      • Environment - Turn (Last created weather effect) On
      • Environment - Set fog to style Linear, z-start 5000.00, z-end 5000.00, density 0.00 and color (85.00%, 90.00%, 100.00%)
      • Wait 5.00 seconds
      • Environment - Set fog to style Linear, z-start 4000.00, z-end 5000.00, density 0.01 and color (85.00%, 90.00%, 100.00%)
      • Wait 5.00 seconds
      • Environment - Set fog to style Linear, z-start 4000.00, z-end 5000.00, density 0.02 and color (85.00%, 90.00%, 100.00%)
      • Wait 5.00 seconds
      • Environment - Set fog to style Linear, z-start 4000.00, z-end 5000.00, density 0.03 and color (85.00%, 90.00%, 100.00%)
      • Wait 5.00 seconds
      • Environment - Set fog to style Linear, z-start 3000.00, z-end 5000.00, density 0.05 and color (85.00%, 90.00%, 100.00%)
      • Wait 5.00 seconds
      • Environment - Set fog to style Linear, z-start 2000.00, z-end 5000.00, density 0.08 and color (85.00%, 90.00%, 100.00%)
      • Wait 5.00 seconds
      • Environment - Set fog to style Linear, z-start 3000.00, z-end 5000.00, density 0.05 and color (85.00%, 90.00%, 100.00%)
      • Wait 5.00 seconds
      • Environment - Set fog to style Linear, z-start 4000.00, z-end 5000.00, density 0.03 and color (100.00%, 100.00%, 100.00%)
      • Wait 5.00 seconds
      • Environment - Set fog to style Linear, z-start 5000.00, z-end 5000.00, density 0.01 and color (100.00%, 100.00%, 100.00%)
      • Wait 5.00 seconds
      • Environment - Set fog to style Linear, z-start 5000.00, z-end 5000.00, density 0.00 and color (100.00%, 100.00%, 100.00%)
      • Wait 3.00 seconds
      • Environment - Reset fog to default values
      • Environment - Remove (Last created weather effect)
Copy

  • lbashaws Events
    • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Group = (Random 1 units from (Units of type House))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen kid2))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen man1))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen man2))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen woman))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Dog (Level 1)))
      • Custom script: call DestroyGroup (udg_Temp_Group)
      • Set Temp_Group = (Random 1 units from (Units of type House2))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen kid1))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen kid2))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen man1))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen man2))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen woman))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Dog (Level 1)))
      • Custom script: call DestroyGroup (udg_Temp_Group)
      • Set Temp_Group = (Random 1 units from (Units of type House3))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen kid1))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen kid2))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen man1))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen man2))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen woman))
          • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Dog (Level 1)))
      • Custom script: call DestroyGroup (udg_Temp_Group)
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Trigger 1
  • Set Temp_Point = ((Position of (Constructed structure)) offset by (50.00, 80.00))
  • ......................
  • Custom script: call RemoveLocation (udg_Temp_Point)
leaks. Do it like this:
  • Set TempPoint1 = Position of (Constructed structure)
  • Set TempPoint2 = TempPoint1 offset by (50,80)
  • ...................
  • Custom script: call RemoveLocation(udg_TempPoint1)
  • Custom script: call RemoveLocation(udg_TempPoint2)
takes some more effort, but now it's leakless.

Trigger 2 seems leakless to me..


Trigger 3
  • Set Temp_Group = (Random 1 units from (Units of type House))
  • Unit Group - Pick every unit in Temp_Group and do (Actions)
    • Loop - Actions
      • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen kid2))
      • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen man1))
      • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen man2))
      • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen woman))
      • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Dog (Level 1)))
  • Custom script: call DestroyGroup (udg_Temp_Group)
You remove the first group leak, but then in the loop actions, you still leak groups. Either use bj_wantDestroyGroup, or set them in variables also.
 
Level 9
Joined
Jul 20, 2009
Messages
427
Trigger 1
  • Set Temp_Point = ((Position of (Constructed structure)) offset by (50.00, 80.00))
  • ......................
  • Custom script: call RemoveLocation (udg_Temp_Point)
leaks. Do it like this:
  • Set TempPoint1 = Position of (Constructed structure)
  • Set TempPoint2 = TempPoint1 offset by (50,80)
  • ...................
  • Custom script: call RemoveLocation(udg_TempPoint1)
  • Custom script: call RemoveLocation(udg_TempPoint2)
takes some more effort, but now it's leakless.

Trigger 2 seems leakless to me..


Trigger 3
  • Set Temp_Group = (Random 1 units from (Units of type House))
  • Unit Group - Pick every unit in Temp_Group and do (Actions)
    • Loop - Actions
      • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen kid2))
      • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen man1))
      • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen man2))
      • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Citizen woman))
      • Unit - Order (Picked unit) to Unload (Random unit from (Units of type Dog (Level 1)))
  • Custom script: call DestroyGroup (udg_Temp_Group)
You remove the first group leak, but then in the loop actions, you still leak groups. Either use bj_wantDestroyGroup, or set them in variables also.

Thanks a lot..+rep for you
 
Level 9
Joined
Jul 20, 2009
Messages
427
HELP NEEDED>
  • updategrain Copy
    • Events
      • Time - FoodTimer expires
    • Conditions
    • Actions
      • Set Temp_Group2 = (Units owned by Player 1 (Red) of type Grain Warehouse)
      • Unit Group - Pick every unit in Temp_Group2 and do (Actions)
        • Loop - Actions
          • Set Temp_Group = (Units within 600.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Farm))
          • Set A = (Number of units in Temp_Group)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charges remaining in (Item carried by (Random unit from (Random A units from Temp_Group)) of type Grain)) Not equal to 0
              • ((Random unit from Temp_Group) is alive) Equal to True
              • (Number of units in Temp_Group) Not equal to 0
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Item - Set charges remaining in (Item carried by (Picked unit) of type Grain) to ((Charges remaining in (Item carried by (Picked unit) of type Grain)) + 1)
              • Floating Text - Create floating text that reads (String((Charges remaining in (Item carried by (Picked unit) of type Grain)))) above (Picked unit) with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
              • Floating Text - Change (Last created floating text): Disable permanence
              • Custom script: call DestroyGroup (udg_Temp_Group)
            • Else - Actions
          • Custom script: call DestroyGroup (udg_Temp_Group)
          • Set Temp_Group = (Units within 600.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Farm))
          • Unit Group - Pick every unit in (Random 1 units from Temp_Group) and do (Actions)
            • Loop - Actions
              • Set Grupo = (Units within 600.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Grain Warehouse))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is alive) Equal to True
                  • (Number of units in Grupo) Not equal to 0
                  • ((Random unit from Grupo) is alive) Equal to True
                • Then - Actions
                  • Item - Set charges remaining in (Item carried by (Picked unit) of type Grain) to ((Charges remaining in (Item carried by (Picked unit) of type Grain)) - 1)
                  • Floating Text - Create floating text that reads (String((Charges remaining in (Item carried by (Picked unit) of type Grain)))) above (Picked unit) with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
                  • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                  • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Custom script: call DestroyGroup (udg_Temp_Group)
                • Else - Actions
          • Custom script: call DestroyGroup (udg_Temp_Group)
      • Custom script: call DestroyGroup (udg_Temp_Group2)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Set Temp_Group = (Units within 600.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Farm))
^Leaks.

  • Set A = (Number of units in Temp_Group)
^No use for that.

  • (Charges remaining in (Item carried by (Random unit from (Random A units from Temp_Group)) of type Grain)) Not equal to 0
^Why not just use <random unit> from Temp Group.

  • ((Random unit from Temp_Group) is alive) Equal to True
^This is not the same random unit that was used in the item charges check.

  • (Number of units in Temp_Group) Not equal to 0
  • ((Picked unit) is alive) Equal to True
Redundant conditions. If the number of units is zero, the unit can't be alive.

  • Custom script: call DestroyGroup (udg_Temp_Group)
This has no use here, remove. Leave the latter call of that function.

  • Set Temp_Group = (Units within 600.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Farm))
Leaks.

  • Unit Group - Pick every unit in (Random 1 units from Temp_Group) and do (Actions)
Leaks. Use

  • Set Temp_Unit_1 = random unit from Temp_Group

  • Set Grupo = (Units within 600.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Grain Warehouse))
Leaks. Use the location of Temp_Unit_1.

  • ((Picked unit) is alive) Equal to True
  • (Number of units in Grupo) Not equal to 0
  • ((Random unit from Grupo) is alive) Equal to True
Rethink these.

There, probably missed something. It needs a lot of work.
 
Level 9
Joined
Jul 20, 2009
Messages
427
  • Set Temp_Group = (Units within 600.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Farm))
^Leaks.

  • Set A = (Number of units in Temp_Group)
^No use for that.

  • (Charges remaining in (Item carried by (Random unit from (Random A units from Temp_Group)) of type Grain)) Not equal to 0
^Why not just use <random unit> from Temp Group.

  • ((Random unit from Temp_Group) is alive) Equal to True
^This is not the same random unit that was used in the item charges check.

  • (Number of units in Temp_Group) Not equal to 0
  • ((Picked unit) is alive) Equal to True
Redundant conditions. If the number of units is zero, the unit can't be alive.

  • Custom script: call DestroyGroup (udg_Temp_Group)
This has no use here, remove. Leave the latter call of that function.

  • Set Temp_Group = (Units within 600.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Farm))
Leaks.

  • Unit Group - Pick every unit in (Random 1 units from Temp_Group) and do (Actions)
Leaks. Use

  • Set Temp_Unit_1 = random unit from Temp_Group

  • Set Grupo = (Units within 600.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Grain Warehouse))
Leaks. Use the location of Temp_Unit_1.

  • ((Picked unit) is alive) Equal to True
  • (Number of units in Grupo) Not equal to 0
  • ((Random unit from Grupo) is alive) Equal to True
Rethink these.

There, probably missed something. It needs a lot of work.

This is exactly why i need an expert triggerer for my map..thanks for the help..
 
Status
Not open for further replies.
Top