Progesterone

New Member
Trigger:
• Barracks Defense
• Events
• Time - Every 3.00 seconds of game time
• Conditions
• Actions
• For each (Integer A) from 1 to 3, do (Actions)
• Loop - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• NumberOfKnights[(Integer A)] Less than or equal to 1
• Then - Actions
• Unit - Order Barracks[(Integer A)] to train/upgrade to a Knight
• Set NumberOfKnights[(Integer A)] = (NumberOfKnights[(Integer A)] + 1)
• Else - Actions
• Barracks Defense Assign
• Events
• Unit - A unit Finishes training a unit
• Conditions
• (Unit-type of (Trained unit)) Equal to Knight
• Actions
• Unit - Set the custom value of (Trained unit) to (Custom value of (Triggering unit))
• Unit - Order (Trained unit) to Attack-Move To (Center of RegionToDefend[(Custom Value of (Triggering Unit))])
• -------- The Triggering Unit is the Barracks, as far as I can tell. --------
• Barracks Defense Reduce
• Events
• Unit - A unit owned by Player 5 (Yellow) Dies
• Conditions
• (Unit-type of (Triggering unit)) Equal to Knight
• Actions
• Set NumberOfKnights[(Custom value of (Triggering unit))] = ((Custom value of (Triggering unit)) - 1)

At the start assign each of your barracks a custom value to be used as the index for Arrays. Assign all the regions the same way. The first trigger is the one that begins training, then increases the number of Knights currently existing (regardless of whether it is trained or not). The second one assigns all Knights the custom value of their Barracks, which tells you which Barracks should train another Knight when one dies. The last trigger will reduce the number of Knights of one Barracks currently existing when one Knight dies. This will allow the first trigger to make that Barracks train a new knight. I hope this helped - it used up all 24.2% of my laptop's remaining power.
Hi Kaerf, I have tried your trigger, but it was unable to work as I could not figure out how to "set my newly created variable 'Barracks 1' to be that particular Barracks" (ie, I just created the variables and named them, select type as unit, and click Array, then put '3', but how does the editor recognise that Barracks 1 is one particular barracks ?)

Progesterone

New Member
Oh, on retrospect, I added this trigger to "set the variables"
Trigger:
• Variable Setting
• Events
• Map initialization
• Conditions
• Actions
• Set Barracks[1] = Barracks 0108 &lt;gen&gt;
• Set RegionToDefend[1] = (Center of FrTopDefAct &lt;gen&gt;)
• Set NumberOfKnights[1] = (Number of units in (Units in FrTopDefAct &lt;gen&gt;))

But the trigger still can't work ! Did I do something wrong ?

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Use the action Set Variable, and do Set Barracks[1] = Barracks 0001 <gen>.
For Regions, do Set RegionToDefend[1] = RegionToDefend1 <gen>.
You also need the action Unit - Set Custom Value of Unit. Like this:

Trigger:
• Map Initialization
• Events
• Map Initialization
• Conditions
• Actions
• Set Barracks[1] = Barracks 0001 &lt;gen&gt;
• Set Barracks[2] = Barracks 0002 &lt;gen&gt;
• Set Barracks[3] = Barracks 0003 &lt;gen&gt;
• Set RegionToDefend[1] = RegionToDefend1 &lt;gen&gt;
• Set RegionToDefend[2] = RegionToDefend2 &lt;gen&gt;
• Set RegionToDefend[3] = RegionToDefend3 &lt;gen&gt;
• Set NumberOfKnights[1] = (Number of units in (Units in RegionToDefend1 &lt;gen&gt; matching ((Unit-type of (Matching Unit)) equal to Knight)))
• Set NumberOfKnights[2] = (Number of units in (Units in RegionToDefend2 &lt;gen&gt; matching ((Unit-type of (Matching Unit)) equal to Knight)))
• Set NumberOfKnights[3] = (Number of units in (Units in RegionToDefend3 &lt;gen&gt; matching ((Unit-type of (Matching Unit)) equal to Knight)))
• Unit - Set Custom Value of Barracks 0001 &lt;gen&gt; to 1
• Unit - Set Custom Value of Barracks 0002 &lt;gen&gt; to 2
• Unit - Set Custom Value of Barracks 0003 &lt;gen&gt; to 3

I did this in freehand, but if you need, I'll make a test map for you.

Attachments

• 7 KB Views: 199
• 6.9 KB Views: 197

Progesterone

