I was wondering if anyone could give me some sample code to create cargo planes in JavaScript. I am not good with Lua at all and trying to convert the code from other plugins to JavaScript myself just gives a bunch of errors. I can't get the GameManager object to do what it's supposed to and I can't seem to get the UnityEngine to respond at all. Also how cancelling events work if possible. Any help would be appreciated. And yes, I am aware that I am just terrible at this and that's why I can't get it to work.
Solved Creating cargo planes (JavaScript)
Discussion in 'Rust Development' started by UnrulyMyth, Jan 31, 2015.
-
What do you mean by cancelling events? Timer?
Code:var RepeatTimer = timer.Repeat(1, 5, function () { var random = new System.Random(); print("Random cs number: " + random.Next(0, 10)); print("Random js number: " + Math.random()); }, null); // interval, repetitions, callback, plugin RepeatTimer.Destroy(); // kill timer if not needed anymore
Code:var global = importNamespace(""); var UnityEngine = importNamespace("UnityEngine"); var destination = new UnityEngine.Vector3(0, 500, 0); // or UnityEngine.Vector3.zero var quaternion = new UnityEngine.Quaternion(0, 0, 0, 0); var Supply_Drop = global.GameManager.server.CreateEntity("items/supply_drop", destination, quaternion); Supply_Drop.Spawn(true);
-
-
Wulf Community Admin
-