Snippet Add Effect Z

Romek

Super Moderator
Reaction score
963
Add Effect Z
By Romek

Foreward:
I needed something like this in a spell I was making recently. I'm aware that there is something like this on wc3jass.com; in fact, this is based on that. However, this uses vJass' nice global blocks and libraries. So no nulling or bj_globals involved. :)

Feel free to take these out of the library, and put them into whatever you want. I also don't want or care about credit.

The non-location function is more efficient, so use that instead of the loc one when possible.

What does this do?
It allows users to create effects with a height (Z). :)

The Code:
JASS:
library EffectZ
//  _________________________________________
// +-----------------------------------------+
// |             E F F E C T   Z             |
// +-----------------------------------------+
// | - Feel free to take these out of this   |
// |   library and put them directly into    |
// |   your code.                            |
// | - I don't care about credit. I haven't  |
// |   even included my name here. :]        |
// +-----------------------------------------+
//  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    globals
        private destructable D
        private effect E
    endglobals

    function AddSpecialEffectZ takes string modelName, real x, real y, real z returns effect
        set D = CreateDestructableZ( 'OTip', x, y, z, 0., 1., 0)
        set E = AddSpecialEffect(modelName, x, y)
        call RemoveDestructable(D)
        return E
    endfunction
    
    function AddSpecialEffectLocZ takes string modelName, location where, real z returns effect
        set D = CreateDestructableZ( 'OTip', GetLocationX(where), GetLocationY(where), z, 0., 1., 0)
        set E = AddSpecialEffectLoc(modelName, where)
        call RemoveDestructable(D)
        return E
    endfunction

endlibrary


I don't think a demo map is needed.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> self-explanatory...

... is a big word. And any mod using it as only explanation should be shot.


Not to mention that something that "takes real z" probably also should do something with that z...
 

Jesus4Lyf

Good Idea™
Reaction score
397
Hey, you learn something every day! There's a "¯" character! Check it out! _¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_ MUHUHAHAHAHA....

I use dummy units for this. More versatile, and you have to create/remove an object here anyway. For example, here, you can't then change the height of the effect, or move it... So this has very limited use. Nonetheless, it serves a purpose, I suppose.
 

Romek

Super Moderator
Reaction score
963
> Not to mention that something that "takes real z" probably also should do something with that z...
Note to self: Don't submit anything at 4am. Even if it's simple. :p

> I use dummy units for this.
Try using a dummy to create an effect with a height every 0.02 seconds or so.
I was originally using dummy units too, and it simply didn't work as I wanted.

> What is Z? Height?
Yup

> You never set the height lol.
I see you're using your reading skills very well again!

Anyway, I fixed this now. :p
 

Romek

Super Moderator
Reaction score
963
> No complaints, nothing bad about it at all.
Thanks.

> How do you add height if there is no z in the
The line before: "CreateDestructableZ( 'OTip', x, y, z, 0., 1., 0)"
'OTip' is an invisible platform. The effect is created over it, and remains there once the platform is removed.
 

Jesus4Lyf

Good Idea™
Reaction score
397
>Try using a dummy to create an effect with a height every 0.02 seconds or so.
>I was originally using dummy units too, and it simply didn't work as I wanted.

Heh. Might lag on 0.02. But I do it on 0.03125 and stuff without a second thought using KT2. In fact I highly doubt it would lag on 0.02.

And note that I mean a separate dummy unit for each effect. The advantage being you can move the effect.

Nonetheless, I assume this has its place.
 

Romek

Super Moderator
Reaction score
963
It's really lag. It just seems that the effects are all created in clusters every X seconds.

Here's a screenshot of an effect being created on a dummy:
See.png


And here's what it looks like with this snippet:
Arrow.png


(Yes, that's my newest spell (Though it's a remake of my old one) which will be released soon)
 

wraithseeker

Tired.
Reaction score
122
Romek said:
> How do you add height if there is no z in the
The line before: "CreateDestructableZ( 'OTip', x, y, z, 0., 1., 0)"
'OTip' is an invisible platform. The effect is created over it, and remains there once the platform is removed.

So when units walk at that invisble platform, their height will go up too naturally?
 

Romek

Super Moderator
Reaction score
963
> So when units walk at that invisble platform, their height will go up too naturally?
The invisible platform is destroyed instantly.
 

Azlier

Old World Ghost
Reaction score
461
Why is this not approved...? It's clean, it's leakless, it's useful...
 

Romek

Super Moderator
Reaction score
963
I don't tend to approve my own stuff. :)
 

Azlier

Old World Ghost
Reaction score
461
But of course. That question wasn't really directed towards you.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top