Help with the portal

Level 12
Joined
Aug 3, 2021
Messages
437
Hello it's Pekisa7. I've recently viewed a thread how to create a portal. So I implemented those triggers into my map so that demons on my map can teleport to the player's undead base. But it doesn't seem to work. Can someone help me to fix this issue? Best regards for Pekisa7. Here are the triggers:
  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Casting unit) Equal to Terrordar 2251 <gen>
      • (Ability being cast) Equal to Portal (Terrordar)
    • Actions
      • Set Point01[1] = (Position of Terrordar 2251 <gen>)
      • Set Point02[2] = (Target point of ability being cast)
      • Set Point03[3] = (Point01[1] offset by 250.00 towards (Angle from Point01[1] to Point02[2]) degrees)
      • Unit - Create 1 Portal for Player 7 (Green) at Point02[2] facing (Angle from Point02[2] to Point01[1]) degrees
      • Unit - Make (Last created unit) Invulnerable
      • Unit - Grant shared vision of (Last created unit) to Player 7 (Green)
      • Unit - Add Waygate ability to (Last created unit)
      • Neutral Building - Set (Last created unit) destination to Point01[1]
      • Neutral Building - Enable (Last created unit)
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
      • Unit - Create 1 Portal for Player 7 (Green) at Point03[3] facing (Angle from Point01[1] to Point02[2]) degrees
      • Unit - Make (Last created unit) Invulnerable
      • Unit - Grant shared vision of (Last created unit) to Player 7 (Green)
      • Unit - Add Waygate ability to (Last created unit)
      • Neutral Building - Set (Last created unit) destination to Point02[2]
      • Neutral Building - Enable (Last created unit)
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
 
what doesn't work?

Also, it seems kind of redundant to have Point01 as array with index [1], Point02 with index [2], etc.
It should either be Point01, Point02, ... (i.e. multiple non-array variables); or Point[1], Point[2], Point[3] (i.e. a single array variable).
Not that that would resolve your issue, but it makes it hard to read :D
 
what doesn't work?

Also, it seems kind of redundant to have Point01 as array with index [1], Point02 with index [2], etc.
It should either be Point01, Point02, ... (i.e. multiple non-array variables); or Point[1], Point[2], Point[3] (i.e. a single array variable).
Not that that would resolve your issue, but it makes it hard to read :D
Thank you I will try it. If it dosen't still work I will let you know. :)

what doesn't work?

Also, it seems kind of redundant to have Point01 as array with index [1], Point02 with index [2], etc.
It should either be Point01, Point02, ... (i.e. multiple non-array variables); or Point[1], Point[2], Point[3] (i.e. a single array variable).
Not that that would resolve your issue, but it makes it hard to read :D
Hello The Portal spell dosen't work. The demon dosen't open it when he is about to attack.
 
Nothing in your trigger has to do with attacking. What do you mean by that?
Well I wanted the demon to open the portal when begining to attack so that player green units teleport to the players undead base and start attacking it. I guess my triggers ain't right . Can somone help with this?
 
I tried to create similar trigger - I created a portal via trigger, gave it the waygate ability and set where it should teleport units. Other units were able to use that portal to teleport somewhere else. So the actions in your trigger should work.
Why I asked what is not working is specifically so that you provide more detail.
In your case:
Hello The Portal spell dosen't work. The demon dosen't open it when he is about to attack.
if the portal unit is not created at all, then that means the trigger does not run at all. To be sure, you could add a debug message using the "Game - Display text" action, so that you can see in log if the trigger started or not.

Well I wanted the demon to open the portal when begining to attack
There is a "unit is attacked" event which could be used to detect when demon is attacked/attacks someone else. Then you could order the demon to cast the portal ability.
 
I tried to create similar trigger - I created a portal via trigger, gave it the waygate ability and set where it should teleport units. Other units were able to use that portal to teleport somewhere else. So the actions in your trigger should work.
Why I asked what is not working is specifically so that you provide more detail.
In your case:

if the portal unit is not created at all, then that means the trigger does not run at all. To be sure, you could add a debug message using the "Game - Display text" action, so that you can see in log if the trigger started or not.


There is a "unit is attacked" event which could be used to detect when demon is attacked/attacks someone else. Then you could order the demon to cast the portal ability.
Triggers?
 
