wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-14-2009, 02:02 PM   #1
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default DelFX

Description:
This little library allows the user to schedule effects and destroy them after some time with only one line. There are some more things you can do to delayed effects and I suggest you look at the code to understand this library.

I developed this library for my Phoenix Form spell, which is why the testmap matches the Phoenix Form one. In particular I used DelFX to time the flamestrike effects and simulate the burning effect of immolation.

This library uses Vexorian's TimerUtils library and vJass syntax.

In-Game-Commands:

- "-reset": spawns some footmen
- "-level <level>": Set the heros level to the level you specified. Note that you cannot decrease it that way.
- "-handleid": creates a location, displays its handlid-0x100001, and then destroys it.
- "-credits": displays credits
- "-commands": displays this list
- "-clear": removes all messages ingame



Changelog:

01/08/2009 - Version 1.0.0
- initial release

01/21/2009 - Version 1.0.1
- shortened code

01/21/2009 - Version 1.1.0
- Now uses one timer per instance

02/11/2009 - Version 1.1.1
- fixing of a few really small glitches
- better error reporting (when in debug mode)

02/22/2009 - Version 1.2.0
- Added OnSpawn and OnDestroy callbacks, so you can run code when a DELFX struct spawns an effect or is destroyed
- Enabled attaching to DELFX structs

03/14/2009 - Version 1.3.0
- added support for destroying effects (DestroyEffectTimed)
- added support for spawning Delayed Effects with a Z coordinate (CreateDelayedEffectZ)
- added support for changing the spawning location of a Delayed Effect (DELFX.SetSpawnPosition)

04/13/2009 - Version 1.4.0
- removed access to the DELFX struct; the struct is now private to the DelFX library (this breaks backwards compatibility)
- removed unnecessary code, now that the DELFX struct is private.

04/13/2009 - Version 1.4.1
- further reduced code amount, removing features not in the scope of this system
- small optimization behind the scenes

08/07/2009 - Version 1.4.1
- Compatibility with 1.24



Expand Library-Code + Credits:
Attached Files
File Type: w3x DelFX_1.4.2.w3x (38.5 KB, 110 views)

Last edited by Deaod : 08-07-2009 at 03:32 PM. Reason: Updated to 1.4.2
Deaod is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-15-2009, 10:48 AM   #2
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,886

Submissions (4)

Toadcop is just really nice (299)Toadcop is just really nice (299)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default

Collapse JASS:
                    set d=CreateDestructableZ('OTip', s.x, s.y, s.z, 0,1.,0)
                    set s.fx=AddSpecialEffect(s.path, s.x, s.y)
                    call RemoveDestructable(d)
                    set d=null