New Member
Kaerf, thanks !
But I followed your trigger exactly and still cannot work: my first barracks will keep on training knights even when there are more than 2 knights in region 1, while my second and third barracks will not train any knights even when there are lesser than 2 knights in region 2 and 3 respectively.
Can I send you my scenario and you help me find out whats the problem ?
Thanks a lot !

Progesterone

New Member
Sorry correction, I tried your trigger exactly but now my Barracks 1 just initially trained to get 2 knights in Region 1, but then subsequently, when the knights die, Barracks 1 didn't train anymore.

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
I'll make a test map, get back to you sometime tomorrow.

Progesterone

New Member
Hi Kaerf, thanks a lot for your help ! Added your reputation ! Hope you can help me solve this problem !

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Here, test map completed about 12.30 am early today. You'll find instructions in the respective trigger comments above the triggers themselves.

Attachments

• 22.3 KB Views: 120

Progesterone

New Member
Here, test map completed about 12.30 am early today. You'll find instructions in the respective trigger comments above the triggers themselves.
Thanks Kaerf for the map.
I will need some time to test whether it can work on my scenario.
Will get back to you !
By the way, do you use MSN ? Can I add you on MSN for easier contact ?

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Yes, I do. It's under my name.

Progesterone

New Member
Hi Kaerf, I copied your trigger and modified the necessary values to fit in my scenario, but the same problem still occur !
Thanks a lot !

Progesterone

New Member
Dear all,
I've used the triggers that Kaerf mentioned. It worked in his test map but not in mine. I've attached my map to this thread. Can someone please kindly help me see whats the problem ?
Thanks !

View attachment Map Test File.w3x

evilwolf

Member
Well, you(blizzard, actually) made a simple issue a tough problem.
Could you just do this?
Create a trigger that checks if there are 2 knights
And a trigger that has no event but it has a action to train a knight.
If there are less than 2 knights in an area run trigger No.2 (the one with the train knight action)
If it has +2 knights then don't run the trigger.
It works...

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
I got the problems. One was because I made a mistake in the alternative trigger, which I didn't notice since it wasn't active in my test map. Sorry about that.

1st problem:
Trigger:
• Train
• Events
• Time - Every 3.00 seconds of game time
• Conditions
• Actions
• For each (Integer A) from 1 to 3, do (Actions)
• Loop - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• NumberOfKnights[(Integer A)] Less than 2
• Then - Actions
• Unit - Order Barracks[(Integer A)] to train/upgrade to a Knight
• Set NumberOfKnights[(Custom value of (Ordered unit))] = (NumberOfKnights[(Custom value of (Ordered unit))] + 1)
• Else - Actions

There was no Ordered Unit in this trigger. Replace (Custom Value of (Ordered unit)) with (Integer A).

2nd problem:
Trigger:
• Init
• Events
• Map initialization
• Conditions
• Actions
• Set Barracks[1] = Barracks 0108 &lt;gen&gt;
• Set Barracks[2] = Barracks 0095 &lt;gen&gt;
• Set Barracks[3] = Barracks 0057 &lt;gen&gt;
• Set RegionToDefend[1] = FrTopDefAct &lt;gen&gt;
• Set RegionToDefend[2] = FrEastDefAct &lt;gen&gt;
• Set RegionToDefend[3] = FrBottomDefAct &lt;gen&gt;
• For each (Integer A) from 1 to 3, do (Actions)
• Loop - Actions
• Unit - Set the custom value of Barracks[(Integer A)] to (Integer A)
• -------- Assuming that you may have placed knights in the region beforehand, this will also try to account for them. --------
• Set NumberOfKnights[(Integer A)] = (Number of units in (Units in RegionToDefend[(Integer A)] matching ((Unit-type of (Matching unit)) Equal to Knight)))
• Trigger - Turn off (This trigger)

This trigger did not take into account the fact that preplaced knights have no custom value assigned. Therefore, I added this action:
Trigger:
• Unit Group - Pick every unit in (Units in RegionToDefend[(Integer A)] matching ((Unit-type of (Matching unit)) Equal to Knight)) and do (Actions)
• Loop - Actions
• Unit - Set the custom value of (Picked unit) to (Integer A)

New test map is attached. Works perfectly.

@evilwolf: Did you even bother to read the rest of the thread and find out the exact problems he was facing?

Attachments

• 184.8 KB Views: 120

Progesterone

New Member
thanks so much kaerf ! I will go try it again !

Progesterone

New Member
yupz it works perfectly fine now ! Really thanks a lot, kaerf ! Wanted to add one more reputation to you but the system doesn't allow me to. Now I can go designing the rest of the scenario and triggers already ! This trigger set will certainly help me a lot as I need to reproduce this concept in various other forms !

