[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Spells


Reply
 
Thread Tools
The Hive Workshop Spells:
DelFX - Delayed Effects 1.4.2
by Deaod
Images
Highslide JS
Details
Uploaded:09:21, 3rd Feb 2009
Last Updated:14:30, 7th Aug 2009
Keywords:Delayed, Timed, Effects, Effect, AddSpecialEffectZ
Type:System
Category:vJASS

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.2
- Compatibility with 1.24


Library-Code + Credits
// API:
//
// >>CreateDelayedEffect(whichEffect, X, Y, Delay, Timeout)
// - whichEffect is of type string and contains the path of the
// effect-to-be-spawned
// - X and Y indicate where the effect should be spawned
// - Delay is of type real and indicates how long to wait before spawning the
// effect
// - Timeout is of type real and indicates how long to wait before destroying
// the effect after it has been created
//
// >>CreateDelayedEffectZ(whichEffect, X, Y, Z, Delay, Timeout)
// - whichEffect: see above
// - X, Y and Z indicate where to spawn the effect
// - Delay: see above
// - Timeout: see above
//
// >>CreateDelayedEffectTarget(whichEffect, Target, AttachmentPoint, Delay, Timeout)
// - whichEffect: see above
// - Target is of type widget and indicates on which widget the effect should
// be spawned
// - AttachmentPoint is of type string and holds the attachment point where
// the effect should be spawned on target widget
// - Delay: see above
// - Timeout: see above
//
// CREDITS:
// - Vexorian (JassHelper; TimerUtils)
// - Anitarf (Suggestions)
// - KaTTaNa (AddSpecialEffectZ function @ wc3jass.com)
// - PitzerMike (JassNewGenPack)
// - Pipedream (Grimoire)
// - SFilip (TESH)

library DelFX uses TimerUtils

    private struct DELFX
        private effect fx

        private string path
        private boolean target
        private widget tar
        private string attpt
        private real x
        private real y
        private real z

        private timer t
        private real timeout

        private method onDestroy takes nothing returns nothing
            if .fx!=null then
                call DestroyEffect(.fx)
                set .fx=null
            endif
            set .tar=null
            call ReleaseTimer(.t)
        endmethod

        private static method Release takes nothing returns nothing
            call DELFX.destroy(GetTimerData(GetExpiredTimer()))
        endmethod

        private static method Callback takes nothing returns nothing
        local DELFX s=GetTimerData(GetExpiredTimer())
        local destructable d
            debug if s.fx==null then
                if s.target then
                    set s.fx=AddSpecialEffectTarget(s.path, s.tar, s.attpt)
                elseif s.z==0 then
                    set s.fx=AddSpecialEffect(s.path, s.x, s.y)
                else
                    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
                endif
                call TimerStart(s.t, s.timeout, false, function DELFX.Release)
            debug else
            debug call BJDebugMsg("DELFX["+I2S(s)+"].Callback: Effect already spawned!")
            debug endif
        endmethod

        static method Create takes string path, boolean target, widget tar, string attpt, real x, real y, real z, real delay, real timeout returns DELFX
        local DELFX s=DELFX.allocate()
            set s.t=NewTimer()
            call SetTimerData(s.t, s)
            set s.path=path
            set s.target=target
            set s.tar=tar
set s.attpt=attpt
            set s.x=x
            set s.y=y
            set s.z=z
set s.timeout=timeout
            call TimerStart(s.t, delay, false, function DELFX.Callback)
            return s
        endmethod
endstruct

    // The functions below have been explained above.

    function CreateDelayedEffect takes string path, real x, real y, real delay, real timeout returns nothing
        call DELFX.Create(path, false, null, "", x, y, 0, delay, timeout)
    endfunction

    function CreateDelayedEffectZ takes string path, real x, real y, real z, real delay, real timeout returns nothing
        call DELFX.Create(path, false, null, "", x, y, z, delay, timeout)
    endfunction

    function CreateDelayedEffectTarget takes string path, widget target, string attachmentpoint, real delay, real timeout returns nothing
        call DELFX.Create(path, true, target, attachmentpoint, 0, 0, 0, delay, timeout)
    endfunction

endlibrary
Rating - 0.00 (0 votes)
(Hover and click)
Moderator Comments
Recommended
20:10, 25th Feb 2009
Hanky:
Evaluation

Rating Points
Advice: 5 points are the highest rating and 1 point is the lowest rating.

Documentation: 2
Visual Effects: -
Triggering: 5
Idea: -

Total:



Rating Comment

The code seems to be fine but you could maybe improve abit the documentation. Also I don't know how the performance differences are between your system and the normal way to destroy special effects delayed. Maybe you could make some performance test's and post them. But well the system work and the code is ok so I see no reason why I shouldn't approve it. The system could be maybe useful for some guys and I just can recommend to use it.

Suggestion:
- add a better manuel
- clear up the code


Advice: If you didn't understood my rating or if you maybe have questions because you don't know how to fix bugs or leaks etc. You can always send a private message to me. I will answer as soon I got time.

This spell is approved and works properly.


Download DelFX_1.4.2.w3x
(38.5 KB, 379 Downloads)

Old 02-03-2009, 04:46 PM   #2 (permalink)
Registered User nerovesper
๑۩۞۩_ENVY_۩۞۩๑
 
nerovesper's Avatar
 
Join Date: Sep 2008
Posts: 700
nerovesper is a jewel in the rough (241)nerovesper is a jewel in the rough (241)nerovesper is a jewel in the rough (241)nerovesper is a jewel in the rough (241)
Jass? I can't relate. xD
nerovesper is offline   Reply With Quote
Old 02-23-2009, 02:45 PM   #3 (permalink)
Registered User Kingz
I don't care.
 
Kingz's Avatar
 
Join Date: Jun 2008
Posts: 2,802
Kingz is a splendid one to behold (819)Kingz is a splendid one to behold (819)Kingz is a splendid one to behold (819)Kingz is a splendid one to behold (819)
Techtree Contest #6 - Winner: Demon Race: Kingz has managed to create a WarCraft3 race without importing additional material, yet presenting something unique to the public! A race made by Kingz. 
Isn't there already this kind of thing?
I think i saw 2 simmilar(maybe exactly the same) resources on the hive...
__________________
Life sucks.
Kingz is offline   Reply With Quote
Old 02-23-2009, 03:37 PM   #4 (permalink)
Registered User Deaod
GUI sucks. Don't use it.
 
Join Date: Nov 2007
Posts: 841
Deaod has disabled reputation
this offers delayed spawning, which all other systems known to me dont.

Last edited by Deaod; 02-23-2009 at 09:00 PM.
Deaod is offline   Reply With Quote
Old 02-24-2009, 05:23 AM   #5 (permalink)
Registered User Dynasti
I'm BACK!!
 
Dynasti's Avatar
 
Join Date: Oct 2007
Posts: 1,326
Dynasti is just really nice (310)Dynasti is just really nice (310)
Quote:
Originally Posted by Deaod View Post
this offers delayed spawning, which all other systems known to me dont.
You're right :D

I could only wish for this system to get a good manual, because the code looks a bit messy to me :X
__________________
Lost in space!
Dynasti is offline   Reply With Quote
Old 02-24-2009, 01:33 PM   #6 (permalink)
Registered User Kingz
I don't care.
 
Kingz's Avatar
 
Join Date: Jun 2008
Posts: 2,802
Kingz is a splendid one to behold (819)Kingz is a splendid one to behold (819)Kingz is a splendid one to behold (819)Kingz is a splendid one to behold (819)
Techtree Contest #6 - Winner: Demon Race: Kingz has managed to create a WarCraft3 race without importing additional material, yet presenting something unique to the public! A race made by Kingz. 
Yeah, i looked and it offers spec eff spawning while others destroy it timed...
__________________
Life sucks.
Kingz is offline   Reply With Quote
Old 02-28-2009, 03:43 AM   #7 (permalink)
Registered User aaron
Eating Joe.
 
aaron's Avatar
 
Join Date: Oct 2008
Posts: 853
aaron is a jewel in the rough (236)aaron is a jewel in the rough (236)aaron is a jewel in the rough (236)
PayPal Donor: This user has donated at least $20 to The Hive. 
already done.... plz come up with something original people.
__________________
Hive Quote Database Hive Chat Room
aaron is offline   Reply With Quote
Old 02-28-2009, 09:42 PM   #8 (permalink)
Registered User Deaod
GUI sucks. Don't use it.
 
Join Date: Nov 2007
Posts: 841
Deaod has disabled reputation
to all who think this is too similar to already existing systems:

This allows you to delay the creation of effects, which is a unique feature. However, if you can find a resource on THW, doing the same thing (in a better way) that has been approved before this, i'd like to have a link.
Deaod is offline   Reply With Quote
Old 05-23-2009, 02:35 PM   #9 (permalink)
Registered User Deaod
GUI sucks. Don't use it.
 
Join Date: Nov 2007
Posts: 841
Deaod has disabled reputation
Version 1.4.1
Deaod is offline   Reply With Quote
Old 08-07-2009, 02:30 PM   #10 (permalink)
Registered User Deaod
GUI sucks. Don't use it.
 
Join Date: Nov 2007
Posts: 841
Deaod has disabled reputation
Version 1.4.2
Deaod is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is my mouse scrolling so delayed... James7 WarCraft Discussion 0 08-01-2008 12:39 PM
Delayed projectile Ghost765 World Editor Help Zone 11 06-21-2008 09:42 PM
Sol VS. Luna...is delayed...again TheFallenAngel Map Development 0 05-17-2005 03:06 AM

All times are GMT. The time now is 08:21 AM.





Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle