Page 1 of 1

How to get map info

Posted: Sat Apr 28, 2018 9:28 am
by Akitake
Hi,

I want to get the current level's boundaries, I assume I have two choices:
I can either use get_datamap_property_vector() with "m_WorldMaxs" and "m_WorldMins" OR entity.mins and entity.maxs

I know the world's entity inthandle is 0, but it's not like I can do 0.get_datamap_property_vector(...), I have to get the actual entity "variable"
Question is, how to get the entity from its ID/inthandle as you guys call it ?

Re: How to get map info

Posted: Sat Apr 28, 2018 11:46 am
by satoon101
The Entity class requires an index (not an inthandle), which as you already know is 0 for the world entity:

Syntax: Select all

from entities.entity import Entity

world_entity = Entity(0)

Re: How to get map info

Posted: Sat Apr 28, 2018 1:16 pm
by Akitake
Ah thanks, I didn't know Entity also was a function, that's what I was looking for.
Thanks o/

Re: How to get map info

Posted: Sat Apr 28, 2018 2:43 pm
by satoon101
Actually, it's not a function, it's a class:
https://docs.python.org/3/tutorial/classes.html

Re: How to get map info

Posted: Sun Apr 29, 2018 7:03 pm
by Akitake
Isn't it.. both? I mean sure Entity is a class but you used the Entity(int i) method above, so.. function too heh

Re: How to get map info

Posted: Sun Apr 29, 2018 8:15 pm
by Ayuto
No, it's a class and by doing Entity(<index>) you call the constructor of the Entity class to create an instance of it.

Re: How to get map info

Posted: Tue May 01, 2018 2:09 am
by L'In20Cible
You can also use the WORLD_ENTITY_INDEX constant, and the world_mins/world_maxs properties:

Syntax: Select all

from entities.constants import WORLD_ENTITY_INDEX
from entities.entity import Entity

world_entity = Entity(WORLD_ENTITY_INDEX)
mins = world_entity.world_mins
maxs = world_entity.world_maxs