• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Problem with my trigger.

Status
Not open for further replies.
Level 2
Joined
Oct 2, 2010
Messages
12
Could someone explain me, what's the problem whit this event?

  • Time - Every (5.00 - (1.00 x (Real((Number of living farm units owned by Player 1 (Red)))))) seconds of game time
It should increase the food cap by 1 every (5-1*number of farms) seconds. But in this case, food cap always rises in every 5 seconds, no matter how many farms i have.
 
Last edited by a moderator:
Create an action in map initialization trigger that adds all farms into a group like farm_group.
Remember to create a trigger that has event Unit ends building structure - or smth like this (got no Eng editor) and add the buidling being contructed into farm_group if the given building type is farm.
Egzample:
  • init
    • Events
      • Unit - A unit ends building structure
    • Conditions
      • (Unit-type of (Constructed structure)) equal to Farm
    • Actions
      • Unit group - Add (Constructed structure) to farm_group
If you want to remove units from this group when it dies do similar trigger with event - Unit dies and action: Remove unit from unit group.
 
Level 2
Joined
Oct 2, 2010
Messages
12
Thank you guys for the replys!

I tryed both of them, and unfortunately neither of them worked. But it's probably because of my noobism.

However i came up with solution:

I used a countdown timer instead of a periodic one, with the same values. When ever the timer expires, it fires it self again.

  • Events
  • Time - timer1 expires
  • Conditions
  • Actions
  • Player - Add 1 to Player 1 (Red) Food cap
  • Countdown Timer - Start timer 1 as a One-shot timer that will expire in (5.00 - (1.00 x (Real((Number of living farm units owned by Player 1 (Red)))))) seconds
Is it good, or it may cause somekind of leak or anything?
 
Status
Not open for further replies.
Top