Modding Help Unstale (nightly) world.callScriptedEntity return error

Discussion in 'Starbound Modding' started by lillgrinn, Jul 5, 2015.

  1. lillgrinn

    lillgrinn Phantasmal Quasar

    After use in Unstable (nightly) this code:
    Code:
    world.logInfo("%s", console.sourceEntity())
    world.callScriptedEntity(console.sourceEntity(), "MyFunc", params)
    game make error like this:
    Code:
    10
    (StarException) Entity 10 does not exist or is not a local master scripted entity
    Why? :confused:
    P.S.: In Unstable (not nightly) and Stable version all working.
     
  2. Storm_UK

    Storm_UK Existential Complex

    Best Answer
    For unstable/nightly, you need to use this instead now:

    In your console script -
    Code:
    world.sendEntityMessage(console.sourceEntity(), "Myfunc", params)
    
    In the objects script, within its init -
    Code:
      message.setHandler("MyFunc", function(_, _, params)
          MyFunc(params)
        end)
    
    - which will then call the defined function elsewhere in your objects script.

    Note that world.callScriptedEntity will still function between objects.
     
  3. lillgrinn

    lillgrinn Phantasmal Quasar

    Solved. Thank you very much.
     
  4. trevtrev800

    trevtrev800 Pangalactic Porcupine

    Thanks this saved me too! I had a function with no params. Here is how I did it, in case anyone else has that.

    In your console script -
    Code:
    world.sendEntityMessage(console.sourceEntity(), "Myfunc")
    
    In the objects script, within its init -
    Code:
      message.setHandler("MyFunc", function(_, _)
          MyFunc()
        end)
    
     

Share This Page