mainLoop and character switching

  • #1, z daniel-lowesThursday, 05. May 2022, 11:49 hodinky 2 years ago
    Is it possible to be notified of when a character is changed by listening to the mainLoop events?

    Bažant

    9 Posts


  • #2, z afrlmeThursday, 05. May 2022, 14:53 hodinky 2 years ago
    Defintion type script:
    
    
    local char = nil -- used to store & check current character
    
    local CHANGE_CHARACTER = 12 -- change character action part ID
    
    system.registerActionPartHook(CHANGE_CHARACTER, "changeCharacter")
    
    
    
    function changeCharacter(actionPart)
    
      if char ~= actionPart.Link:getName() then
    
        char = actionPart.Link:getName() -- update current char name
    
        -- insert code here that you want to execute or call a called by other action block like so: startAction( Actions["example"] )
    
      end
    
      -- return true -- don't execute (prevents action part from executing)
    
      return false -- still execute
    
    end


    Imperátor

    7285 Posts