something along these lines:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Attacked unit) Equal to Your_demon_unit
          • (Attacking unit) Equal to Your_demon_unit
    • Actions
      • -------- Turn trigger off to prevent this firing multiple times per second --------
      • Trigger - Turn off (This trigger)
      • Unit - Order Your_demon_unit to portal_spells_order at some_location
      • -------- Optionally turn the trigger back on after some time: --------
      • Wait 60.00 seconds
      • Trigger - Turn on (This trigger)
 
something along these lines:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Attacked unit) Equal to Your_demon_unit
          • (Attacking unit) Equal to Your_demon_unit
    • Actions
      • -------- Turn trigger off to prevent this firing multiple times per second --------
      • Trigger - Turn off (This trigger)
      • Unit - Order Your_demon_unit to portal_spells_order at some_location
      • -------- Optionally turn the trigger back on after some time: --------
      • Wait 60.00 seconds
      • Trigger - Turn on (This trigger)
I wanted when the AI activates the demon player to open a portal then go trough the portal and attack the undead player are these triggers okay or do they need change?
  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Casting unit) Equal to Terrordar 2251 <gen>
      • (Ability being cast) Equal to Portal (Terrordar)
    • Actions
      • Set Point01 = (Position of Terrordar 2251 <gen>)
      • Set Point02 = (Target point of ability being cast)
      • Set Point03 = (Point01 offset by 250.00 towards (Angle from Point01 to Point02) degrees)
      • Unit - Create 1 Portal for Player 7 (Green) at Point02 facing (Angle from Point02 to Point01) degrees
      • Unit - Make (Last created unit) Invulnerable
      • Unit - Grant shared vision of (Last created unit) to Player 7 (Green)
      • Unit - Add Waygate ability to (Last created unit)
      • Neutral Building - Set (Last created unit) destination to Point01
      • Neutral Building - Enable (Last created unit)
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
      • Unit - Create 1 Portal for Player 7 (Green) at Point03 facing (Angle from Point01 to Point02) degrees
      • Unit - Make (Last created unit) Invulnerable
      • Unit - Grant shared vision of (Last created unit) to Player 7 (Green)
      • Unit - Add Waygate ability to (Last created unit)
      • Neutral Building - Set (Last created unit) destination to Point02
      • Neutral Building - Enable (Last created unit)
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
  • Spell 02
    • Events
      • Unit - Terrordar 2251 <gen> Is attacked
    • Conditions
      • (Attacking unit) Equal to Terrordar 2251 <gen>
      • (Owner of (Attacking unit)) Equal to Player 7 (Green)
    • Actions
      • Trigger - Turn off Spell 02 <gen>
      • Wait 5.00 seconds
      • Trigger - Run Spell <gen> (checking conditions)
      • Wait 5.00 seconds
      • Trigger - Turn off Spell <gen>
 
No, they are not ok.

First of all, this:
  • Spell 02
    • Events
      • Unit - Terrordar 2251 <gen> Is attacked
    • Conditions
      • (Attacking unit) Equal to Terrordar 2251 <gen>
      • (Owner of (Attacking unit)) Equal to Player 7 (Green)
    • Actions
      • Trigger - Turn off Spell 02 <gen>
      • Wait 5.00 seconds
      • Trigger - Run Spell <gen> (checking conditions)
      • Wait 5.00 seconds
      • Trigger - Turn off Spell <gen>
This will not work correctly. You are basically saying that the "Spell 02" trigger should execute actions of "Spell" trigger, while also checking conditions of "Spell" trigger.
Well, when you start it like that, then there is no casting unit, nor any ability being cast. So those conditions will never pass.
But even if you ignore those conditions, there is no "(Target point of ability being cast)" when started the way you did it.
If you want this to work, you will need to issue an order to the demon to cast the portal spell.

I wanted when the AI activates the demon player to open a portal then go trough the portal and attack the undead
If you have a trigger for AI which "activates the demon", then that's the place where you should issue the demon to cast the portal. In that case the "Spell 02" trigger has no meaning anymore and can be deleted.
 
No, they are not ok.

First of all, this:

This will not work correctly. You are basically saying that the "Spell 02" trigger should execute actions of "Spell" trigger, while also checking conditions of "Spell" trigger.
Well, when you start it like that, then there is no casting unit, nor any ability being cast. So those conditions will never pass.
But even if you ignore those conditions, there is no "(Target point of ability being cast)" when started the way you did it.
If you want this to work, you will need to issue an order to the demon to cast the portal spell.


If you have a trigger for AI which "activates the demon", then that's the place where you should issue the demon to cast the portal. In that case the "Spell 02" trigger has no meaning anymore and can be deleted.
So I put it in here?
  • AI
    • Events
      • Unit - A unit enters ForceWallDiscovered <gen>
    • Conditions
      • (Entering unit) Equal to Arthas_TheLichKing
      • (Owner of (Entering unit)) Equal to Player 4 (Purple)
    • Actions
      • -------- Wheat AI --------
      • AI - Start campaign AI script for Player 17 (Wheat): HumanWheatAI.ai
      • AI - Ignore the guard positions of all Player 17 (Wheat) units
      • Player - Limit training of Commander Zolas to 1 for Player 17 (Wheat)
      • Player - Make Commander Zolas Available for training/construction by Player 17 (Wheat)
      • Unit - Order Altar of Kings (Wheat) 0313 <gen> to train/upgrade to a Commander Zolas
      • If ((Dying unit) Equal to Commander_Zolas) then do (Unit - Order Altar of Kings (Wheat) 0313 <gen> to Revive Hero Commander_Zolas) else do (Do nothing)
      • Visibility - Create an initially Enabled visibility modifier for Player 17 (Wheat) emitting Visibility across (Entire map)
      • -------- Brown AI --------
      • AI - Start campaign AI script for Player 12 (Brown): HumanBrownAI.ai
      • AI - Ignore the guard positions of all Player 12 (Brown) units
      • Player - Limit training of Commander Omadas to 1 for Player 12 (Brown)
      • Player - Make Commander Omadas Available for training/construction by Player 12 (Brown)
      • Unit - Order Altar of Kings (Brown) 0082 <gen> to train/upgrade to a Commander Omadas
      • If ((Dying unit) Equal to Commander_Omadas) then do (Unit - Order Altar of Kings (Brown) 0082 <gen> to Revive Hero Commander_Omadas) else do (Do nothing)
      • Visibility - Create an initially Enabled visibility modifier for Player 12 (Brown) emitting Visibility across (Entire map)
      • -------- Green AI --------
      • AI - Start campaign AI script for Player 7 (Green): DemonGreenAI.ai
      • AI - Ignore the guard positions of all Player 7 (Green) units
      • Player - Limit training of Uogonnash to 1 for Player 7 (Green)
      • Player - Limit training of Terrordar to 1 for Player 7 (Green)
      • Visibility - Create an initially Enabled visibility modifier for Player 7 (Green) emitting Visibility across (Entire map)
      • -------- Orange AI --------
      • AI - Start campaign AI script for Player 6 (Orange): OrcOrangeAI.ai
      • AI - Ignore the guard positions of all Player 6 (Orange) units
      • Player - Limit training of Far Seer to 1 for Player 6 (Orange)
      • Player - Limit training of Commander Gar'tak to 1 for Player 6 (Orange)
      • If ((Dying unit) Equal to Commander_Gartak) then do (Unit - Order Altar of Storms 0459 <gen> to Revive Hero Commander_Gartak) else do (Do nothing)
      • Visibility - Create an initially Enabled visibility modifier for Player 6 (Orange) emitting Visibility across (Entire map)
 
Triggers?
Triggers for what? I've already confirmed that the trigger you've posted is the likely place to order the demon to cast the portal spell.
If you don't know how to order it to cast spell, it's the "Unit - issue order targeting a point" action, i.e.:
  • Unit - Order Your_demon_unit to portal_spells_order at some_location
 
Triggers for what? I've already confirmed that the trigger you've posted is the likely place to order the demon to cast the portal spell.
If you don't know how to order it to cast spell, it's the "Unit - issue order targeting a point" action, i.e.:
  • Unit - Order Your_demon_unit to portal_spells_order at some_location
There is no portal spell in issue targeting a point.
 
Look at what ability Portal (Terrordar) is based on in the Object Editor, that'll have an Order associated with it.

There's a few rare cases where you'll have to rely on Custom Script to issue the Order instead.
Its based on Mass Teleport.
 
