• 🏆 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!

Set animation speed of attached specialeffect

Status
Not open for further replies.
Level 17
Joined
Mar 21, 2011
Messages
1,597
Hello guys,

I was playing around with the "new" special effect natives

JASS:
call BlzSetSpecialEffectTimeScale(effect e, real r)
This line of code basically sets the animation speed of the special effect, or at least it should.


It works perfectly fine for effects created with
JASS:
native AddSpecialEffect takes string modelName, real x, real y returns effect

but not for special effects attached to a unit
JASS:
native AddSpecialEffectTarget takes string modelName, widget targetWidget, string attachPointName returns effect

is there a workaround for this? Maybe i did something wrong

Thanks in advance
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
If you were using it on a dummy unit, the only workaround
I could think of is to preset the special effect model via OE
particularly in the unit's model path/file + SetUnitTimeScale()

Although, it would be better if the developers managed to get
rid of this limitation and enable us to manipulate them despite of it.
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
I could create a dummy special effect at the location, read its z coordinate and transfer it to my special effect.
There is also GetLocationZ, but is there a way to read a z coordinate at a certain point without creating a location?
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
There is also GetLocationZ, but is there a way to read a z coordinate at a certain point without creating a location?
Yes, if you're about to create it on a predetermined location just hover the mouse on that location and X,Y,Z values will show up in the bottom corner of the editor interface. In this way, you may read the coordinates of a certain location without the need of defining a location in-game. However, is there a reason why you're avoiding it?
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
Its not predetermined.
I could also just create a new effect, because its automatically setting the z value to the terrain z value.
Its a periodic trigger, i'd rather use a real value than creating a location. Its also for many units simultaneously
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
Its a periodic trigger, i'd rather use a real value than creating a location. Its also for many units simultaneously
Creating a unit or effect is much more convoluted than creating a location obviously.
If you're avoiding to create a location per period then initialize it once as global.
Then use MoveLocation() instead. In this way, only one location is created just to check the coordinate.

EDIT:

Or use this library:

JASS:
library GetTerrainHeight /* not required to import if you already have GetTerrainZ(X,Y) function in your map
********************************************************************
*    function GetTerrainZ takes real X, real Y returns real        *
********************************************************************/

    globals
        private constant location Terrain = Location(0,0)
    endglobals

    function GetTerrainZ takes real X, real Y returns real
        call MoveLocation(Terrain,X,Y)
        return GetLocationZ(Terrain)
    endfunction

endlibrary
Yeah, I personally use this on my resources. ;)
Otherwise, I don't think there are cheaper options remaining than this.
 
Last edited:
Status
Not open for further replies.
Top