Our Servers > Expression 2 (E2) Code
Trying to get a list of planet names?
(1/1)
kevinminion:
It's late, so maybe I'm just missing something...
I'm trying to use PlanetName = MyEntity:sbEnvName() to grab a list of all planet names in a map, but most everything I've tried to plug in for MyEntity returns an empty string.
PlanetName = owner():sbEnvName() returns the expected string
I've tried creating holos at the planet centers and then using PlanetName = Holo:sbEnvName() but that also returns an empty string.
Is there another way to get all of the planet names?
bloxgate:
Look in E2Helper for getPlanetName. Just target the planet's entity, and give that to the function.
kevinminion:
@bloxgate Thank you for the nudge in the right direction, the code snippet below is working for me now.
--- Code: --- findByClass("logic_case")
Planets = findToArray() # returns array of entities
for(K=1,Planets:count()) {
ThisPlanet = Planets[K,entity]
print(K + ": " + getPlanetName(ThisPlanet) + " : " + ThisPlanet:pos())
}
--- End code ---
Navigation
[0] Message Index
Go to full version