Jump to content

Prefab to full name?

Recommended Posts

inst.prefab is only usable when i have an instance of the prefab. It's also not what i need since it gives me the prefab name, but not the full name.

As an example: I have the prefab "eyebrellahat". What i want is a way to translate this to "Eyebrella" without spawning the prefab and calling inst.name

What i am currently doing is something like this and it just feels bad in a performance way:

local prefab_spawncode = "eyebrellahat"
local inst = SpawnPrefab(prefab_spawncode)
local prefab_name = inst.name -- This returns "Eyebrella"


Edited by BakaSchwarz
Link to comment
Share on other sites

It almost seems like your trying to get the STRINGS.NAMES[spawncode] for the prefab right?

If that is what you are trying to do, I found this blurb from entityscript.

--line 646 in function EntityScript:SetPrefabName(name)

Replacing self.prefab with a string like "eyebrellahat" gives me the string name that you get when you hover over stuff.

Hope that helps



Edited by IronHunter
typographical errors
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...