Author Topic: sphere & pickup .ID  (Read 1045 times)

JamesConway

  • Newbie
  • *
  • Posts: 39
  • Karma: +9/-3
    • View Profile
sphere & pickup .ID
« on: February 04, 2016, 11: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:

Code: [Select]
        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 however says it should be possible.

Code: [Select]
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
« Last Edit: February 04, 2016, 11:37:03 am by JamesConway »

rwwpl

  • Full Member
  • ***
  • Posts: 126
  • Karma: +18/-6
  • LU-DM Team
    • View Profile
    • LU-DM Team
Re: sphere & pickup .ID
« Reply #1 on: February 04, 2016, 02:07:53 pm »
For me, works good (your example also works).

Code: [Select]
local Garage03 = CreatePickup(1392,Vector(1087.4,-572.1,14.7)); //Luigi Lockup
print(Garage03.ID);

Code: [Select]
Garage03 <- CreatePickup(1392,Vector(1087.4,-572.1,14.7)); //Luigi Lockup
print(Garage03.ID);
« Last Edit: February 04, 2016, 02:09:52 pm by rwwpl »

JamesConway

  • Newbie
  • *
  • Posts: 39
  • Karma: +9/-3
    • View Profile
Re: sphere & pickup .ID
« Reply #2 on: February 04, 2016, 02:40:35 pm »
I have made a rather dumb error and had defined a class Sphere myself, which caused the error.

 

© Liberty Unleashed Team.