System TimedLightning

Reaction score
456
>But can't I just let the same struct handle all the functions' data
Of course, that'd be rather stupid not to do so.

>I don't see why that would be needed (since source and target are used by TimedLightningUnit, and the rest of the data is used by all 3 functions)
You need no source and target anymore, because you have their coordinates.
 
Reaction score
456
>I thought you meant I should have a different struct for TimedLightning and TimedLightningUnit.
Well I didn't mean. And I didn't mean to make you think so. But what ever :).

You could still improve the snippet by allowing the use of z-axis for coordinate lightnings.
 

Flare

Stops copies me!
Reaction score
662
> You could still improve the snippet by allowing the use of z-axis for coordinate lightnings.

I'll add that for TimedLightning and TimedLightningLoc in next update.

EDIT: Once I update this, I will add an option for initial fade value (so people can make a lightning effect more visible than initial visibility :))

UPDATE!
The system now automatically caters for negative Z values by setting them to 0 (see this post if you want to know why :D)

UPDATE!
Changelog -
  • Z coordinates are now used by TimedLightning
  • Initial fade value can be defined when calling the function
 

Flare

Stops copies me!
Reaction score
662
-bump-

Currently working on a few extra functions
  • TimedLightningRing - Creates an expanding/contracting ring of lightning around a central XY coordinate (can be made stationary by giving initradius and endradius the same value). Will take an initial angle argument if you want to make an alternate shape e.g. set initangle to 45, and lightningcount to 4, and you have a square :D
  • TimedLightningRingUnit - Similar to TimedLightningRing, except it creates the shape around a specified unit, tracking its height and position (POSSIBLE FUNCTION)
  • TimedLightningRingLoc - An extension of the above using locations (for GUI users)
  • TimedLightningCoord2Unit - Creates a lightning effect that joins a set of XYZ coordinates to a unit
  • TimedLightningLoc2Unit - An extension of the above using locations (for GUI users)
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
This is a nifty little system, ideal for spells which need timed lightning effects.

I'll wait for you to add the new functions and bug-fixes, if required, before approving this.


More feedback people!

P.S

I shall change the prefix to 'system' rather than 'snippet' because it involves more than a few functions
and it really will be a system if you will add the new functions, as well.
 

Flare

Stops copies me!
Reaction score
662
I'll wait for you to add the new functions and bug-fixes, if required, before approving this.

Wait, there's bugs?

I shall change the prefix to 'system' rather than 'snippet' because it involves more than a few functions

Thanks :) Was trying to do it earlier, but found out that I can't change the prefix :(
 

Flare

Stops copies me!
Reaction score
662
Oh, my bad :p I'll have the coordinate version of TimedLightningRing done shortly, just need to finish a few things and test it :D

UPDATED!
TimedLightningRing and TimedLightningRingLoc have been added. Details on how to use them have been added to the How to Use section.

[del]EDIT: Bah, forgot to make my timer callbacks private members :p I'll fix that when I upload next version (which will have Coord2Unit and Loc2Unit)[/del]

UPDATED!
TimedLightningCoord2Unit (and the extension TimedLightningLoc2Unit, for GUI users) has been completed.

Well, that's all the functions I can think of. I won't make TimedLightningRingUnit because I just can't see many people using it (unless a number of users specifically request it to be made).

[del]I -MIGHT- make something to form a pentagram/Star of David shape, if I can get the math right :D[/del]
 

Flare

Stops copies me!
Reaction score
662
Would anyone mind helping me test the TimedLightningRing functions? I imported it into another map for use with a spell I'm making, and it f*cked up completely. I just need to test the TimedLightningRing with a variety of arguments e.g.

This doesn't work (the lightning effects don't appear in a ring, or move in a ring
JASS:
call TimedLightningRing ("CLPB", PROJCOUNT, 0, cx, cy, 0, 100, 100, duration, true, 1, 0)


