• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Problems with a spell

Status
Not open for further replies.
Level 3
Joined
Oct 5, 2010
Messages
47
Hi everybody!
I want to make this great spell where my hero(The hero has 2 forms.) splits up and attacks with lots of eyecandy and stuff. That I could pretty much do by myself but I can´t seem to figure out how to make the dummy units spawn next to the casting unit facing the targeted unit. (Maybe a little too many units in this post, hehe.)

Sketch.jpg
 
Not sure of the pic, but this will create two units next to the caster, one to the left and one to the right.

  • Untitled Trigger 004
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set u1 = (Triggering unit)
      • Set p1 = (Position of u1)
      • Set r1 = (Facing of u1)
      • -------- --------------------------------------------------------------- --------
      • Set p2 = (p1 offset by 256.00 towards (r1 + 90.00) degrees) // Point with polar offset
      • Unit - Create 1 Footman for (Owner of u1) at p2 facing r1 degrees
      • Custom script: call RemoveLocation(udg_p2)
      • -------- --------------------------------------------------------------- --------
      • Set p2 = (p1 offset by 256.00 towards (r1 - 90.00) degrees)
      • Unit - Create 1 Footman for (Owner of u1) at p2 facing r1 degrees
      • Custom script: call RemoveLocation(udg_p2)
      • -------- --------------------------------------------------------------- --------
      • Custom script: call RemoveLocation(udg_p1)
 
Do you always want the unit to be spawned next to the Caster ?
Example:

Dummy1 Caster Dummy2

OR do you want it like Maker did ?
Everywhere you face, it will spawned at corresponding angle
Example:

Dummy1

Caster

Dummy2

I can't explain it in a better way, LOL...
Well, if you kinda need a test map for that, I can create for you...

EDIT:
I mean, if you use 1st question as answer, you would probably just set 1st unit to be spawned at 0.00 degrees and 2nd unit will be spawned at 180 degrees
That's just too not situational
Maker did, is situational
But I think you want Maker's because situational will make the game less boring eh ?
 
You do it using trigonometry (simple maths).

To get the angle you are after getting the position of the target with respects to where the dummy spawns (target - dummy positions) and passing the vector into the inverse tan function which takes 2 parameters (x and y) and it will return the correct angle in radians (convert to degrees for unit facing).

To get the position where to spawn the dummy units you can do it any number of ways. The easiest being spawning them + and - towards the perpendicular angle from the caster to the target.
 
Status
Not open for further replies.
Back
Top