Hey All,
Once again I have a question regarding scripting. In this script I'm creating a container with:
var id = generator.AddContainer(system_id, coords.x, coords.y, "crate_01", "droplist_prefab_cargo_01");
This successfully creates the container and it has an item from the droplist. Then I'm adding to the contents of the cointainer:
generator.AddItemToSpecifiedContainer(id, "ore_glepsite", 100);
And am getting the following errors
Exception System.NullReferenceException: Object reference not set to an instance of an object.
-------------------------stack-------------------------
at rnA5O51oAmWki8OOWMc.aQgYqT15sxbFCsxqoXP.MKGC106AoI(String , UInt16 , UInt32 )
at AtomicTorch.SpaceRPG.Server.Scripting.GlobalScopes.ScopeGenerator.AddItemToSpecifiedContainer(Int32 container_id, String item_type, Int32 quantity)
at binder_for_AtomicTorch.SpaceRPG.Server.Scripting.GlobalScopes.ScopeGenerator.AddItemToSpecifiedContainer(ScriptEngine , Object , Object[] )
at Jurassic.Compiler.Binder.Call(ScriptEngine engine, Object thisObject, Object[] arguments)
at Jurassic.Library.ClrFunction.CallLateBound(Object thisObject, Object[] arguments)
at Jurassic.Library.FunctionInstance.CallWithStackTrace(String path, String function, Int32 line, Object thisObject, Object[] argumentValues)
at LDTOnShipDestroyedHandler(ScriptEngine , Scope , Object , FunctionInstance , Object[] )
at Jurassic.Library.UserDefinedFunction.CallLateBound(Object thisObject, Object[] argumentValues)
at Jurassic.ScriptEngine.CallGlobalFunction(String functionName, Object[] argumentValues)
at nU9kl611aPOvHoTVi1k.VbN3XJ1PDhia7P4WrTi.fKNZ6qRgJm(String , Object )
Any ideas,
-Loudent
Hello!
It seems the AddItemToSpecifiedContainer() cannot find the container by the specified ID (the error message will be improved in the next build).
What the result of generator.AddContainer() function call? If it zero, that means the container is not created.
The return was a non-zero id.
I know the call to create the container was successful because I saw the container in the game. It's simply that it doesn't allow me to add anything to it.
although, perhaps that's the nature of those types of container. It spawns with whatever is in there and that's it?
No, you should be able to add items to the container.
That's strange. Could you provide me a script/mod please?
Honestly there's not much more than what I posted here. the script exists mostly to test how to do it but you can find the whole thing at:
https://www.dropbox.com/s/bqsyfyigsqxvlpy/JetCargoOnDeath.zip?dl=0