Yet, this works (taken from the TL demo map)
JASS:
call TimedLightningRing ("DRAL", 15, Deg2Rad (45), -1100, -1100, 100, 500, -500, 5, true, 1, 0)


Apart from the few slight differences (lightning type, lightning count, and position), they are pretty much the same.

I've tested with constants and variables for all the arguments, and I can't pinpoint the cause (I'm fairly sure it's a problem with the coordinate and radius arguments)
 

Cohadar

master of fugue
Reaction score
209
SUGGESTIONS:
* private constant real TTPERIOD = 0.03125 // <-----<< :thdown:

* make struct TLdata private

* make all callback functions private

* function TimedLightning -> public function XYZ

* function TimedLightningLoc -> public function Loc

* function TimedLightningUnit -> public function Unit

* function TimedLightningRing -> public function Ring

* function TimedLightningRingLoc -> public function RingLoc

As a general rule, when making a library system make sure to declare everything either public or private.
 

Flare

Stops copies me!
Reaction score
662
* private constant real TTPERIOD = 0.03125

I never realised that I needed the TT_ prefix when referring to public members at the time ^^

* make struct TLdata private

It's not private? Oops

* make all callback functions private

Same as above :eek:

And I'll make the main functions public once I fix WC3/NewGen :p
 

Flare

Stops copies me!
Reaction score
662
~bump~

OK, this is probably the final version that will be released (unless bugs are found)
Update notes:​
  • Functions have been reduced, and made public - see documentation for the new function names
  • Struct is now a private member
  • Improved documentation to accomodate the changes
  • New demonstration of TL_Ring - check it out :)

Also:
I'm thinking about whether I should add a GetLast function (mainly to allow the end-user to play around with the lightning, such as color-changing and destroying it manually before the duration expires)
So, do you think I should add a GetLast function or not?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> do you think I should add a GetLast function or not?

No. But any function that creates one could simply return it.

Then again, I assume this crashes miserably if a lightning is destroyed without the library noticing.
You could return some index numbers and a custom destroy/changecolor/somethingelse set of functions.

Do you test to make sure it's not created underground? Out of map limits?
 

Flare

Stops copies me!
Reaction score
662
Underground - yes, it checks if the given Z value is < 0, then sets the struct member to 0 (otherwise it sets the struct member to the taken value). Haven't done extensive testing, but it seems to work just fine

Out of map bounds - no, good thinking, I'll get that done :D

Then again, I assume this crashes miserably if a lightning is destroyed without the library noticing.
Hmmm, that seems like reason enough to leave it out - adding a whole indexing system sounds like alot of bother (and the only method I can think of at the moment to do it would be to loop through all existing lightning effects, and someone will probably gripe about it being inefficient). I could a function that lets you set the RGB for the next TimedLightning that is spawned (would be a helluva lot simpler than recoding all existing functions).
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
Leave it out?
Hm... well, I didn't read the "doc" so it might be in there, but, how do I destoy an effect? Tell it to move? Change its color? Make it timed? Damage units that cross the beams?
 

Flare

Stops copies me!
Reaction score
662
Leave it out?
Not implement it :p

how do I destoy an effect?
Automatically done :p

Tell it to move?
Depending on which function is used, and what kind of movement, that's done automatically as well.

Change its color?
On-the-fly, or give it a colour and leave it like that?

Make it timed?
Ahm... set the duration parameter to (whatever) and leave the system do the rest? :p

Damage units that cross the beams?
Not possible with this version - the system was made with only visuals in mind
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
Hm...

Ok, I want to create a line, rotate it around its center.
Create a second, identical, rotate both around the center, one clock- the other counterclock-wise.

Repeat with 2 more.

"Expand" them to a square.

Change colors along the way.

Keep going until... some kind of event.
Once that event happens, I want the effect to disappear five seconds later.


Ah well, keep dreaming Ace... :p

+20 rep for the first one to provide a rotating 3D lightning-made "football"-model demo map.
 
General chit-chat
Help Users
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      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