How do I make a trigger, which summons a creature, if a hero is NOT present in a region at a certain time?

Status
Not open for further replies.
Level 4
Joined
Nov 16, 2019
Messages
55
So I am making this fire elemental boss, where I have a phase, in which the boss makes 4 ritual circles. The goal is to have a trigger, that spawns a fire elemental in each circle if no hero stands in the circle by the end of the ritual. If a hero however stands in the circle by the point in time the ritual finishes, no elemental spawns.

I tried to make a trigger for it. Now, some of the trigger beneath the text right here, is not for the ritual circles (Everything down to the "pick unit" is part of the ritual circles thing):

1625247379547.png


As for the spawning of the elementals, here's the trigger (There's 4 'almost' identical ones in total):

1625247473900.png


When I've play-tested the thing, the elementals do spawn when no units are within the region. But they still spawn when a hero stands within the region though.
 
Level 21
Joined
Mar 16, 2008
Messages
955
Not sure I 100% understand but maybe this will help you:

1) I think a simple conditional 'if hero is in region' could be added to your "Summoning Circle 1" trigger
1625254785009.png

  • Conditions
    • ((Playable map area) contains (Triggering unit)) Equal to True

2) Also I think your pick every unit trigger may be leaking, not 100% sure. But you may just want to set those to a unit group variable then destroy that variable to be safe.
  • Actions
    • Set VariableSet Golraath_Unit_Group_Variable = (Units in (Golraath Portal) matching ((Unit-type of (Matching Unit)) Equal to Dummy Unit))
    • Custom script: call DestroyGroup(udg_Golraath_Unit_Group_Variable)
 
Level 4
Joined
Nov 16, 2019
Messages
55
Not sure I 100% understand but maybe this will help you:

1) I think a simple conditional 'if hero is in region' could be added to your "Summoning Circle 1" trigger
View attachment 382673
  • Conditions
    • ((Playable map area) contains (Triggering unit)) Equal to True

2) Also I think your pick every unit trigger may be leaking, not 100% sure. But you may just want to set those to a unit group variable then destroy that variable to be safe.
  • Actions
    • Set VariableSet Golraath_Unit_Group_Variable = (Units in (Golraath Portal) matching ((Unit-type of (Matching Unit)) Equal to Dummy Unit))
    • Custom script: call DestroyGroup(udg_Golraath_Unit_Group_Variable)

Tried that, it doesn't seem to work.
 
Level 21
Joined
Apr 12, 2018
Messages
494
So I am making this fire elemental boss, where I have a phase, in which the boss makes 4 ritual circles. The goal is to have a trigger, that spawns a fire elemental in each circle if no hero stands in the circle by the end of the ritual. If a hero however stands in the circle by the point in time the ritual finishes, no elemental spawns.

I tried to make a trigger for it. Now, some of the trigger beneath the text right here, is not for the ritual circles (Everything down to the "pick unit" is part of the ritual circles thing):

View attachment 382666

As for the spawning of the elementals, here's the trigger (There's 4 'almost' identical ones in total):

View attachment 382667

When I've play-tested the thing, the elementals do spawn when no units are within the region. But they still spawn when a hero stands within the region though.
That's because Unit Enters Region checks if something enters; it doesn't care if something is already there or leaves it.

If you want to have a behavior where none of the units in it can be a Hero that's a different kind of check entirely (need to make a Unit Group).

VERY Basic idea (don't copy this verbatim I'm doing this on the fly so you get an idea of what to do, it's obviously more involved than this):

Set Variable HeroPresent = False
Unit Group - Pick Every unit in (Summoning Circle) and do
.. If (picked unit) is a Hero Equals to True
....Then Do Set Variable HeroPresent = True
....Else (Do Nothing)

If (HeroPresent == False)
.. Then Do (summon unit)
 
Last edited:
Level 4
Joined
Nov 16, 2019
Messages
55
That's because Unit Enters Region checks if something enters; it doesn't care if something is already there or leaves it.

If you want to have a behavior where none of the units in it can be a Hero that's a different kind of check entirely.

Yea I realized that a couple of hours ago as I was puzzling with it. With the removal of the event I still stand with the same issue however, as I still need some form of function that allows a unit within the region to trigger (or well, prevent the trigger I guess).

Edit: Did not see your edit, gonna try and see if I can make something similar. As for the behavior, I just want to prevent the summoning of a fire elemental in the case that there is any hero within the region of which it is supposed to be summoned.

Edit 2: What kind of variable would this "HeroPresent" be?
 
Last edited:
Level 4
Joined
Nov 16, 2019
Messages
55
I mean you got to change the 'event response' to the right thing. So maybe change 'triggering unit' to 'picked unit.' Maybe set a point variable and say units within range of that unit.
As said before, I don't think the event is necessary. If the event is "A unit enters a region", then "triggering unit" works. As stated by @Razorclaw_X such an event, or even the "a unit comes within range" event, would require a unit to actually enter or come within range of the point/region/unit; not already standing within range or in the region.

That's because Unit Enters Region checks if something enters; it doesn't care if something is already there or leaves it.

If you want to have a behavior where none of the units in it can be a Hero that's a different kind of check entirely (need to make a Unit Group).

VERY Basic idea (don't copy this verbatim I'm doing this on the fly so you get an idea of what to do, it's obviously more involved than this):

Set Variable HeroPresent = False
Unit Group - Pick Every unit in (Summoning Circle) and do
.. If (picked unit) is a Hero Equals to True
....Then Do Set Variable HeroPresent = True
....Else (Do Nothing)

If (HeroPresent == False)
.. Then Do (summon unit)

I tried making a version of what you suggested. I am terrible with variables, so I did not know exactly what type of variable you suggested I'd make with the "HeroPresent" variable.

The trigger I made here, somehow works in the reverse way; whenever a hero unit stands inside the region by the end of the waiting time, a fire elemental spawns, while all the regions without any hero units within them do not spawn a fire elemental.

1625272783372.png


1625272810851.png

(I know there's the "create unit" in the last 'else' action too, but when I put "do nothing" there, it would be same result)

I'm suspecting it is probably the variables you suggested @Razorclaw_X that would do the final trick in this formula. So what type of variable would you make the HeroPresent variable as? :)
 
Level 21
Joined
Apr 12, 2018
Messages
494
Oh, I wrote that assuming it was a Boolean, but you can make it an Integer if you wanted. It's just a flag to tell the checking evaluation that one of the units is a Hero (which has to be set to False before you start checking so it will always do a fresh check). Your Unit Group trigger is meant only for that; the If-Then-Else (summoning the monster) part should not be in it.
 
Last edited:
Level 29
Joined
Sep 26, 2009
Messages
2,594
If you have regions, you can check number of units inside the region (similar to how you already do it in your trigger). Also, right now you pick every unit in the region - dead, alive, ally, enemy, neutral, etc.
Something like this should work:
  • Custom script: set bj_wantDestroyGroup = true
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in (Units in Your_Region matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Not equal to (Owner of Boss_unit))))) Less than 1
    • Then - Actions
      • -------- spawn fire elemental --------
    • Else - Actions
 
Status
Not open for further replies.
Top