Detecting previous ability

keychup

Active Member
Reaction score
34
I need to detect the previous ability used by a unit.

1. Hashtables wont allow me to store Abilities
2. I could try using an ability variable with array

Question is whether an array can exceed a size of 8192
 

thorhunter

You can change this now in User CP.
Reaction score
32
Depending on how many units you want to consider, this may not be the right way.


Code:
dasds
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
    Actions
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Triggering unit) Equal to aaUnitArray[(Integer A)]
                    Then - Actions
                        Set aaAbilityArray[(Integer A)] = (Ability being cast)
                    Else - Actions
 

keychup

Active Member
Reaction score
34
"for each integer" is redundant. i need to detect the previous spell cast by each unit. what if there were more than 10 units
 

thorhunter

You can change this now in User CP.
Reaction score
32
The 10 is actually representative of count of units affected, there is additional trouble of adding trigger that would store all new units, remove the dead ones and assort the to not exceed the array, but thats minor issue. I can create the system if you're interested in this method.
 

Grags_1977

Ultra Cool Member
Reaction score
32
Could you not do something like


if ability being cast = AbilityOld(custom value of casting unit) then
Blah​
end if

Set AbilityOld(custom value of casting unit) = ability being cast


Obviously hand written :p
 

merlinds

Member
Reaction score
15
if you arent using the custom value of the units, you can use it to store every skill being cast into an array.
like:
Set - LastSkill [Custom value of (Triggering Unit)] == Ability Being Cast
Obviously the event will be A units begins the effect of an ability.
And you previously have to set the custom values of the units.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
just save the order string in a hashtable or something like that, you can save strings, and you can have it as either an ability name or order string, either can be used to find out exactly what ability was cast but it may conflict with abilities that have the same order string or ability name, but i assume none will be like that in the end
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
You could use the custom value as an index for the skill.
At map initialization you give each skill an id, for example, blizzard got the ID 7.
When a unit starts the effect of an ability you set the units custom value to the ID of the skill, in the case the unit uses blizzard it would be 7.
Then you can tell by the custom value of the unit what ability it has used last.

If your map has a large number of abilities i would suggest using one hashtable to map abilities to id's and one array which indices all abilities.
 

Dirac

22710180
Reaction score
147
[ljass]call SaveInteger(udg_HashtableVar, parent , child , GetSpellAbilityId() )[/ljass]

EDIT: But you're missing the whole point, you don't have to store the ability in a hashtable, you see, arrays can have size up to 8192 but the values stored in them up to 2^32 i think.
If you wish to know what was the last ability casted by an unit just store it inside a variable unique for that unit and then read it everytime the unit casts something.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top