Quasi-AI difficulties.

Izanagi

New Member
Reaction score
3
Hello all,

First of all, I'm new, so I guess I should say hi.

Hi.

So now that that's over with, my problem is this: I'm creating a campaign (yeah, that thing that isn't a TD or AoS), the first level of which requires a sort of pseudo-AI on the part of an enemy force. To wit, I attempted to make it such that the enemy would begin training Ghouls and Crypt Fiends after they reached a threshold of 800 gold and 400 lumber, stopping after 8 Ghouls and 4 Crypt Fiends were trained. Said enemy would then automatically begin retraining that force if the original two armies were slain (the armies are represented by Unit Groups, obviously).

My actual problem is that the initial training sequence doesn't even start. I have two pre-placed Crypts that I have instructed to begin training units after 5 seconds of game time, with the aforementioned condition of 800 gold and 400 lumber. The enemy player has enough resources. I granted them more than enough at the very beginning of the game.

There aren't any variables involved, there aren't any custom functions or script or anything like that. All there is is a single trigger ordering Crypt 0034 to train a Ghoul (8 times over, but can't the Crypt automatically queue?), Crypt 0036 to train a Crypt Fiend (4 times over), and then a couple variable functions setting the trained units to my two attack groups (a.k.a. the groups that will be used to determine when the computer should begin to retrain: the Ghouls go into "GhoulGroup" and the Fiends into "FiendGroup."). The final action is a "turn this trigger off" action, so as to prevent an infinite training loop as long as the enemy has 800 gold and 400 lumber, but again, that shouldn't do anything, right? Right. So where am I going wrong?

Thanks in advance,
Iz
 

CaptDeath

New Member
Reaction score
103
Fisrt off read a variable tutorial and second off read a leak removing tut[serch for these] the tuts are there you just need to look and if you need help triggering ill be glad to help just i dosent have time im going away for like a week but i can help you on your spare time
and since thats your first post ill tell you how things work around here theres a rep bar on the far right of your post people like it when it goes up so when some one helps you it is expected[not required] to add to there rep i added to yours just as an act of kindness
 

Izanagi

New Member
Reaction score
3
Thanks, I suppose it's only fair that I reciprocate in kind :)

I'd be less puzzled by the apparent failure of my trigger if it didn't seem quite basic... I tell the Crypts to produce the units, I add them to the Unit Groups using fairly clear parameters. I have exactly one condition, which is that the enemy player be at a set resource level which he by default exceeds. It's not rocket science...so clearly I'm not cut out to be even a lab assistant.

If it helps, I can post the code.
 

CaptDeath

New Member
Reaction score
103
yes of course always post your triggers copy as text in between wc3 tags you have to write wc3 there's no preset button
and if you dont clean the variables after there used causes leaks
 

Izanagi

New Member
Reaction score
3
Okey, here it be:

Trigger:
  • Training
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
      • ((Player 7 (Green) Current gold) Greater than or equal to 800) and ((Player 7 (Green) Current lumber) Greater than or equal to 400)
    • Actions
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0036 <gen> to train/upgrade to a Crypt Fiend
      • Unit - Order Crypt 0036 <gen> to train/upgrade to a Crypt Fiend
      • Unit - Order Crypt 0036 <gen> to train/upgrade to a Crypt Fiend
      • Unit - Order Crypt 0036 <gen> to train/upgrade to a Crypt Fiend
      • Set GhoulGroup = (Units owned by Player 7 (Green) matching ((((Matching unit) is in Harvesters) Equal to False) and ((((Matching unit) is in Miners) Equal to False) and ((Unit-type of (Matching unit)) Equal to Ghoul))))
      • Set FiendGroup = (Units owned by Player 7 (Green) of type Crypt Fiend)
      • Trigger - Turn off Training <gen>


As a side note, "GhoulGroup" requires extra parameters because as an Undead player, the enemy naturally has Ghouls harvesting lumber for him. In retrospect, defining GhoulGroup as units not belonging to Miners was a bit redundant, since the Miners are all Acolytes and are thus patently not Ghouls. But hindsight is 20/20, I suppose...
 

Izanagi

New Member
Reaction score
3
Here are, respectively, the looped training and looped attacking triggers. (Note that the training trigger is actually two triggers that loop each other):

Trigger:
  • Training Loop
    • Events
      • Unit - A unit Dies
    • Conditions
      • (((Dying unit) is in FiendGroup) Equal to True) or (((Dying unit) is in GhoulGroup) Equal to True)
      • ((All units of FiendGroup are dead) Equal to True) and ((All units of GhoulGroup are dead) Equal to True)
      • ((Player 7 (Green) Current gold) Greater than or equal to 800) and ((Player 7 (Green) Current lumber) Greater than or equal to 400)
    • Actions
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0034 <gen> to train/upgrade to a Ghoul
      • Unit - Order Crypt 0036 <gen> to train/upgrade to a Crypt Fiend
      • Unit - Order Crypt 0036 <gen> to train/upgrade to a Crypt Fiend
      • Unit - Order Crypt 0036 <gen> to train/upgrade to a Crypt Fiend
      • Unit - Order Crypt 0036 <gen> to train/upgrade to a Crypt Fiend
      • Set GhoulGroup = (Units owned by Player 7 (Green) matching ((((Matching unit) is in Harvesters) Equal to False) and ((((Matching unit) is in Miners) Equal to False) and ((Unit-type of (Matching unit)) Equal to Ghoul))))
      • Set FiendGroup = (Units owned by Player 7 (Green) of type Crypt Fiend)
      • Trigger - Turn on The Actual Loop <gen>
      • Trigger - Run The Actual Loop <gen> (checking conditions)
      • Trigger - Turn off (This trigger)


Trigger:
  • The Actual Loop
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
      • (Training Loop <gen> is on) Equal to False
    • Actions
      • Trigger - Turn on Training Loop <gen>
      • Trigger - Run Training Loop <gen> (checking conditions)
      • Trigger - Turn off (This trigger)


And the attacking triggers, both the initial one and the loop:

Trigger:
  • Attacking
    • Events
      • Player - Player 10 (Light Blue) changes Alliance (non-aggression) settings
    • Conditions
      • (Owner of Town Hall 0046 <gen>) Equal to Player 4 (Purple)
    • Actions
      • Wait 20.00 seconds
      • Unit Group - Order FiendGroup to Attack-Move To (Position of Town Hall 0046 <gen>)
      • Unit Group - Order GhoulGroup to Attack-Move To (Position of Town Hall 0046 <gen>)
      • Trigger - Turn on Attacking Loop <gen>
      • Trigger - Run Attacking Loop <gen> (checking conditions)
      • Trigger - Turn off (This trigger)


Trigger:
  • Attacking Loop
    • Events
      • Time - Every 240.00 seconds of game time
    • Conditions
      • ((All units of FiendGroup are dead) Equal to False) and ((All units of GhoulGroup are dead) Equal to False)
    • Actions
      • Unit Group - Order GhoulGroup to Attack-Move To (Position of Town Hall 0046 <gen>)
      • Unit Group - Order FiendGroup to Attack-Move To (Position of Town Hall 0046 <gen>)


Note that since there's obviously a storyline attached to this map, while the enemy is supposed to begin producing an army immediately, he is not supposed to attack until 20 seconds after Player 4 (the player-controlled character) gains control of an allied base, represented by Player 10.

EDIT--A though just occurred to me when I was looking at all of the triggers: do I have to clear previous values for the UnitGroup variables before I reassign them to the respawns? It seems likely...but that still wouldn't prevent the initial spawns from happening, would it?
 

minikrampan

Ultra Cool Member
Reaction score
28
Just one question: Do you have enough food to create the units? farms etc..

Edit: Also, a building can only construct 7 units at the same time and you are creating like 12.
 

Izanagi

New Member
Reaction score
3
Yeah, I just figured it out. That was half of it, the second problem being that I had a major leak in the variables, since I had previously created "strike forces" for the player to encounter prior to entering the enemy town that included none other than Ghouls and Crypt Fiends, thus royally fouling up the variable parameters. Just made two different divisions (a.k.a. players) representing the same faction to fix it.

So the initial spawn trigger works, at least. Here's hoping the triggerwork for the loops works too...I may well be back.

And re the edit: I have two Crypts going at once, one for the Ghouls and the other for the Fiends. But yeah, I realized that I can't create more than 7 Ghouls from the one Crypt.
 

Izanagi

New Member
Reaction score
3
As I feared, I have to revive the thread.

So the initial training trigger works fine, no complaints there. My problem now is (surprise!)...the loops. They simply don't fire. I just checked them, giving the player character the whosyourdaddy cheat and taking out the 7 Ghouls and 4 Crypt Fiends that--nominally, at least--make up the GhoulGroup and FiendGroup unit groups. Under the terms of the looped trigger that I made, this *should* mean that as soon as the last member of either FiendGroup or GhoulGroup goes down, assuming that the enemy has at least 800 gold and 400 lumber (he does), the Crypts will immediately kick into action and start re-training Ghouls and Fiends, adding them back to GhoulGroup and FiendGroup as they're finished. None of this is happening.

So I can think of two possible problems here. Either the initial batch of Ghouls and Fiends simply weren't added to their respective groups, thus preventing the firing of the looped trigger at all, or there's some sort of variable leak that's preventing the Ghouls and Fiends from being re-trained because I'm also asking the game to add them back to GhoulGroup and FiendGroup.

Thoughts? Better yet, help?

-Iz
(side note: all the triggers are included in a previous post. I can re-post them for convenience's sake if necessary.)
 

Izanagi

New Member
Reaction score
3
Moving this UP, as I'd very much like to get it resolved, and some tinkering with the triggers hasn't helped.
 

Izanagi

New Member
Reaction score
3
Argh...giving this one last move UP in the hopes that there's some kindhearted soul out there. I'd love to know if the variables are leaking, aren't being assigned at all, or whatnot. Please? I had high hopes for this campaign...I'd hate to see it crash and burn right out of the gate (and yeah, there's +rep and all that for anyone who can help. Just throwing it out there).
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top