Scripts / get_ObjectID

Author
Message
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 17th May 2019 18:47
Looking in global, forums etc, can't seem to
find a get object id # call. Hmmm.... would make
just a few scripts a little easier. I have had instances
where just editing the properties, and even saving
the map changes the object number... ?! eh what?!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th May 2019 20:26
the object number is passed into the init(), main() and exit() functions as 'e'
so you can get it by doing something like
SetPosition(e,0,0,0)
will place the object running the script at 0,0,0

if you are referring to the AI number that can be found with g_Entity[e]['obj'] (though this number is only used for a few commands)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 17th May 2019 22:36
The object id is the actual identifier of the real 'object', the entity id is allocated to 'dynamic' entities on the fly and is how GG connects Lua scripts to real objects internally.

An object may not have an entity id btw.

Some Lua commands use entity ids but some need object ids. For example the ray casting commands return the object id because they may detect an object that doesn't have an entity id (i.e. a static entity).

Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 19th May 2019 19:28
Yes, thanks for the help. Conquered two (at least)
issues with one swing!
Very nice forums help-- this is the BEST anywhere-
bar NONE!
I used that object ID for a ScaleObject- so super!
Also, regular entity ID's stumped me until I made
them dynamic.... blrrrbblrrrb!
PM

Login to post a reply

Server time is: 2024-04-19 06:44:18
Your offset time is: 2024-04-19 06:44:18