Help on getting spawn point
Help on getting spawn point
Hey !
I want to know if it's possible to generate and get all info_deathmatch_spawn coordinate in vector ?
Sincerly Existenz.
I want to know if it's possible to generate and get all info_deathmatch_spawn coordinate in vector ?
Sincerly Existenz.
Re: Help on getting spawn point
Untested, but I believe this is correct:
Syntax: Select all
from engines.server import global_vars
from filters.entities import EntityIter
from listeners import OnLevelInit
from mathlib import Vector
# This will be called on both OnLevelInit and "sp plugin load <this_plugin>"
@OnLevelInit
def load(map_name=None):
# This happens when the plugin is loaded via autoexec.cfg or server.cfg
if global_vars.map_name is None:
return
all_spawn_coords = [
Vector(*entity.origin) for entity in EntityIter('info_deathmatch_spawn')
]
Re: Help on getting spawn point
Cool :D.
Thanks
Thanks
Re: Help on getting spawn point
I have try it's always empty even if i had mp_randomspawn 1 (https://developer.valvesoftware.com/wik ... atch_spawn).
I have try on de_dust2.
I have try on de_dust2.
Re: Help on getting spawn point
One of two things is likely the issue.
- You have to wait 1 tick till those are on the server after map start
- That is not the correct entity name, and instead you have to use info_player_terrorist and info_player_counterterrorist
Re: Help on getting spawn point
I use it at round_start so no tick problem.
And info_player_terrorist and info_player_counterterrorist are for default t or ct spawn no ?
And info_player_terrorist and info_player_counterterrorist are for default t or ct spawn no ?
Re: Help on getting spawn point
Correct. Those are the entity names used in GunGame's Random Spawn sub-plugin.
Re: Help on getting spawn point
But i don't want to use ct and t default spawn, i need a real random spawn normaly generate by info_deathmatch_spawn :s
Re: Help on getting spawn point
Well, what do you get when you use the following:
Also, if there is at least 1 of those, would you let me know the output of this, as well:
Syntax: Select all
print(len(EntityIter('info_deathmatch_spawn')))
Also, if there is at least 1 of those, would you let me know the output of this, as well:
Syntax: Select all
print([server_class.__name__ for server_class in Entity.find('info_deathmatch_spawn').server_classes])
Re: Help on getting spawn point
Ooooooh, I just remembered that those 2 entities aren't networked on CS:GO. I bet info_deathmatch_spawn isn't, either. That means you have to use BaseEntityIter. BaseEntity objects don't have the added capabilities that Entity objects do, so you will have to use BaseEntity.get_key_value_vector directly.
Re: Help on getting spawn point
Okay :) Thanks i will try at the end of the day.
And what does that mean networked entity ?
And what does that mean networked entity ?
Re: Help on getting spawn point
Hey !
I try that and it doesn't work :S
I try that and it doesn't work :S
Syntax: Select all
SayText2(str(BaseEntityIter('info_deathmatch_spawn'))).send()
# <filters.entities.BaseEntityIter object at 0xea94d14c>
SayText2(str(len(BaseEntityIter('info_deathmatch_spawn')))).send()
# 0
SayText2(str([server_class.__name__ for server_class in BaseEntity.find('info_deathmatch_spawn').server_classes])).send()
# AttributeError: 'NoneType' object has no attribute 'server_classes'
Re: Help on getting spawn point
That means it didn't find any of those entities on the server. To help figure it out, maybe use the following to find all entity types on the server:
Syntax: Select all
for classname in sorted({base_entity.classname for base_entity in BaseEntityIter()}):
print(classname)
Re: Help on getting spawn point
Ok i don't find it yes.
But if i add mp_randomspawn 1 it appear so how i can get the vector ?
But if i add mp_randomspawn 1 it appear so how i can get the vector ?
Syntax: Select all
SayText2(str(len(BaseEntityIter('info_deathmatch_spawn')))).send()
# 21
for entity in BaseEntityIter('info_deathmatch_spawn'):
SayText2(str(entity.get_key_value_vector('angles'))).send() # Always 0,0,0
Re: Help on getting spawn point
Ah i understand, It's the same like player.origin or entity.origin. I was looking on https://developer.valvesoftware.com/wik ... atch_spawn and i have just see angles so i don't know that have an origin :)
It works fine !
Thanks :)
It works fine !
Thanks :)
Re: Help on getting spawn point
Yeah, player.origin and entity.origin automatically call get_key_value_vector internally.
Return to “General Discussion”
Who is online
Users browsing this forum: No registered users and 115 guests