View Issue Details

IDProjectCategoryView StatusLast Update
0005499New Feature RequestsGeneralpublic2018-09-03 17:51
Reporterkarloz Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionsuspended 
Summary0005499: getNativeObjectsByID
Description

If the information is accesible from SA object lists, it could be useful to retrieve information like all objects of an specific id, position, rotation.

In example, to create a vending resource, istead of manually locate every vending machine in world. You could use this to dinamically locate the objects and add the functionality.

Or other type of resources like a casino.

getElementsByType only returns objects created by MTASA map/resources

TagsNo tags attached.

Activities

karloz

2010-07-25 20:33

viewer   ~~0011824

hmm maybe the objects pool only contain streamed objects?
even in this case it could be useful, as you could do

onClientRender
getNativeObjectsByID ...

and build stuff dinamically as it is streamed by client

Devan_LT

2010-07-28 15:04

viewer   ~~0011846

Last edited: 2010-07-29 12:56

AFAIK, objects and IPL instances aren't the same. And you don't need to manually locate every vending machine. I had created a program that reads IPL files and finds all vending machines. You could try doing the same. Controlling IPL objects would be nice, though.
Edit: I tried to change item placement position in GTA SA with cheat engine by writing into memory during the game. It worked. Because controlling IPL instances is so possible, it would be nice if MTA could do that. IPL instances could be a subtype of objects. GTA SA can have a few hundred objects, but number of IPL instances is much higher. If MTA could create IPL instances, the gameplay with custom maps would be smoother.

ccw

2010-07-30 07:12

administrator   ~~0011862

Please give us the memory addresses

Maccer

2010-07-30 07:47

viewer   ~~0011864

Last edited: 2010-07-30 11:38

Yes, please do.

But I'm interested in the theory that creating IPL instances would be smoother. And it is kind of hard to modify or get IPL instances because they don't really have any indicator or pointers to the objects. Maybe internally they do, but while it's just some .IPL file, it's just a list and lines of object coordinates with some other parameters.

Also, MTA should have used the GTA internal streamer completely, along with other internal stuff, but a long time ago they chose the streaming to be handled by MTA in a way.


Edit: IPL instances are static, that's probably why they might be more stable.

Devan_LT

2010-07-30 13:34

viewer   ~~0011865

Last edited: 2010-07-30 15:45

The only memory addresses I used were coordinates of IPL instances. They are different each time the game loads. First time I found coordinates of two first IPL instances, from LAn.ipl. Coordinates of first instance were stored at 0x07830024, the ones of second were at 0x0783005C. When I restarted the game, coords of first instance were at 0x07B80024. But position/rotation matrices of peds and vehicles are stored separately from the entities, I mean, ped struct stores only a pointer to the matrix. So it's probably the same for IPL instances. I'm going to analyze the memory to find out more.
Edit: I tried to change the model, but didn't succeed, and I don't know what else I could do.

Maccer

2010-07-31 03:49

viewer   ~~0011871

So you just scanned randomly for the IPL instances, or was there actually a pointer to the pool that you used? Because random memory addresses of instances are kind of useless.

Devan_LT

2010-07-31 14:30

viewer   ~~0011879

Last edited: 2010-08-01 20:31

0x00B74498 contains a pointer.
This pointer:
+0 : points to the first IPL instance
+4 : points to a byte map indicating which elements are being used
+8 : maximum number of IPL instances
+12: current number of IPL instances
Each IPL instance takes 56 bytes.
IPL instance struct:
+4 : X coordinate
+8 : Y coordinate
+12 : Z coordinate
+16 : Z angle in radians
+32 : model. Seems like a pointer to the model or something like that, not ID from IDE.
+44 : timer increasing when IPL instance is streamed in. Must be 2 bytes, as it resets to 0 when reaches 65536.
+48 : pointer to another instance which is LOD of current instance

karloz

2010-08-01 17:18

viewer   ~~0011890

I undertand there is a collection of models GTA loads from IDE and other files (not the models themselves but the list of avaible models).
And there is a list of actual objects in world (instances) that GTA builds from the IPL files to create the world map.
Im obviously refering to the objects in world (call them them instances if you like). Thats not the trouble.

I dont undertand, how MTA is actually inserting and handling objects in GTA? Using GTA functions or placing objects structures directly in GTA object lists?
I thought they already had access to these lists.
Or theres differents lists one for static objects and other for dynamic/on the fly created objects?

Note: tried that info and it changed the collision model position not the object itself.

Devan_LT

2010-08-01 18:18

viewer   ~~0011891

I updated IPL instance struct in my previous post. And yes, you're right, objects are built by GTA from IPL instances. When I was near the IPL instance and changed its data, the object didn't change. But it changes when I modify IPL instance data which is far away.

karloz

2010-08-01 19:25

viewer   ~~0011892

values 0x18(24), 0x28(40) are zero while object is streamed out, when the object is streamed in they change prolly pointing to object data loaded(model/coll?). when you go away and object is streamed out they become zero again.

Devan_LT

2010-08-01 21:09

viewer   ~~0011893

+44 is a timer. It is increasing when IPL instance is streamed in. +20 is set to some value (address?) when you go near the IPL instance and set to 0 after some time when you are away. As you said, value of +40 is an address. That address holds value which is address to the current IPL instance. So the struct pointed to by +40 must be some part of IPL system, but I don't know what data it holds.

Devan_LT

2010-08-02 11:54

viewer   ~~0011896

If it was able to clear the whole map, MTA could have a resource with all GTA SA objects and take over the control of map objects. Then they would be affected by custom DFFs and COLs. That would have both advantages and disadvantages. And MTA streamed in objects limit would need to be increased to maximum GTA SA objects limit, 350, otherwise less objects would be visible.

Maccer

2010-08-05 16:03

viewer   ~~0011911

Okay, I'll take a look at this, but at the moment, how would I say for example... find the second IPL instance with the data you have?

Cazomino05

2010-08-05 16:34

reporter   ~~0011912

wherever the pointer at 0x00B74498 leads to + 56 according to his documentation I guess

Cazomino05

2011-09-18 15:19

reporter   ~~0014815

0x00B74498 is the CBuilding pool for all currently streamed in IPL object instances.

arranTuna

2011-09-18 18:02

manager   ~~0014816

ccw added a thing that lets you select world objects, surely that could be used for intended purpose of drinks machine and casino? You'd do a command or whatever and use the new arguement in processLineOfSight to see if they're near any of the intended object?

Cazomino05

2011-09-19 09:51

reporter   ~~0014820

Last edited: 2011-09-19 09:55

"0x00B74498 contains a pointer.
This pointer:
+0 : points to the first IPL instance
+4 : points to a byte map indicating which elements are being used
+8 : maximum number of IPL instances
+12: current number of IPL instances
Each IPL instance takes 56 bytes.
IPL instance struct:
+4 : X coordinate
+8 : Y coordinate
+12 : Z coordinate
+16 : Z angle in radians
+32 : model. Seems like a pointer to the model or something like that, not ID from IDE.
+44 : timer increasing when IPL instance is streamed in. Must be 2 bytes, as it resets to 0 when reaches 65536.
+48 : pointer to another instance which is LOD of current instance"

That pointer looks like a CEntitySAInterface to me. this is actually an object pool for all the TEXT based IPL files, binary files are loaded when required.

oh and that "ID" is a renderware RpClump object.

Issue History

Date Modified Username Field Change