• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] Dark portal spell

Status
Not open for further replies.
I have a spell that's supposed to work like a waygate kinda.

What's supposed to happen:

The unit casts a portal at a target location
The unit enters the portal
The unit is teleported to a random location on the map

What I've tried:
classifying the portal as a summoned unit, moving a region under the portal when the spell is cast, and teleporting the unit when the unit enters the region

adding load/unload to the portal

neither of them are working and idk what I'm doing wrong. When I tried the first one, the region didn't even move under the portal. Any thoughts?
 
Last edited:
Kzuvudd.png

fjNA2d1.png


I couldn't even get the portal to show the load/unload abilities after I added them to it, so it's not a problem with the trigger there
 
Level 25
Joined
Sep 26, 2009
Messages
2,382
The "portal movement" trigger will not work for you, because it is not dynamic.
What I meant by this is that the trigger is registered only upon map initialization and is never updated. So if upon map initialization the Region 008 <gen> is at coordinates [20,20], the trigger will always fire when you enter those coordinates.
When you move Region 008, the trigger does not register that, so it does not update the coordinates from which it fires.
 
The "portal movement" trigger will not work for you, because it is not dynamic.
What I meant by this is that the trigger is registered only upon map initialization and is never updated. So if upon map initialization the Region 008 <gen> is at coordinates [20,20], the trigger will always fire when you enter those coordinates.
When you move Region 008, the trigger does not register that, so it does not update the coordinates from which it fires.

I tried it with converting the unit location of the portal to a region too and only using one trigger, but that didn't work either



You should read up on some tutorials on how to properly make triggers MUI. Having these workarounds can be annoying at times, even if you don't publish them.

What's MUI?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
How I would do it is create a new trigger on every summon.
Then add the event "A unit comes in x range of (summoned unit)"
Then add the action to it (as condition ofc) that will move the unit to a random point.

I think that you do not really have to recycle your trigger if this will only be used once every 30-60 seconds.
So in that case, you can just remove that event from your second trigger and add the event "A unit comes in x range of (summoned unit)" at the end of the first trigger.
You wont even need the region.
 
How I would do it is create a new trigger on every summon.
Then add the event "A unit comes in x range of (summoned unit)"
Then add the action to it (as condition ofc) that will move the unit to a random point.

I think that you do not really have to recycle your trigger if this will only be used once every 30-60 seconds.
So in that case, you can just remove that event from your second trigger and add the event "A unit comes in x range of (summoned unit)" at the end of the first trigger.
You wont even need the region.

I almost get you, but not quite. Can you do a pseudocode thing or something like that?
 
  • Portal
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Dark Portal
    • Actions
      • Trigger - Add to Portal Movement <gen> the event (Unit - A unit comes within 256.00 of (Summoned unit))

o now I getcha
gonna try it
thanks :>

EDIT: I used Unit Enters Region instead of Unit Within Range, but it worked! Thanks a bunch!
 
The unit enters region is pretty bad because that one will remain after the unit is gone.
With this one, the event still remains but as the unit is gone, noone can get "in range" with it.

Changed it. Thanks :>
I do have another problem though and I'm not sure how to fix it.
In the movement trigger, I made it so that if the unit that enters isn't one owned by Brown (Brown controls the unit with the dark portal spell), it damages them for 25hp. I also have a trigger that adds 1 gold and 1 lumber to a player's resources when they kill another player. However, since the portal's damage is dealt through a trigger, the death trigger doesn't know who to give the gold and lumber to. Is there any way to check if the portal kills the unit it damages?
 
Level 25
Joined
Sep 26, 2009
Messages
2,382
The GUI action for damaging unit is this:
  • Unit - Cause SOURCE to damage TARGET, dealing AMOUNT damage of attack type AttType and damage type DmgType
Set your portal unit as the source. If you can have only one portal in the game at a time, you can save the portal into variable and refer to it in this action through that variable.

When unit dies, you can check who the killing unit is via this condition:
  • (Unit-type of (Killing unit)) Equal to Portal_unit
 
Status
Not open for further replies.
Top