License from €75
DE EN FR ES IT CZ

mainLoop and character switching

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 4 years ago
    Is it possible to be notified of when a character is changed by listening to the mainLoop events?
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license. Forum readers get the Indie Bundle 15 % off with the code FORUM15: €84.15 instead of €99, valid until 31 Dec 2026.

    Get 15 % off Try it for free
  3. · 4 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


This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?