Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

mainLoop and character switching

  • #1, by daniel-lowes 4 years ago Zitieren
    Is it possible to be notified of when a character is changed by listening to the mainLoop events?
  • #2, by afrlme 4 years ago Zitieren
    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