BloxGaming Forums

Our Servers => BloxGaming SB3 => Expression 2 (E2) Code => Topic started by: kevinminion on November 14, 2016, 10:58:44 pm

Title: Trying to get a list of planet names?
Post by: kevinminion on November 14, 2016, 10:58:44 pm

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?
Title: Re: Trying to get a list of planet names?
Post by: bloxgate on November 15, 2016, 12:05:21 am
Look in E2Helper for getPlanetName. Just target the planet's entity, and give that to the function.
Title: Re: Trying to get a list of planet names?
Post by: kevinminion on November 15, 2016, 09:06:25 pm
@bloxgate Thank you for the nudge in the right direction, the code snippet below is working for me now.

Code: [Select]
        findByClass("logic_case")
        Planets = findToArray() # returns array of entities
       
        for(K=1,Planets:count()) {
            ThisPlanet = Planets[K,entity]
            print(K + ": " + getPlanetName(ThisPlanet) + " : " + ThisPlanet:pos())
        }