HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

DelFX

03-14-2009, 01:02 PM#1
Deaod
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: w3xDelFX_1.4.2.w3x (38.5 KB)
03-15-2009, 09:48 AM#2
Toadcop
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 ;) )
03-15-2009, 10:42 AM#3
akolyt0r
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
03-15-2009, 11:48 AM#4
Deaod
@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.
03-15-2009, 12:02 PM#5
akolyt0r
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 ...
03-15-2009, 12:29 PM#6
Vexorian
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 ...
03-15-2009, 01:20 PM#7
Deaod
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.
03-15-2009, 02:34 PM#8
Vexorian
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.
03-15-2009, 02:42 PM#9
Anitarf
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.
03-17-2009, 11:14 PM#10
Toadcop
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)
03-18-2009, 05:07 PM#11
Deaod
How about a xe-version? Like, a xedelfx library using xefx via delegate?
04-13-2009, 02:27 AM#12
Anitarf
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.
04-13-2009, 03:35 AM#13
Deaod
Version 1.4.0

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

Edit:

Version 1.4.1
04-18-2009, 12:07 PM#14
Pyrogasm
Aside from creating effects with a z height, what can DelFX do that Timed Effects can't?
04-18-2009, 12:20 PM#15
grim001
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.