Snippet Add Effect Z

Romek

Super Moderator
Reaction score
964
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,495
> 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
964
> 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
964
> 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
964
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
964
> 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
964
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
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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