How to get map info

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Akitake
Junior Member
Posts: 4
Joined: Fri Apr 27, 2018 2:15 pm

How to get map info

Postby Akitake » Sat Apr 28, 2018 9:28 am

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 ?
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: How to get map info

Postby satoon101 » Sat Apr 28, 2018 11:46 am

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)
Image
User avatar
Akitake
Junior Member
Posts: 4
Joined: Fri Apr 27, 2018 2:15 pm

Re: How to get map info

Postby Akitake » Sat Apr 28, 2018 1:16 pm

Ah thanks, I didn't know Entity also was a function, that's what I was looking for.
Thanks o/
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: How to get map info

Postby satoon101 » Sat Apr 28, 2018 2:43 pm

Actually, it's not a function, it's a class:
https://docs.python.org/3/tutorial/classes.html
Image
User avatar
Akitake
Junior Member
Posts: 4
Joined: Fri Apr 27, 2018 2:15 pm

Re: How to get map info

Postby Akitake » Sun Apr 29, 2018 7:03 pm

Isn't it.. both? I mean sure Entity is a class but you used the Entity(int i) method above, so.. function too heh
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: How to get map info

Postby Ayuto » Sun Apr 29, 2018 8:15 pm

No, it's a class and by doing Entity(<index>) you call the constructor of the Entity class to create an instance of it.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: How to get map info

Postby L'In20Cible » Tue May 01, 2018 2:09 am

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

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 20 guests