ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Get the position of an object

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  17:36:15  12 March 2014
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
 

Message edited by:
SacriPan
03/12/2014 17:38:05
Messages: 319
HOW TO Get the position of an object

Hi STALKERS,

I'm looking for a way to get the position of a known object in the game (I have its ID).

I need the coordinates (x, y, z), the level_vertex_id and the game_vertex_id.


I saw that some time ago Dezowave released a tool to save "patrol points" or something like that. It shows a new window when pressing a defined key in the main menu.
In this window, we can read the coordinates, the level_vertex_id and the game_vertex_id, well, everything I need.

But the way they get this information only seems to work for the actor, not for an other object.

For example, the "x" coordinates is retrieved like this (IIRC):


db.actor():position().x




Do one of you know a way to do that but for any other object than the actor itself?
  17:49:58  12 March 2014
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
It should work the same for an object, assuming it is online. If it is offline then you need to use :
s_obj.position
s_obj.m_level_vertex_id
s_obj.m_game_vertex_id

  18:36:07  12 March 2014
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
Messages: 319
Thanks Vintar.

The object is online. The log says invalid method or something like that. I'll edit this post in some minutes when I'm home to post the exact error




By the way, how to delete an object that is offline (in an other level)? I have the ID too.
  19:02:15  12 March 2014
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
 

Message edited by:
TKGP
03/12/2014 19:02:50
Messages: 454

---QUOTATION---
The object is online. The log says invalid method or something like that.
---END QUOTATION---


You need to make sure you have a client object reference first; if you have the ID, just call level.object_by_id( [ID goes here] ). That returns a client object (if it is actually online).

---QUOTATION---
By the way, how to delete an object that is offline (in an other level)?
---END QUOTATION---


alife():release( [server object reference] ). If you have an ID you can get the server object from alife():object( [ID goes here] ).
  20:31:03  12 March 2014
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
 

Message edited by:
SacriPan
03/12/2014 20:34:01
Messages: 319
Thanks TKGP,

Both functions are performing well
Though I already used the second one and it didn't delete offline object. Maybe I didn't have the right ID at that time.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2021 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.