System TimedLightning

>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.
 
>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!
Staff member
> 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!
Staff member
-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
Staff member
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!
Staff member
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!
Staff member
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!
Staff member
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
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!
Staff member
* 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!
Staff member
~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
> 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!
Staff member
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
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!
Staff member
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
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
  • No one is chatting at the moment.
  • Ghan Ghan:
    The old shoutbox wasn't supported anymore. We updated xenForo, so it had to be replaced.
  • jonas jonas:
    let's see if everyone finds it... the nice thing about the shoutbox was I could check on it even while logged out, but the existence of this one is hidden when you're not logged in
  • Ghan Ghan:
    We can fix that.
  • Ghan Ghan:
    Chat should show on the sidebar when not logged in now.
  • Ghan Ghan:
    (You'll still need to log in to post messages)
  • Ghan Ghan:
    Test!
  • tom_mai78101 tom_mai78101:
    I must be in a test server.
  • tom_mai78101 tom_mai78101:
    Nice, Twitter tweets embedding now works
  • Wizard Wizard:
    Yup.
  • Ghan Ghan:
    Excellent.
  • Ghan Ghan:
    @tom_mai78101 Hello there.
  • Ghan Ghan:
    Tagging works in the chat too.
  • tom_mai78101 tom_mai78101:
    @Ghan Missed it.
  • Wizard Wizard:
    Still fixing things here and there. Added widgets to the portal, will make it match the ones here on the forum index tomorrow.
  • Ghan Ghan:
    The venerable World Editor Tutorials site has been converted to HTTPS at last.
  • jonas jonas:
    cool
  • jonas jonas:
    and I can even edit my messages, nice
  • seph ir oth seph ir oth:
    GENERAL CHIT CHAT, YOU ARE A BOLD ONE
  • Ghan Ghan:
    Hello there
  • The Helper The Helper:
    this new chatbox is great and the forum software update is great too
    +1
  • The Helper The Helper:
    upgrade has fixed forum registration spam problem
  • tom_mai78101 tom_mai78101:
    Something tells me we might be able to customize the chatbox a bit, considering that there's a gap under every message.
  • Wizard Wizard:
    Going to deploy a fix soon, just had to take some time for myself this weekend.
  • Varine Varine:
    Unbelievable. Time for yourself? How dare you!

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top