Azlier
Old World Ghost
- Reaction score
- 461
Kvetha, fricai. It seems that my move speed trigger can cause crashes, headaches, and carpal tunnel. I have no idea what the cause is.
It crashes when I change a unit's speed to 500, and then to something lower like 100.
View attachment 27759
It crashes when I change a unit's speed to 500, and then to something lower like 100.
JASS:
scope MoveSpeed initializer Init
globals
private SplitStrings SS
endglobals
private function Actions takes nothing returns nothing
local unit u = GetEnumUnit()
local real speed = S2R(SS[1])
call SetUnitMoveSpeed(u,speed)
set u = null
endfunction
private function Setup takes nothing returns nothing
local group g = CreateGroup()
set SS = DivideString(GetEventPlayerChatString(),1)
if SS[0] == "ms" or SS[0] == "speed" then
call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,Filter(function SelectFilter))
call ForGroup(g,function Actions)
endif
call DestroyGroup(g)
set g = null
call SS.destroy()
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerChatEvent(t,Player(i),"",false)
set i = i + 1
exitwhen i >= 11
endloop
call TriggerAddAction(t, function Setup)
endfunction
endscope
View attachment 27759