• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Please help me with these leaky triggers.

Status
Not open for further replies.
Level 8
Joined
Feb 20, 2007
Messages
338
I have tried every combination of removing the points that these triggers are making - I assume that these are the leaks that are slowing things down for me.

Either I have misspelled, mis-spaced or used the wrong custom script.

However I have managed to make the triggers not work and even managed to "protect" my map with my custom scripts - and I have caused the game to crash.

Instead of posting what I did I'm just going to post the triggers without leak removals and see what you all have do to stop the leaks - maybe I will learn something.

Here are the triggers:

  • Plant field
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Plant Corn Field
    • Actions
      • Player - Add (0 - 10) to (Owner of (Casting unit)) Current gold
      • For each (Integer A) from 1 to 25, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit - Create 1 Corn -temp for (Owner of (Casting unit)) at (Target point of ability being cast) facing (Random angle) degrees
  • Plant and Harvest
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Harvest Crops
        • Then - Actions
          • Unit - Order (Casting unit) to Attack (Random unit from (Units owned by (Owner of (Casting unit)) of type Corn ready for harvest))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Plant Crops
          • ((Owner of (Casting unit)) Current gold) Greater than or equal to 10
        • Then - Actions
          • Unit - Order (Casting unit) to Right-Click (Random unit from (Units owned by (Owner of (Casting unit)) of type Corn ready for harvest))
          • Player - Add (0 - 1) to (Owner of (Casting unit)) Current gold
          • Unit - Create 1 Corn new for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Random angle) degrees
        • Else - Actions
  • Growing Corn
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Dying unit)) Equal to Corn -temp
        • Then - Actions
          • Unit - Replace (Dying unit) with a Corn new using The new unit's max life and mana
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Dying unit)) Equal to Corn new
        • Then - Actions
          • Unit - Replace (Dying unit) with a Corn ready for harvest using The new unit's max life and mana
          • Unit - Set life of (Last replaced unit) to 10.00
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Dying unit)) Equal to Corn ready for harvest
          • ((Killing unit) belongs to an ally of (Owner of (Dying unit))) Equal to False
        • Then - Actions
          • Player - Add 1 to (Owner of (Killing unit)) Food cap
        • Else - Actions
What these are.

Spell one plants a field of corn. It is a targeted type spell (like volcano) it creates crop units which are building-type units - this gives me the pathing space between each unit.

That unit has a life span of about half a second - it dies and is replaced by a non-building unit called Corn New. Corn new has a life of about 75 seconds its regeneration is negative -1 always) it dies and is replaced with a Corn Ready t Harvest which has its 60 Hp capability set to 10 hp. It has received "damage" and will be a target of a "heal" spell which heals one point and causes a casting unit to either harvest or plant more crops (which goes back to the building crop).

The spells work - I can have either a computer player's units out there in the fields harvesting or a player's units. If I have a small village with several fields the villagers with the harvest and plant ability not only harvest and plant the scurry back and forth from farm to farm - this adds a bit of life to the village - villagers with a purpose not just wandering around randomly.

So I really do not want to change the functions that take place - I just want to remove leaks here.

Thanks for your patience, help and time.
 
Level 18
Joined
May 27, 2007
Messages
1,689
Ok, I see two leaks that are point leaks, in your first and second trigger all you need to do is for the first one lets say create a point variable, named 'Point' then just set 'Point' = Target Point of Ability Being Cast then at the end of the trigger, when you are done creating the corn, just use "Call RemoveLocation(udg_Point)"
And basically the same for the second trigger except for the fact you need to set a different Point Variable=Position of casting unit then do 'Call RemoveLocation(udg_DiffPoint)"
I think everything else should be fine
 
Level 8
Joined
Feb 20, 2007
Messages
338
Ok, I see two leaks that are point leaks, in your first and second trigger all you need to do is for the first one lets say create a point variable, named 'Point' then just set 'Point' = Target Point of Ability Being Cast then at the end of the trigger, when you are done creating the corn, just use "Call RemoveLocation(udg_Point)"

And basically the same for the second trigger except for the fact you need to set a different Point Variable=Position of casting unit then do 'Call RemoveLocation(udg_DiffPoint)"
I think everything else should be fine

Do I still need the 'Destroy Group' custom script or will that mess with the call Point?

Now the placement of when to call the point of casting point:

  • Actions
    • Set CropPoint = (Target point of ability being cast)
    • Player - Add (0 - 10) to (Owner of (Casting unit)) Current gold
    • For each (Integer A) from 1 to 25, do (Actions)
      • Loop - Actions
        • Custom script: set bj_wantDestroyGroup = true
        • Unit - Create 1 Corn -temp for (Owner of (Casting unit)) at (Target point of ability being cast) facing (Random angle) degrees
        • Custom script: Call RemoveLocation(udg_CropPoint)
Should it be in the loop or outside of the loop or does it matter?

I had set the point as point of last created unit so each unit (25 of them) point was being removed. Obviously that was wrong?

Again thanks for your help.
 
Level 8
Joined
Feb 20, 2007
Messages
338
Now I am getting compile errors?

Call RemoveLocation(udg_CropPoint) = Expected a code statement

Call RemoveLocation(udg_CastingPoint) = Expected 'endif'

Below is how I have my points in my triggers:

  • Plant field
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Plant Corn Field
    • Actions
      • Set CropPoint = (Target point of ability being cast)
      • Player - Add (0 - 10) to (Owner of (Casting unit)) Current gold
      • Custom script: Call RemoveLocation(udg_CropPoint)
      • For each (Integer A) from 1 to 25, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit - Create 1 Corn -temp for (Owner of (Casting unit)) at (Target point of ability being cast) facing (Random angle) degrees
Call RemoveLocation(udg_CastingPoint) = Expected 'endif'

and

  • Then - Actions
    • Unit - Order (Casting unit) to Right-Click (Random unit from (Units owned by (Owner of (Casting unit)) of type Corn ready for harvest))
    • Player - Add (0 - 1) to (Owner of (Casting unit)) Current gold
    • Set CastingPoint = (Position of (Casting unit))
    • Unit - Create 1 Corn new for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Random angle) degrees
    • Custom script: Call RemoveLocation(udg_CastingPoint)
Call RemoveLocation(udg_CropPoint) = Expected a code statement

I triple checked to make certain that my variables ARE points. There are no spaces, I used the exact same capitalization I even scraped using an underline between the words - EX: Crop_Point and Casting_Point.

Did I get the spacing and spelling correct on my Call RemoveLocation(udg_point) statements?
 
Status
Not open for further replies.
Top