Liberty Unleashed
Scripting => Script Help => Topic started by: JamesConway on February 04, 2016, 10:10:16 am
-
Hello
Somehow I can't get the ID of pickup and spheres. I can get the ID of a vehicle and object.
This is the code I have with it:
local sphere = CreateSphere(Vector(0,0,0), 5.0, Colour(153, 0, 0));
local pickup = CreatePickup(1362, Vector(0, 0, 0) );
local vehicle = CreateVehicle( VEH_INFERNUS, Vector(0, 0, 0), 5.0, -1, -1 );
local object = CreateObject( 1378, Vector(0, 0, 0) );
// doesn't work
print(sphere.ID);
print(pickup.ID);
// works
print(vehicle.ID);
print(object.ID);
Is there something I'm doing wrong? The other types like .Owner or .Pos doesn't work either on spheres and pickups. The wiki (http://liberty-unleashed.co.uk/LUWiki/Squirrel/Server/Functions/Spheres/ID) however says it should be possible.
AN ERROR HAS OCCURED [the index 'ID' does not exist]
<04/02/2016 - 11:06:59>
CALLSTACK
<04/02/2016 - 11:06:59> *FUNCTION [onScriptLoad()] Scripts/Main/main.nut line [64]
<04/02/2016 - 11:06:59>
LOCALS
<04/02/2016 - 11:06:59> [object] INSTANCE
<04/02/2016 - 11:06:59> [vehicle] INSTANCE
<04/02/2016 - 11:06:59> [pickup] INSTANCE
<04/02/2016 - 11:06:59> [sphere] INSTANCE
<04/02/2016 - 11:06:59> [this] TABLE
-
For me, works good (your example also works).
local Garage03 = CreatePickup(1392,Vector(1087.4,-572.1,14.7)); //Luigi Lockup
print(Garage03.ID);
Garage03 <- CreatePickup(1392,Vector(1087.4,-572.1,14.7)); //Luigi Lockup
print(Garage03.ID);
-
I have made a rather dumb error and had defined a class Sphere myself, which caused the error.