[vJASS] Improving Spell

Status
Not open for further replies.
2 ways to improve:

1) the most important - you are creating a lot of destructables here. That will cause lag.

2) Instead of the following, do a first of group loop with a null filter. It will be more than 4x as fast because you are currently starting 2 threads per unit.

JASS:
call GroupEnumUnitsInRange(tmpGroup,x,y,250,Filter(function thistype.Filt))
call ForGroup(tmpGroup,function thistype.AddStack)
 
here's the new code
JASS:
..
nevermind the recycling, i'm just experimenting on something
and the grouputils, i need to recycle the group since i can't make it as a global due to some "spell circumstances "
well managed to reduce the fps drop to only 2-12

last thing is, is there any method to stun units which can't be seen due to fog of war?
or is it possible to stun units who are affected by fog of war

or should I use war stomp for that thing?
 
Last edited:
You don't need the groups, you can just use a hashtable and set a boolean to the struct index as the first key and the unit's handle ID as the second key. You can also initialize tmpGroup from the globals block, and the hashtable as well.

JASS:
                if @i - (i / 6) * 6 <= 0@ then //You can simplify this to i == i / 6 * 6
                    call DestroyEffect(AddSpecialEffect(DUST,x,y))
                    call DestroyEffect(AddSpecialEffect(VOLC,x,y))
                endif
 
JASS:
call GroupClear(this.g)         -> call FlushChildHashtable(ht, this)
call GroupRemoveUnit(this.g, u) -> call RemoveSavedBoolean(ht, this, GetHandleId(u))
call GroupAddUnit(this.g, u)    -> call SaveBoolean(ht, this, GetHandleId(u), true)
set this.g = CreateGroup()      -> //you don't need this since you just use the one hashtable

If the dummy is owned by a neutral computer player I don't think it needs vision.
 
Status
Not open for further replies.
Back
Top