• 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.

Rotate effects around point

Status
Not open for further replies.
Level 28
Joined
Jan 26, 2007
Messages
4,789
You should use dummy units instead of special effects.
Dummy units should cost no food, have no vision, pathing type set to "flying", have the ability "locust" and maybe other stuff I'm forgetting.

Since you can easily change a unit's position and/or flying height, you can do what you requested.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
and maybe other stuff I'm forgetting.

death type - does not raise, does not decay so the unit will not leak when removed

Yes, you can just periodically move the unit around the target point using PolarProjection, if you cant make your own, there is function PolarProjectionBJ takes location source, real dist, real angle returns location

and you can call it periodically changing the angle.

So for instance if you want to rotate "effect"(unit in this case) around other unit in 800 distance over 1 second around 360 degrees, you can split it to 0.05 seconds periodic loop and changing the angle by (360 * remainingTime), and increase remainingTime every 0.05 seconds for 0.05 until its 1, then destroy it.

To move the unit you could use
JASS:
    location yourUnitLoc = GetUnitLoc(the unit we want to spin around) //this can be done in GUI if you are doing it, there for sure is command for that
    call SetUnitX(yourdummy, GetLocationX(PolarProjectionBJ(yourUnitLoc, 800/*distance*/, remainingAngle)))
//the same for Y
    set ramainingAngle = remainingAngle + 0.05

dont forget to perform the check for 1.00

I recommend using SetUnitX/Y even if you are using GUI because it will not interupt the units order.

If you are using GUI, you will have to use either global variables or hashtable to make it MUI, hope you know how to do that

Also using PolarProjectionBJ as I did is not recommended, that will leak, you should set it to some location and then call at the end of the trigger RemoveLocation(yourUnitLoc) and also RemoveLocation(yourPolarProjection)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
@edo
Since you're using JASS, why not get rid of those red text BJ function ?

If not, just stick to GUI function (which basically the same, BJ function).

This is what I meant about;
JASS:
call SetUnitX(dummy, GetUnitX(originUnit) + offset * Cos(angle * bj_DEGTORAD))
call SetUnitY(dummy, GetUnitY(originUnit) + offset * Sin(angle * bj_DEGTORAD))

I know it looks more a bit code compared to PolarProjection, by using this function, it handles only coordinates (real) instead of locations, this is why in the first place why you should use JASS, else stick to GUI.
 
Status
Not open for further replies.
Top