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 01-29-2009, 01:15 AM   #16
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Ok, I followed the suggestions, I hope I hadn't forgotten anything else.
moyack is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 02-02-2009, 11:32 PM   #17
Anitarf
Procrastination Incarnate


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

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

The example at the start of the post still uses a different function name than the actual library and the function name in the library still doesn't make sense, the function AddTimedEffect as you call it doesn't "Add" an effect, it adds a timer to it so if anything it should be AddTimerToEffect but that sounds silly, DestroyEffectTimed is much better.
__________________
Anitarf is offline   Reply With Quote
Old 02-03-2009, 01:07 AM   #18
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

I've set the calling functions as StartTimedEffect, StartSpecialEffectTimed and StartSpecialEffectTargetTimed. I use Start as prefix because it starts the effects and nobody has to care if it's attached to a timer or something else, the code will care of the effects cleaning.

I won't change the private functions names because the user doesn't need to deal with them, because they're private.

I think it's fine enough. What do you think??

Last edited by moyack : 02-03-2009 at 01:08 AM.
moyack is offline   Reply With Quote
Old 02-10-2009, 10:18 PM   #19
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

This seems nice, but isn't this script the same thing as:
http://www.wc3campaigns.net/showthread.php?t=104211

I mean, if they do the same thing for the same purpose, which one is teh best?
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition
Flame_Phoenix is offline   Reply With Quote
Old 02-10-2009, 11:17 PM   #20
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Quote:
Originally Posted by Flame_Phoenix
This seems nice, but isn't this script the same thing as:
http://www.wc3campaigns.net/showthread.php?t=104211

I mean, if they do the same thing for the same purpose, which one is teh best?
Mine is focused in start an effect for some time defined by the user and then the system removes it automatically, so you won't need to worry about that effect anymore. you just have to do this to show a timed effect:

Quote:
Example: call StartTimedEffect(<Effect>, <duration>)

Deaod's is focused in offering a Delay in the effect start. It implies more functions and larger structs to manage all of this: sets a delay, a duration, and if the effect is in a point, you use a function, if it's on a unit, then other function.

Quote:
Collapse JASS:
    function CreateDelayedEffect takes string path, real x, real y, real delay, real timeout returns DELFX
        return DELFX.Create(path, false, null, "", x, y, delay, timeout)
    endfunction
    
    function CreateDelayedEffectTarget takes string path, widget target, string attachmentpoint, real delay, real timeout returns DELFX
        return DELFX.Create(path, true, target, attachmentpoint, 0, 0, delay, timeout)
    endfunction

Mine offers the delay feature as an optional library (requested by Dusk), just in case you need it.
moyack is offline   Reply With Quote
Old 02-11-2009, 07:40 AM   #21
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

I really don't think there's anything wrong with the name, Anitarf.

Anyway, I see you've changed the format a tiny bit (takes an effect as an argument), but I like it better that way. It makes it more compatible if, say, you wanted to have the effect in existence for an undefined amount of time, and then destroy it after X seconds when a certain event fires, etc.

I approve, unless there are objections from the jury.
__________________
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 02-11-2009, 09:05 AM   #22
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

I am so going to use this for timed effects =)
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition
Flame_Phoenix is offline   Reply With Quote
Old 03-09-2009, 04:45 AM   #23
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Library updated, please check first post.

Changelog:

* 3/08/2009: Now StartTimedEffect returns the index of the TimedEffect object and added the StopTimedEffect function so you can stop it manually.

Last edited by moyack : 03-09-2009 at 04:47 AM.
moyack is offline   Reply With Quote
Old 04-13-2009, 03:27 PM   #24
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Can anyone test if this compiles right? I'm not in a PC with WC3.

Collapse TimedLightnings and effects, could extend other handles...:
library TimedEffects requires TimerUtils

private struct data
    timer t
    static method create takes nothing returns data
        local data dt = data.allocate()
        set dt.t = NewTimer()
        call SetTimerData(dt.t, integer(dt))
        return dt
    endmethod
endstruct
//! textmacro AddTimedHandle takes HANDLE, NAME, DESTRUCTOR
private struct $NAME$ extends data
    %HANDLE% h
    static method create takes $HANDLE$ h returns $NAME$
        local $NAME$ H = $NAME$.allocate()
        set H.h = h
        returns H
    endmethod
endstruct

function StopTimed$NAME$ takes integer index returns nothing
    call $DESTRUCTOR$($NAME$(index).h)
    call ReleaseTimer($NAME$(index).t)
    call $NAME$(index).destroy()
endfunction

private function DestroyTimed$NAME$ takes nothing returns nothing
    call StopTimed$NAME$(GetTimerData(GetExpiredTimer()))
endfunction

function StartTimed$NAME$ takes $HANDLE$ f, real dur returns integer
    local $NAME$ d = $NAME$.create(f)
    call TimerStart(d.t, dur, false, function DestroyTimed$NAME$)
    return integer(d)