So check the Orders to see if there's one for Mass Teleport. (Hint: There is)
So I do it like this:
  • AI
    • Events
      • Unit - A unit enters ForceWallDiscovered <gen>
    • Conditions
      • (Entering unit) Equal to Arthas_TheLichKing
      • (Owner of (Entering unit)) Equal to Player 4 (Purple)
    • Actions
      • -------- Wheat AI --------
      • AI - Start campaign AI script for Player 17 (Wheat): HumanWheatAI.ai
      • AI - Ignore the guard positions of all Player 17 (Wheat) units
      • Player - Limit training of Commander Zolas to 1 for Player 17 (Wheat)
      • Player - Make Commander Zolas Available for training/construction by Player 17 (Wheat)
      • Unit - Order Altar of Kings (Wheat) 0313 <gen> to train/upgrade to a Commander Zolas
      • If ((Dying unit) Equal to Commander_Zolas) then do (Unit - Order Altar of Kings (Wheat) 0313 <gen> to Revive Hero Commander_Zolas) else do (Do nothing)
      • Visibility - Create an initially Enabled visibility modifier for Player 17 (Wheat) emitting Visibility across (Entire map)
      • -------- Brown AI --------
      • AI - Start campaign AI script for Player 12 (Brown): HumanBrownAI.ai
      • AI - Ignore the guard positions of all Player 12 (Brown) units
      • Player - Limit training of Commander Omadas to 1 for Player 12 (Brown)
      • Player - Make Commander Omadas Available for training/construction by Player 12 (Brown)
      • Unit - Order Altar of Kings (Brown) 0082 <gen> to train/upgrade to a Commander Omadas
      • If ((Dying unit) Equal to Commander_Omadas) then do (Unit - Order Altar of Kings (Brown) 0082 <gen> to Revive Hero Commander_Omadas) else do (Do nothing)
      • Visibility - Create an initially Enabled visibility modifier for Player 12 (Brown) emitting Visibility across (Entire map)
      • -------- Green AI --------
      • AI - Start campaign AI script for Player 7 (Green): DemonGreenAI.ai
      • AI - Ignore the guard positions of all Player 7 (Green) units
      • Player - Limit training of Uogonnash to 1 for Player 7 (Green)
      • Player - Limit training of Terrordar to 1 for Player 7 (Green)
      • Visibility - Create an initially Enabled visibility modifier for Player 7 (Green) emitting Visibility across (Entire map)
      • Unit - Order Terrordar 2251 <gen> to Human Archmage - Mass Teleport (Triggering unit)
      • -------- Orange AI --------
      • AI - Start campaign AI script for Player 6 (Orange): OrcOrangeAI.ai
      • AI - Ignore the guard positions of all Player 6 (Orange) units
      • Player - Limit training of Far Seer to 1 for Player 6 (Orange)
      • Player - Limit training of Commander Gar'tak to 1 for Player 6 (Orange)
      • If ((Dying unit) Equal to Commander_Gartak) then do (Unit - Order Altar of Storms 0459 <gen> to Revive Hero Commander_Gartak) else do (Do nothing)
      • Visibility - Create an initially Enabled visibility modifier for Player 6 (Orange) emitting Visibility across (Entire map)
 
Focusing only on what's important.

This is your Event. A unit entered some region in your map:
  • Unit - A unit enters ForceWallDiscovered <gen>
This is your Condition. We ask the question, was that unit Arthas the Lich King?
  • (Entering unit) Equal to Arthas_TheLichKing
This is your Action. If the unit was Arthas then order Terrodar to cast Mass Teleport on that unit:
  • Unit - Order Terrordar 2251 <gen> to Human Archmage - Mass Teleport (Triggering unit)
(Triggering unit) always refers to the unit in your Event. So in this case the (Triggering unit) refers to Arthas the Lich King. (Entering unit) would refer to Arthas as well.

Combine those together and you get some basic logic:

1. A unit enters ForceWallDiscovered.
2. It was Arthas the Lich King.
3. Terrordar casts Mass Teleport on Arthas the Lich King.
 
Last edited:
Focusing only on what's important.

This is your Event. A unit entered some region in your map:
  • Unit - A unit enters ForceWallDiscovered <gen>
This is your Condition. We ask the question, was that unit Arthas the Lich King?
  • (Entering unit) Equal to Arthas_TheLichKing
This is your Action. If the unit was Arthas then order Terrodar to cast Mass Teleport on that unit:
  • Unit - Order Terrordar 2251 <gen> to Human Archmage - Mass Teleport (Triggering unit)
(Triggering unit) always refers to the unit in your Event. So in this case the (Triggering unit) refers to Arthas the Lich King. (Entering unit) would refer to Arthas as well.

Combine those together and you get some basic logic:

1. A unit enters ForceWallDiscovered.
2. It was Arthas the Lich King.
3. Terrordar casts Mass Teleport on Arthas the Lich King.
I need Terrordar to open a portal then attack the undead player base not to teleport on Arthas.
 
Then Order him to Mass Teleport on the Undead Player's base.

But if you don't actually want to use the Mass Teleport ability then get rid of it and trigger everything from scratch.

For example, there's a "Move Unit" action for teleporting units anywhere you want. Then you could use Unit Group variables and the (Pick Every Unit) action to interact with multiple units at once. Then you could "Move" multiple units at once.

But it looks like your original trigger uses Waygates for teleporting units. You can always change the Events/Event Responses/Conditions/Actions in that trigger to get it working without the need of Mass Teleport. For example, how about making Terrordar create the Portal after 10.00 seconds of Elapsed Time. Then you can create the Portal at the Undead Player's start location instead of (Target point of ability being cast), or the center of a Region, or position it on a random Unit belonging to the Undead player.

 
Last edited:
Then Order him to Mass Teleport on the Undead Player's base.

But if you don't actually want to use the Mass Teleport ability then get rid of it and trigger everything from scratch.

For example, there's a "Move Unit" action for teleporting units anywhere you want. Then you could use Unit Group variables and the (Pick Every Unit) action to interact with multiple units at once. Then you could "Move" multiple units at once.

But it looks like your original trigger uses Waygates for teleporting units. You can always change the Events/Event Responses/Conditions/Actions in that trigger to get it working without the need of Mass Teleport. For example, how about making Terrordar create the Portal after 10.00 seconds of Elapsed Time. Then you can create the Portal at the Undead Player's start location instead of (Target point of ability being cast), or the center of a Region, or position it on a random Unit belonging to the Undead player.

I've started from scratch. How do I make every green AI attack wave they summon two portals to go trough them and attack the undead base?
 
Step 1. Learn how Waygates work. We're calling them Portals in this context but this concept in Warcraft 3 is called a Waygate. I'm sure you've used these many times before when actually playing the game.

Step 2. Learn how to create Waygates and redirect them using triggers. The very first trigger you posted shows how to do this. We've also discussed what you have to change about that trigger to make it work without the need of an ability like Mass Teleport.

Step 3. Now that you understand how Waygates work and how to create and use them, figure out a good time to do this. This is entirely up to you as the creator of the map. There are 100's of Events to choose from that let you control WHEN things happen. The easiest would be a Timer event assuming that you know exactly when the AI attack waves begin.

You have to learn how things work. This is done through trial and error and not some trigger that you can just copy and paste. Make a new map, create some Waygate triggers in it, and test the map over and over again until it works and makes sense.
 
Step 1. Learn how Waygates work. We're calling them Portals in this context but this concept in Warcraft 3 is called a Waygate. I'm sure you've used these many times before when actually playing the game.

Step 2. Learn how to create Waygates and redirect them using triggers. The very first trigger you posted shows how to do this. We've also discussed what you have to change about that trigger to make it work without the need of an ability like Mass Teleport.

Step 3. Now that you understand how Waygates work and how to create and use them, figure out a good time to do this. This is entirely up to you as the creator of the map. There are 100's of Events to choose from that let you control WHEN things happen. The easiest would be a Timer assuming that you know exactly when the AI attack waves begin.

You have to learn how things work. This is done through trial and error, make a new demo map, create some Waygate triggers in it, and keep testing the map until it makes sense.
I already know how waygates work. I just don't know how to create a portal.
  • Waygate Deactivates
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Unit-type of (Casting unit)) Equal to Way Gate
      • (Ability being cast) Equal to Waygate ability
    • Actions
      • Neutral Building - Disable (Casting unit)
  • Waygate Activate
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Unit-type of (Casting unit)) Equal to Way Gate
      • (Ability being cast) Equal to Waygate ability
    • Actions
      • Neutral Building - Enable (Casting unit)
 
A Waygate IS a Portal. So if you know how to create a Waygate then you know how to create a Portal. If you know how to use a Waygate then you know how to use a Portal.

I'm suggesting that you figure out how to do this before worrying about "AI Attack Waves" or anything like that. Just get some units to move through a Waygate (Portal) that you've created. Once that makes sense, the rest will be a lot easier to figure out.
 
A Waygate IS a Portal. So if you know how to create a Waygate then you know how to create a Portal. If you know how to use a Waygate then you know how to use a Portal.

I'm suggesting that you figure out how to do this before worrying about "AI Attack Waves" or anything like that. Just get some units to move through a Waygate (Portal) that you've created. Once that makes sense, the rest will be a lot easier to figure out.
Thanks guys for your help . I figured it out.
 
Back
Top