Trigger Error

Mind

New Member
Reaction score
7
What is wrong with this trigger?

Code:
Major Forces Self Defense
    Events
        Unit - A unit Is attacked
    Conditions
        (((Owner of (Triggering unit)) slot status) Not equal to Is playing) or (((Owner of (Triggering unit)) controller) Not equal to User)
    Actions
        Player - Make (Owner of (Triggering unit)) treat (Owner of (Attacking unit)) as an Enemy
        Player - Make (Owner of (Attacking unit)) treat (Owner of (Triggering unit)) as an Enemy
        If ((((Triggering unit) is A structure) Equal to True) and ((Owner of (Triggering unit)) Equal to CitysDefenses)) then do (Unit Group - Pick every unit in CityDefensesUnitGroup and do (Unit - Order (Picked unit) to Attack (Attacking unit))) else do (Do nothing)
        If ((((Triggering unit) is A structure) Equal to True) and ((Owner of (Triggering unit)) Equal to Insurgents)) then do (Unit Group - Pick every unit in InsurgentsUnitGroup and do (Unit - Order (Picked unit) to Attack (Attacking unit))) else do (Do nothing)
        If ((((Triggering unit) is A structure) Equal to True) and ((Owner of (Triggering unit)) Equal to UndeadScourge)) then do (Unit Group - Pick every unit in UndeadScourgeUnitGroup and do (Unit - Order (Picked unit) to Attack (Attacking unit))) else do (Do nothing)
        Trigger - Turn off (This trigger)
        Wait 20.00 seconds
        Trigger - Turn on (This trigger)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
It isn't working?


Here's a couple random thoughts:
  • "A unit is attacked" happens way too often.
  • The alliance never switches back to what it was before.
  • If "attacking unit" is dead or invulnerable before the "reinforcements" are sent, they will never arrive...
  • Always wait for "game" seconds (or so they say)
  • Can't you test for "controller = computer"?
  • Is "triggering unit" = "attacked unit"?
  • Use multi-line "if then"s :)
  • Could it happen that the CityDefenses suddenly start attacking the Undead?


HTH
AceHart
 

Mind

New Member
Reaction score
7
[*]"A unit is attacked" happens way too often.


The trigger has a cooldown of 20 seconds.

[*]The alliance never switches back to what it was before.


It is not supposed to.

[*]If "attacking unit" is dead or invulnerable before the "reinforcements" are sent, they will never arrive...


Sounds interesting… What do you suppose I do? Use the "Move" command instead?

[*]Can't you test for "controller = computer"?


What do you mean?

[*]Is "triggering unit" = "attacked unit"?


Precisely.

[*]Use multi-line "if then"s :)


There was only 1 trigger action.

[*]Could it happen that the CityDefenses suddenly start attacking the Undead?


They are supposed to.

Notice: The trigger is evaluated correctly, but only partially executed; The unit group doesn't attack the attacked unit.
 

XXXconanXXX

Cocktails anyone?
Reaction score
284
quote:
--------------------------------------------------------------------------------
[*]If "attacking unit" is dead or invulnerable before the "reinforcements" are sent, they will never arrive...
--------------------------------------------------------------------------------



Sounds interesting… What do you suppose I do? Use the "Move" command instead?

You can stop thsi by setting the unit into a variable so it won't interfere. That's what I did for one of my spells to cancel it out when the hero casted another ability while the skill was taking place.
 

Mind

New Member
Reaction score
7
Is this trigger action sufficient enough?

Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        ((Triggering unit) is A structure) Equal to True
    Then - Actions
        If ((Owner of (Attacked unit)) Equal to CitysDefenses) then do (Unit Group - Pick every unit in CityDefensesUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To (Position of (Attacking unit)))) else do (Do nothing)
        If ((Owner of (Attacked unit)) Equal to Insurgents) then do (Unit Group - Pick every unit in InsurgentsUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To (Position of (Attacking unit)))) else do (Do nothing)
        If ((Owner of (Attacked unit)) Equal to UndeadScourge) then do (Unit Group - Pick every unit in UndeadScourgeUnitGroup and do (Unit - Order (Picked unit) to Attack-Move To (Position of (Attacking unit)))) else do (Do nothing)
    Else - Actions
 

XXXconanXXX

Cocktails anyone?
Reaction score
284
Wait, your structures can move? The condition is triggered to structures only. Unless, of course I'm missing something.
 

XXXconanXXX

Cocktails anyone?
Reaction score
284
Yes but it sais to order the attacked unit to move to the position of the attacking unit. SO it would order the structure which is attacked to mvoe to the position of the attacked unit.
 

XXXconanXXX

Cocktails anyone?
Reaction score
284
O wait, I missed that, it orders every single unit to attack move to the position of the attacking unit when the structure is hit. Whoops looked at that wrong. I don't see anything wrong with it. Your first trigger on the first psot looked a little odd though.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
May I suggest to change "Position of (Attacking unit)" to
"Position of (Attacked unit)"?
Cosmetics, mostly. But looks "cleaner" to me ;)

Positional attack is definetly better.
When you attack something by hand (select unit/s, attack, click on target),
and, unfortunately, said target is invulnerable,
you'll get something like "Sorry, can't do that"...
Well, for comps this means that the order will simply be ignored!
Attack-move to "there" looks much better, indeed.

Testing only once for "is a structure" is a good idea too...
It won't help gameplay, but it helps me for reading this :)


Well, and? Still not working?




[*]"A unit is attacked" happens way too often.

I have several towers that do this in my TD, and it doesn't seem to cause any problems or lag.

Interesting. Good to know :)


Yours
AceHart
 

Mind

New Member
Reaction score
7
It hasn't changed much…

Code:
Major Forces Self Defense
    Events
        Unit - A unit Is attacked
    Conditions
        ((Owner of (Triggering unit)) Equal to CitysDefenses) or (((Owner of (Triggering unit)) Equal to Insurgents) or ((Owner of (Triggering unit)) Equal to UndeadScourge))
        (((Owner of (Triggering unit)) slot status) Not equal to Is playing) or (((Owner of (Triggering unit)) controller) Not equal to User)
    Actions
        Player - Make (Owner of (Triggering unit)) treat (Owner of (Attacking unit)) as an Enemy
        Player - Make (Owner of (Attacking unit)) treat (Owner of (Triggering unit)) as an Enemy
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Attacked unit) is A structure) Equal to True
            Then - Actions
                If ((Owner of (Attacked unit)) Equal to Insurgents) then do (Unit Group - Pick every unit in InsurgentsUnitGroup and do (Unit - Order (Picked unit) to Attack (Attacking unit))) else do (Do nothing)
                If ((Owner of (Attacked unit)) Equal to CitysDefenses) then do (Unit Group - Pick every unit in CityDefensesUnitGroup and do (Unit - Order (Picked unit) to Attack (Attacking unit))) else do (Do nothing)
                If ((Owner of (Attacked unit)) Equal to UndeadScourge) then do (Unit Group - Pick every unit in UndeadScourgeUnitGroup and do (Unit - Order (Picked unit) to Attack (Attacking unit))) else do (Do nothing)
                Trigger - Turn off (This trigger)
                Wait 20.00 seconds
                Trigger - Turn on (This trigger)
            Else - Actions
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Well, it still says "attack (attacking unit)"...

What exactly is happening?
They don't come at all?
Only half of them ?
Half way only then they turn back?
They come but don't attack?
They come, attack once then return?

You do, of course, have shared vision with them to see this?


Yours
AceHart
 

Mind

New Member
Reaction score
7
They eventually stop hunting the unit which attempted to demolish one of their structures.

I've found why they did; The base of the owner of the attacked unit was attacked by another foe while the unit who attacked the structure, who I controlled, fled.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top