endfunction
//! endtextmacro

//!Runtextmacro AddTimedHandle( "effect", "Effect", "DestroyEffect" )
//!Runtextmacro AddTimedHandle( "lightning", "Lightning", "DestroyLightning" )

endlibrary

Last edited by moyack : 04-13-2009 at 05:46 PM.
moyack is offline   Reply With Quote
Old 04-13-2009, 04:04 PM   #25
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

Quote:
Can anyone test if this compiles right? I'm not in a PC with WC3.
According to my JassHelper, using Blue TimerUtils, everything compiles just fine.

off-topic:
Oh noes, 2999 posts !!!
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition

Last edited by Flame_Phoenix : 04-13-2009 at 04:04 PM.
Flame_Phoenix is offline   Reply With Quote
Old 04-13-2009, 04:15 PM   #26
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Could you please test it if it actually does the timed effect? man love will be your reward.
moyack is offline   Reply With Quote
Old 04-13-2009, 04:34 PM   #27
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

Did you changed the names of the functions??
For some reason the compiler tells me that "StartTimedEffect(effect, real)" does not exist ... so It does not compile, and because it does not compile, I can not run it ...

Collapse JASS:
scope test initializer Init
    globals
        private constant string EFF = "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl"
    endglobals
//===========================================================================
    private function Actions takes nothing returns nothing
        call StartTimedEffect(AddSpecialEffect(EFF, 0, 0), 2.)
    endfunction
//===========================================================================
    private function Init takes nothing returns nothing
        set gg_trg_test = CreateTrigger(  )
        call TriggerRegisterTimerEventSingle( gg_trg_test, 1.00 )
        call TriggerAddAction( gg_trg_test, Actions )
        
        call Preload(EFF)
    endfunction
endscope


PS: me has a feeling that you will have to change your signature =P
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition

Last edited by Flame_Phoenix : 04-13-2009 at 04:40 PM.
Flame_Phoenix is offline   Reply With Quote
Old 04-13-2009, 05:46 PM   #28
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

fixed. It should work now.

Collapse JASS:
library TimedEffects requires TimerUtils

private struct data
    timer t
    static method create takes nothing returns data
        local data dt = data.allocate()
        set dt.t = NewTimer()
        call SetTimerData(dt.t, integer(dt))
        return dt
    endmethod
endstruct
//! textmacro AddTimedHandle takes HANDLE, NAME, DESTRUCTOR
private struct $NAME$ extends data
    %HANDLE% h
    static method create takes $HANDLE$ h returns $NAME$
        local $NAME$ H = $NAME$.allocate()
        set H.h = h
        returns H
    endmethod
endstruct

function StopTimed$NAME$ takes integer index returns nothing
    call $DESTRUCTOR$($NAME$(index).h)
    call ReleaseTimer($NAME$(index).t)
    call $NAME$(index).destroy()
endfunction

private function DestroyTimed$NAME$ takes nothing returns nothing
    call StopTimed$NAME$(GetTimerData(GetExpiredTimer()))
endfunction

function StartTimed$NAME$ takes $HANDLE$ f, real dur returns integer
    local $NAME$ d = $NAME$.create(f)
    call TimerStart(d.t, dur, false, function DestroyTimed$NAME$)
    return integer(d)
endfunction
//! endtextmacro

//!Runtextmacro AddTimedHandle( "effect", "Effect", "DestroyEffect" )
//!Runtextmacro AddTimedHandle( "lightning", "Lightning", "DestroyLightning" )

endlibrary

Last edited by moyack : 04-13-2009 at 05:48 PM.
moyack is offline   Reply With Quote
Old 04-13-2009, 06:14 PM   #29
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

Quote:
fixed. It should work now.
Wermmm... no... I have the same error.

Click image for larger version

Name:	Image1.jpg
Views:	12
Size:	136.9 KB
ID:	42114

Collapse JASS:
scope test initializer Init
    globals
        private constant string EFF = "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl"
    endglobals
//===========================================================================
    private function Actions takes nothing returns nothing
        call StartTimedEffect(AddSpecialEffect(EFF, 0, 0), 2.)
    endfunction
//===========================================================================
    private function Init takes nothing returns nothing
        set gg_trg_test = CreateTrigger(  )
        call TriggerRegisterTimerEventSingle( gg_trg_test, 1.00 )
        call TriggerAddAction( gg_trg_test, Actions )
        
        call Preload(EFF)
    endfunction
endscope


Code used:
Expand JASS:
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition

Last edited by Flame_Phoenix : 04-13-2009 at 06:23 PM.
Flame_Phoenix is offline   Reply With Quote
Old 04-13-2009, 07:39 PM   #30
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Damn... I'll check this night. (extremely weird I have to say.)
moyack 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 06:22 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