Move Speed Crashes

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.

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
 

XeNiM666

I lurk for pizza
Reaction score
138
JASS:
private function Setup takes nothing returns nothing
    local group g = CreateGroup()
    set SS = DivideString(GetEventPlayerChatString(),1) // I think you're missing an array on the SS variable
    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


also where did you get the SplitStrings struct?
 

Azlier

Old World Ghost
Reaction score
461
Yes, I use Romek's DivideStrings. It's absolutely perfect for putting together an RP map. And, no. I use the same SplitStrings syntax all over, and this is the only trigger that crashes.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top