[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 > Warcraft III Modding > World Editor Help Zone


World Editor Help Zone Ask general questions about World Editor features and use in this forum. If you need help fixing a trigger, please post it in Triggers & Scripts. Please review the forum rules before posting.

Closed Thread
 
Thread Tools
Old 04-10-2012, 10:32 PM   #1 (permalink)
Registered User khamarr3524
The Khamarr.
 
khamarr3524's Avatar
 
Join Date: Apr 2011
Posts: 451
khamarr3524 has little to show at this moment (50)
Check if Spell is off Cooldown

So, is there any way for me to do this? I need a way to check if any/all of a specific unit's hero spells are off or on cooldown. Any ideas?
Edit: Just had a thought. When one of the spells is cast I can start a timer that has the length of the spell's duration and check if that timer expired. I'll try and whip something up, unless someone has a system like this laying around on their HD or is bored and want's to do it (please jass/vJass, otherwise nu :P).
__________________
khamarr3524 is offline  
Old 04-10-2012, 11:56 PM   #2 (permalink)
Registered User Spartipilo
User
 
Join Date: Jul 2011
Posts: 3,142
Spartipilo is just really nice (404)Spartipilo is just really nice (404)Spartipilo is just really nice (404)Spartipilo is just really nice (404)Spartipilo is just really nice (404)
Mmmm yeah, I think the timer option is the best. Another way would be creating a dummy with an expiration timer and checking if the unit is alive.
Spartipilo is offline  
Old 04-11-2012, 12:06 AM   #3 (permalink)
Registered User khamarr3524
The Khamarr.
 
khamarr3524's Avatar
 
Join Date: Apr 2011
Posts: 451
khamarr3524 has little to show at this moment (50)
I also thought of that, but then again, keeping the coding simple is best :P. I'll get to work on this.
__________________
khamarr3524 is offline  
Old 04-11-2012, 01:33 AM   #4 (permalink)
Registered User Spartipilo
User
 
Join Date: Jul 2011
Posts: 3,142
Spartipilo is just really nice (404)Spartipilo is just really nice (404)Spartipilo is just really nice (404)Spartipilo is just really nice (404)Spartipilo is just really nice (404)
You could basically save all the abilities into a variable array and set their = to the cooldown. With another function start a timer on ability cast based on that ability. Most vJassers do it all the time with anything :p

-Kobas- made an Ability Level Up system that woks in a real similar way.
Spartipilo is offline  
Old 04-11-2012, 01:40 AM   #5 (permalink)
Registered User khamarr3524
The Khamarr.
 
khamarr3524's Avatar
 
Join Date: Apr 2011
Posts: 451
khamarr3524 has little to show at this moment (50)
I need to learn how to do dynamic indexing so that I can index multiple spell casts :/ The lack of vJass tuts sucks.
__________________
khamarr3524 is offline  
Old 04-11-2012, 01:49 AM   #6 (permalink)
Registered User Spartipilo
User
 
Join Date: Jul 2011
Posts: 3,142
Spartipilo is just really nice (404)Spartipilo is just really nice (404)Spartipilo is just really nice (404)Spartipilo is just really nice (404)Spartipilo is just really nice (404)
A great way to learn is checking how other spells are implemented, and how they work. Move a value here and there... And moving on from there.
Spartipilo is offline  
Old 04-11-2012, 01:54 AM   #7 (permalink)
Registered User Adiktuz
Engr. Shana, ChE
 
Adiktuz's Avatar
 
Join Date: Oct 2008
Posts: 10,035
Adiktuz has a brilliant future (1351)Adiktuz has a brilliant future (1351)Adiktuz has a brilliant future (1351)
vJASS tuts are only for vJASS only things... dynamic indexing is present since GUI...
and the best would be looking at Hanky's Dynamic indexing... and its gui I think...
Adiktuz is offline  
Old 04-11-2012, 02:09 AM   #8 (permalink)
Registered User khamarr3524
The Khamarr.
 
khamarr3524's Avatar
 
Join Date: Apr 2011
Posts: 451
khamarr3524 has little to show at this moment (50)
Then how else would i go about indexing the spells more efficiently?
__________________
khamarr3524 is offline  
Old 04-11-2012, 02:14 AM   #9 (permalink)
Registered User Adiktuz
Engr. Shana, ChE
 
Adiktuz's Avatar
 
Join Date: Oct 2008
Posts: 10,035
Adiktuz has a brilliant future (1351)Adiktuz has a brilliant future (1351)Adiktuz has a brilliant future (1351)
A timer loop with dynamic indexing... I never said you cannot use it in JASS/vJASS... you can learn it in GUI then port it in vJASS if you really need a tutorial for it... or take a look at vJASS spells that use dynamic indexing...

it would also be better if you use dynamic indexing + maybe hashtable [just to save the indexes used by a unit] for easier retrieval of data...
Adiktuz is offline  
Old 04-11-2012, 03:31 AM   #10 (permalink)
Registered User khamarr3524
The Khamarr.
 
khamarr3524's Avatar
 
Join Date: Apr 2011
Posts: 451
khamarr3524 has little to show at this moment (50)
I really don't get this dynamic indexing o.o
__________________
khamarr3524 is offline  
Old 04-11-2012, 04:18 AM   #11 (permalink)
Forum Moderator PurgeandFire
ʕ•͡ᴥ•ʔ
 
PurgeandFire's Avatar
Resource & Tutorial Moderator
 
Join Date: Nov 2006
Posts: 5,716
PurgeandFire has a reputation beyond repute (2094)PurgeandFire has a reputation beyond repute (2094)PurgeandFire has a reputation beyond repute (2094)PurgeandFire has a reputation beyond repute (2094)PurgeandFire has a reputation beyond repute (2094)PurgeandFire has a reputation beyond repute (2094)
In vJASS we usually use timer systems because they are the easiest to deal with. You can also do indexing, but with timer systems you have that ease of modification and it is overall a lot easier to understand.

To learn more about timers and vJASS, I highly recommend this tutorial:
http://www.thehelper.net/forums/show...Timers-in-JASS

It is a bit outdated because it doesn't have CTL and that jazz, but those systems all work 100% and are still used in several systems created today.
PurgeandFire is offline  
Old 04-11-2012, 04:54 AM   #12 (permalink)
Registered User khamarr3524
The Khamarr.
 
khamarr3524's Avatar
 
Join Date: Apr 2011
Posts: 451
khamarr3524 has little to show at this moment (50)
I read through some other scripts and was able to create this, but it's most likely 70% wrong.
This doesn't really have much to do with cooldowns, but it's the structure i'm using for dynamic indexing. Sorry for any confusion. Cooldowns come later.
Jass:
library AxelBoost
    struct AxelBoost extends array
        private static integer spell = 'axel'
        private static unit array Caster
        private static integer heroType = 'omiz'
        private static integer AtkNeed = 5
        private static integer array Attacks
        private static real array Stun
        private static real array boost
        /*
        *   Dynamic Indexing Variables
        */

        private static integer array rn
        private static integer ic = 0
       
        /*
        *   Dynamic Indexing Functions
        */

        private static method allocate takes nothing returns thistype
            local thistype this = rn[0]
            if this == 0 then
                set ic = ic + 1
                set thistype.Attacks[this] = 0
                set .Caster[this] = GetTriggerUnit()
                set Stun[this] = GetUnitAbilityLevel(Caster[this], spell)
                set .boost[this] = GetUnitAbilityLevel(Caster[this], spell)
                return ic
            endif
            set rn[0] = rn[this]
            return this
        endmethod
       
        private method deallocate takes nothing returns nothing
            set rn[this] = rn[0]
            set rn[0] = this
        endmethod
       
        private static method AxelBuff takes thistype this returns nothing
        endmethod
       
        /*
        *   Attack Counter
        */

        private static method CountAttack takes thistype this returns nothing
            if GetUnitTypeId(GetAttacker()) == heroType then
                if Attacks[this] == AtkNeed then
                    call AxelBuff(this)
                    return
                endif
                set Attacks[this] = Attacks[this] + 1
            endif
        endmethod
    endstruct
endlibrary
__________________
khamarr3524 is offline  
Closed Thread

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


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




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