• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to create units by trigger moving away from another unit

Status
Not open for further replies.
Level 2
Joined
Mar 1, 2020
Messages
7
Hey,

I'm trying to basically create a system where when a player builds a town hall, it creates 4 circles of power. When the player upgrades those circle of power to a new building, it creates 4-5 new buildings automatically. That part i've done no big deal.

What I need to be able to do is create another circle of power, that takes the location of the existing town hall into account, and moves the newly generated circle of power in an arc / angle away from it. How would I go about doing that?
 

Attachments

  • Capture.PNG
    Capture.PNG
    865.4 KB · Views: 31
  • Capture1.PNG
    Capture1.PNG
    23.2 KB · Views: 34
Level 2
Joined
Mar 1, 2020
Messages
7
The issue is making a trigger that determines where the the circle should spawn. I'm trying to have the newly spawned circle move further away from the original triggering unit. Think of the town hall as 0,0 in the image. I want the new circle to spawn further away from the town hall, in the opposite direction from 0,0 if that makes any sense.

The problem i'm having is that currently the trigger spawns a new circle of power anywhere, right back up against the old one or TH for example.
 
Level 5
Joined
Jul 12, 2016
Messages
59
You could solve this with custom unit values.

When you spawn the initial 4 Circles of Power around your Town Hall, set the custom value of each Circle of Power to 0, 90, 180 and 270 (0 for the east one, 90 for north, 180 for west, 270 for south). You set a unit's custom value with the action Unit - Set custom value.

To your upgrade trigger, change it so that the new Circle of Power is spawned at "Point with Polar Offset" using "Position of Triggering unit offset by 256 towards (Real((Custom value of (Triggering Unit))) degrees. Should look like this:
  • Unit - Create 1 Circle of Power for Player 1 (Red) at ((Position of (Triggering unit)) offset by 256.00 towards (Real((Custom value of (Triggering unit)))) degrees.) facing Default building facing degrees
If you wanna keep expanding the same way, just save the custom value of the new circle of power to be the same as the old one.

You could also solve it with custom variables in a cleaner way, but since you initial trigger didn't include any custom variables, I wasn't sure how familiar you are with them. I'd recommend checking them out if you haven't already, they really open up a whole new world of possibilities.
 
Level 2
Joined
Mar 1, 2020
Messages
7
Drunken - You're post was super helpful and gave me the results that I wanted. I'm going to go back in at a later date and utilize variables to completely redesign the triggers but for the moment I think I have a functional system. Many thanks
 
Status
Not open for further replies.
Top