is very evil... walkable destructables are pure shit. + it's not rational periodicaly to create something... better use dummy units + it allows much more actions with the effects (including scaling)
create some units at map intialization and after use them for the attaching (don't forget to recycle them ;) )
__________________
Toadcop is offline   Reply With Quote
Old 03-15-2009, 11:42 AM   #3
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

i dont like the operators for the attaching ..
really not needed... at all ..just remove the private in front of Data and your done...

Collapse JASS:
        method RegisterOnDestroy takes OnDELFXDestroy func returns nothing
            set .onspawntrig=func //shouldnt that be ondestroytrig ? lovely CNP error ;)
        endmethod
__________________

Last edited by akolyt0r : 03-15-2009 at 11:43 AM.
akolyt0r is offline   Reply With Quote
Old 03-15-2009, 12:48 PM   #4
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

@Toadcop: I dont see a reason to recreate something Vexorian has already created (xefx).
Besides, could you explain to me why exactly (ab)using that destructable bug is that evil?

@akolyt0r: Those attaching operators will get inlined. Theres no speed penalty.
Thanks for catching that bug...it should be .ondestroytrig, indeed.
__________________
Deaod is offline   Reply With Quote
Old 03-15-2009, 01:02 PM   #5
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

i know ...but you will have to remember 2 method names that way ...

The sense of methods (and operators) is generally ...to make the life for the user easier ...
Your two methods dont make it easier ..... your two methods dont achieve that goal...

why not just remove that "private" in front of Data, you could still keep your methods if you like them so much ...
__________________
akolyt0r is offline   Reply With Quote
Old 03-15-2009, 01:29 PM   #6
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Quote:
create some units at map intialization and after use them for the attaching (don't forget to recycle them ;) )
err, did you manage to get a way to turn unit facing instantly? Otherwise recycling doesn't work for fx stuff. At least not correctly ...
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-15-2009, 02:20 PM   #7
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

native SetUnitLookAt takes unit whichUnit, string whichBone, unit lookAtTarget, real offsetX, real offsetY, real offsetZ returns nothing That makes a unit face another unit instantly. Though i have no clue how to use it.
__________________
Deaod is offline   Reply With Quote
Old 03-15-2009, 03:34 PM   #8
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

No, it doesn't. Plus it is quite glitched.

It moves the a certain bone in the unit's model, but it doesn't do it exactly instantly, a lot of fx models don't have bones. I guess you could make a whole new dummy unit model, but it wouldn't look right, this is the reason the dummy unit model has moved on from just a bone to a lot of animations.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-15-2009, 03:42 PM   #9
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by Vexorian
No, it doesn't. Plus it is quite glitched.
In my experience setting the unit's animation blend time to 0 helps, but if used repeatedly it doesn't work right because it always resets the bone facing before facing a new target. If, however, it was only used once when the unit is recycled, maybe it wouldn't look weird. You'd still need a dummy model with animations for different angles of attack. I think you're still better off creating units instead of recycling them for the sake of simplicity.
__________________
Anitarf is offline   Reply With Quote
Old 03-18-2009, 12:14 AM   #10
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,886

Submissions (4)

Toadcop is just really nice (299)Toadcop is just really nice (299)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default

Quote:
err, did you manage to get a way to turn unit facing instantly? Otherwise recycling doesn't work for fx stuff. At least not correctly ...
does walkable destructables turn fxs ?! O.o
i don't see the point of this quote...
well sometimes you simply have limited field of view or something.
in case... he could allocate dedicated dummys which will allways have the needed facing ? or he could allocate dummys and split them into 45 degree step and pick the needed one and turn it so the turn ill be less than 45 degrees and visualy (with right unit setups) almost not visible. etc and etc. also it's possible to do timeouts on recycle and to reset the facing to the basic one or fill the a group with less dummys (from the other one with more free dummys. the sense is to have enought "pre-turned" units in group)

the are allways solutions. you just need no to go the usual way.
and as for me i don't bother about the minor visual glicht AND NO GAMER EITHER.

the problem with dynamic unit creating the placing alorithms (pathing) is really slow and takes alot time. for comparison it's ~50 times slower than to store a value in gamecache (constant strings) and it's only the placing story not the alocation of new unit instance. aka it takes even more (i don't know how much exactly more so i will not write not proved info)
__________________
Toadcop is offline   Reply With Quote
Old 03-18-2009, 06:07 PM   #11
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

How about a xe-version? Like, a xedelfx library using xefx via delegate?
__________________
Deaod is offline   Reply With Quote
Old 04-13-2009, 03:27 AM   #12
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

I liked what I saw up until this point:
Quote:
Collapse JASS:
//  All functions return a struct of type DELFX. If you want to do some more things, I
//  suggest you read through the whole code.
I disagree with the first sentence; the purpose of this library are supposed to be delayed effects: if you want an effect to get destroyed after a duration this is what you'd use. If you want more, like interrupting the timeout or calling functions when the effect gets destroyed then you might as well skip the middleman and run your function yourself with a timer and destroy the effect there. You can't make a spell system out of this. Stick to your mission statement: delayed effects.

As for the second sentence, that's no way to write proper documentation.
__________________
Anitarf is offline   Reply With Quote
Old 04-13-2009, 04:35 AM   #13
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

Version 1.4.0

Since those two sentences have been removed, give this another try.

Edit:

Version 1.4.1
__________________

Last edited by Deaod : 04-13-2009 at 04:49 AM.
Deaod is offline   Reply With Quote
Old 04-18-2009, 01:07 PM   #14
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Aside from creating effects with a z height, what can DelFX do that Timed Effects can't?
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 04-18-2009, 01:20 PM   #15
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

Quote:
Originally Posted by Vexorian
err, did you manage to get a way to turn unit facing instantly?

SetUnitLookAt works as long as you use it once instead of spamming it. Been doing it to recycle dummy units with attached effects in my physics engine for a long time.
grim001 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 07:31 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services