• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

offsetting on the unit's side?

Status
Not open for further replies.
Level 8
Joined
Jan 8, 2010
Messages
493
i know about the function Point with Polar Offset, what i don't know is how do you use that to place a unit (for example) on a unit's side. and by side, i mean left and right, not just beside a unit.

for a example, if a unit faces north, then the units will be placed on the unit's east and west, and if it faces NE, then the units are placed on the unit's NW and SE. any idea how? :eek:
 
Level 18
Joined
Feb 28, 2009
Messages
1,970
As you see in triggers below the key is in the angle.
  • Actions
    • Set point[1] = (Position of (Triggering unit))
    • Set point[2] = (point[1] offset by 150.00 towards 0.00 degrees)
    • Set point[3] = (point[1] offset by 150.00 towards 90.00 degrees)
    • Set point[4] = (point[1] offset by 150.00 towards 180.00 degrees)
    • Set point[5] = (point[1] offset by 150.00 towards 270.00 degrees)
    • For each (Integer A) from 1 to 5, do (Actions)
      • Loop - Actions
        • Special Effect - Create a special effect at point[(Integer A)] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
        • Special Effect - Destroy (Last created special effect)
        • Custom script: call RemoveLocation (udg_point[GetForLoopIndexA()])
This one will create Sfx on left/right/before/behind some unit.
  • Actions
    • Set real = (Facing of (Triggering unit))
    • Set point[1] = (Position of (Triggering unit))
    • Set point[2] = (point[1] offset by 150.00 towards real degrees)
    • Set point[3] = (point[1] offset by 150.00 towards (real + 90.00) degrees)
    • Set point[4] = (point[1] offset by 150.00 towards (real + 180.00) degrees)
    • Set point[5] = (point[1] offset by 150.00 towards (real + 270.00) degrees)
    • For each (Integer A) from 1 to 5, do (Actions)
      • Loop - Actions
        • Special Effect - Create a special effect at point[(Integer A)] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
        • Special Effect - Destroy (Last created special effect)
        • Custom script: call RemoveLocation (udg_point[GetForLoopIndexA()])
And in this one the sfx location will depend on the facing of the unit. (This is what you wanted)
(It`s not good because the math (angles) should be done in a loop but it is for an example)
 
Last edited:
  • Set Points[1] = (Position of (Triggering unit))
  • For each (IntegerA) from 1 to 2, do (Actions)
    • Loop - Actions
      • Set Points[2] = (Points[1] offset by 256.00 towards ((450.00-(Facing of (Triggering unit)) / (Real(IntegerA)))
      • Custom script: call RemoveLocation (udg_Points[2])
  • Custom script: call RemoveLocation (udg_Points[1])
Edit: Wait, I made a mistake. Hold on.
 
Level 8
Joined
Jan 8, 2010
Messages
493
won't the triggers bug in any way? i dunno how, i just checked something with the angle-ing of WC and found out angles above a certain point are 0 to 180 (right to left) and below are -180 to 0 (left to right), that's why i can't come up with a proper equation if the unit faces like near 360. it seems to be a problem if the unit is facing 300 since 300+90=390, which is more than 360.

but i'll try the triggers.

@Pharaoh: why 450? :eek:
 
Level 8
Joined
Jan 8, 2010
Messages
493
ahh, i see. your triggers worked. and i found out why my previous triggers were messing up, just because i tried to make it that when it hits 360 it will be like 0-180 again (because of the dumb check i made), so i tried subtracting 90 from the facing, or dumb equations. :/

and yeah, i understood about what you said about the angles be done in a loop. that was what i always do. thanks! :]
 
Status
Not open for further replies.
Top