Please Help with Important Trigger Problem

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 ?)
Please help ! Thanks !
 

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 <gen>
      • Set RegionToDefend[1] = (Center of FrTopDefAct <gen>)
      • Set NumberOfKnights[1] = (Number of units in (Units in FrTopDefAct <gen>))


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

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

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.
 

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 ?
 

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 !
What's your email address ? Can I email you my scenario and you help me see what's wrong ?
Thanks a lot !
 

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

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 !
View attachment Moon Glade Updated.w3x
 

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

General chit-chat
Help Users
  • No one is chatting at the moment.
  • C Cherry.Grove:
    My boyfriend is super into Bethesda modding so I'm probably going to join him in that for a bit, then move on to making mobile/browser games.
  • C Cherry.Grove:
    I mostly just want to look at my old projects because I know I posted uploads on here somewhere.
  • C Cherry.Grove:
    My one game was basically Among Us but you sabotaged an entire medieval city simulated drastically inefficiently with dynamic NPCs :S
  • C Cherry.Grove:
    of course I never finished it x D
  • jonas jonas:
    xD
  • jonas jonas:
    I think you can still run the original game, just there's a chance your map won't work with the newer patches
  • jonas jonas:
    what development framework have you been looking at for mobile development?
  • jonas jonas:
    I'm currently creating (as a hobby) a space invaders like game for mobile using Xamarin, after starting a few larger projects that I also may not have finished :rolleyes::p
  • The Helper The Helper:
    Awesome! you should look at the Atari VCS platform it does not have a huge user base but the one it has is super active at around 11k and they have no games in there store
  • The Helper The Helper:
    basically it is linux
  • The Helper The Helper:
    OMG it is BanLord as Blackveiled on the forum
  • The Helper The Helper:
    what is up buddy
  • jonas jonas:
    thanks for the tip, that sounds cool. Never heard about the VCS before but seems like it should be a good match
  • tom_mai78101 tom_mai78101:
    The winter vacation left a toll on me. I missed staying up late and sleeping in late.
  • C Cherry.Grove:
    i haven't looked into it yet
  • C Cherry.Grove:
    If I could use something Python compatible it would save me some learning
  • C Cherry.Grove:
    But Unity might be easiest
  • C Cherry.Grove:
    looking at old posts here makes me happy. Makes me be all like "wow I was pretty smart in 2009"
  • C Cherry.Grove:
    mostly failing at life through adulthood really demotivated me for a while
  • C Cherry.Grove:
    ....what I don't get is why the fuck they would force us to permanently convert to a version of the game everyone fucking hated : \
  • C Cherry.Grove:
    Raid Shadow Legends texture pack smh
  • jonas jonas:
    Most people fail at life throughout their adulthood. Sometimes we get to learn from it. Usually it just feels like crap.
    +1
  • The Helper The Helper:
    What does not kill you makes you stronger is what they say
  • C Cherry.Grove:
    for real! :cool:

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top