Progesterone

New Member
Dear all and Kaerf,
I have tried replicating your triggers to another player (Player 2 in my map) and situation, but experienced problems with it:
1) The trained orc (ie, "Bandit Henchman" in my map) will move to point, then go back automatically to barracks
2) When there are lesser than 2 Bandit Henchman in region Top HM 2 and Top HM 3, the barracks does not train more to replace.
I've attached my map.
Can please kindly help me see what's wrong with it ?
Would appreciate your help lots !

evilwolf

Member
Maybe delete run meele AI action?

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
I added this action to the Assign trigger:
Trigger:
• AI - Ignore (Trained unit)'s guard position

I think it was some problem with the AIs, since this fixed it. Also, you set one of the regions wrongly. I corrected it for you.

@evilwolf: Did you even check to see if there was such an action in the map?

Attachments

• 187.1 KB Views: 121

hgkjfhfdsj

Active Member
edit
- ignore -

General chit-chat
Help Users
• No one is chatting at the moment.
• The Helper:
check out this place apparently it is the best roommate site out there roommates.com lol
• Varine:
The homeless people reminded me of New York
• Varine:
I'll check it out, my lease expires in like a few months so I need to figure something out.
• Varine:
I tried to open a food truck in Sandpoint a few years ago but the city said no, then like two years later they passed new laws to encourage it and gave them all fucking tax breaks and shit. And at that point I didn't have enough money to go buy one so I was way too late to the game once other cities realized they could just bring their existing truck there, or sell their brick and mortar.
• Varine:
I do like food trucks though, they're way more fun than restaurants and usually I also get some of that tip money there.
• Varine:
Restaurants are really hard if you don't have a back up source of income to fund them sometimes, in my experience most owners either got really really lucky, had existing money that allowed them to buy an already successful one, or they have family money to fall back on for loans. It's few and far between to see very inspiring success stories where the person actually got it through hard work and perseverance. I thought about opening one lots and I always just end up not thinking it'll work. I would much rather just find someone that has that money and go work for them
• The Helper:
i am not talking about opening a brick and mortar I am talking about food trucks though I have seen some brick and mortar mexican places open up during covid that are doing good because there food is awesome!
• The Helper:
Food trucks are killing out here because Bars cannot open unless they sell food and the governor ok'd the use of a food truck in front as serving food
• The Helper:
Just not enough food trucks
• The Helper:
a buddy of mine just opened up a food truck and he is killing it but he is a great cook and has awesome food right in the middle of the pandemic too food trucks are immune to pandemic because they are take out in Texas you will always be able to get take out or delivery
• The Helper:
He is in the different food facebook groups in houston and posts videos of him making his food
• The Helper:
he is killing it
• jonas:
@Varine with the restaurants, there surely is a lot of luck and hard work but most restaurants fail because they suck. Flair isn't right, economics not well thought through, food is mediocre or sucks, location is bad, etc. If you're thinking about opening one, make sure you're looking at the stories of those that would be playing at your level, don't let your hopes be dragged down by all the subpar restaurants out there.
• jonas:
I'm a bit worried about the future of data science, there's an influx of incompetent people hired by incompetent managers, that can't last. But I'm sure smart data scientists will always be useful and hireable. Same as smart security people.
• jonas:
My sister in law worked in a vegan food truck, the owners were also making a killing, added several trucks and opened two restaurants over 5 years
• Ghan:
The CompTIA stuff is pretty much crap unfortunately. The places that ask for those low-level certs aren't likely places you want to work. For IT you really want a degree, but in the meantime you need to figure out some way to learn the skills. Cybersecurity is really hot right now so competition is fierce.
• tom_mai78101:
I realized I don't have anything much to say, other than "Good luck!". Compared to other places, I'm just very lucky we didn't have a lot of surges of cases coming in.
• The Helper:
My daughter just got back from school at Georgetown TX, outside of Austin and said there were 100 cases in the last week but she also said nobody was wearing a mask anywhere so people mask up and stay safe!
+2
• thewrongvine:
happy thanksgiving folks!
+1
• Ralle:
PLOOB
• Varine:
@Gyah Yeah I figured they aren't particularly valuable, but they'll at the least act as a baseline for some entry level work somewhere.
• Varine:
I now see how horribly I spelled @Ghan
• Varine:
• The Helper:
that field is going to explode and though there is competition there is going to be room for all levels in the coming years imho.
• tom_mai78101:
Why are we competing for rough mornings?

Members online

No members online now.