• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Problem with ability casting...

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hi! When i cast Storm bolt, my hero isn't throwing the hammer at the same time ( there is about a second before throwing, a green square gets on the icon ). I want to ask how to eliminate that time in my trigger. I know i need to use 'A unit begins casting and ability' instead of 'A unit starts the effect of and ability', but when i use the right thing - the cooldown of the ability isn't appearing ( the magic haves no cooldown )... i don't know if you are understanding me and sorry for my bad english... here are the triggers :
  • Hashtabl
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set HashCharge = (Last created hashtable)
  • Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge [Bear]
    • Actions
      • Hashtable - Save Handle Of(Target unit of ability being cast) as 1 of 1 in HashCharge
      • Unit - Set (Casting unit) movement speed to 1500.00
      • Unit - Order (Casting unit) to Attack (Load 1 of 1 in HashCharge)
      • Wait 2.00 seconds
      • Unit - Set (Casting unit) movement speed to (Default movement speed of (Casting unit))
help please! +rep for reward ( if i spread some first :D )

PS: i use the Storm bolt as a dummy spell. ( i used the Hashtable to test something... i don't know why i pasted it here... :D )
 
Last edited:
Don't use waits, you cant set movement spped for given unit to 1500 since maximum value is 522 and only if you set it in game constans (default maximum is 400). For efficiency use Triggering unit instead of casting unit.
I dont get where is the Storm bolt here, i see only Charge like spell.
Explain it a bit further and make sure you have casting time for given ability set to 0.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
I just want my bear to cast her charge ability (Charge is a dummy spell of Storm Bolt) at attack the enemy. I actually can't explain it well... just make a dummy magic and a trigger. First time set the event to 'A unit starts the effect of an ability' and then 'A unit begins casting an ability', put an action and you will see that when you use the different events, the time is different (the time between the cast and the action). So, i want to cast my spell as fast as it's possible after i click it's button. I can do that by using 'A unit begins casting an ability', but when i use that - my spell haves no cooldown... i am sorry, but i am a noob and i don't know how to tell what i need...

(for dummy magic use the Storm Bolt)
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
It's perfect, Spinnaker! When i spread rep - i will give you! :) Still i can't understand nothing from your triggs... i think i like to do it the easy way, but sometimes it's impossible... can you tell me why you use those indexes, their sizes and things like this... if you tell me - i will be happy as hell! I don't want to know that because i want to change something, but to understand your triggers... :) (you can post here [if you want] or you can upload the map with trigger comments or something...) THANK YOU!!!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Arrays in JASS (GUI compiles to JASS when you save) are dynamic arrays thus do not actually have a "size" like concentional arrays do.

Generally the idea is to think of arrays as storage locations. You group many arrays in parallel to store more elements at a single location. You could also allocate each location many indicies in an array to get an array at a storage location (2D array).

You then need a sub system to allocate and deallocate storage locations. When you need one, your allocate (reserve) a unique storage location. Generally each spell instance has its own unique storage location. Once the spell instance ends, you then deallocate that storage location which allows that location to be reallocated again (eg it could get allocated again for another spell instance). This approach keeps the dynamic array sizes down and keeps high efficieny due to direct access of all data.

You could use hashtables instad but those are more complex to look up an individual value from than a global array which is why arrays are often used.

To recycle array storage locations, a stack appraoch is often used used. This can often be done with no extra variables by using one of the integer arrays members (if any) to form a singlular linked list with all freed locations and then pointing the next location to the last freed. The advantage of this approach is that it avoids any bulk coppying (as JASS is slow) meaning you could have 100 of members (arrays in parralel represening different data for the same location) and allocate/deallocate them very quickly. It also keeps locations static which make them easier for references.

Another approach is to use parralel arrays in a list. You allocate to after top and deallocate by replacing deallocated position with top. This has even cheaper allocation (less logic) but more expensive deallocation (bulk copy) and indicies are not static but is perfect for treating locations as part of a set (unordered collection).

I do not know which of these the helpful person used, but these are the common indexing systems.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Well... i mostly use hashtables, because i understand them... i think i will need little time to understand the other indexing systems. :D Thanks, Dr. Super Good! I actually ran across some tutorials and i understand now the spell of spinnaker - i think it's a MUI. And in my map only one hero will use it, so i think that MUI isn't recommended in this case, right?
 
Status
Not open for further replies.
Top