So, I've been trying to access the prototype programmatically but I've been running into the problem of "luaEntityPrototype doesn't have readable property X"
To be more specific, I wanted to access the max_health parameter of the entity (because I am trying to create different entities dynamically through createentity, for example creating a biter with random amount of max health). Is there currently a way to do this?
If not, I can always create a table that keeps a mapping of the entity to its max hp on creation but i would like to avoid that if possible.
Thanks in advance!
EDIT: To be clearer, I am setting up a point system where the point is a function of the max_health of the unit killed. So I would like to know the hp of the unit being killed when onentitdied event pops up.
EDIT2: Well it seems I can't dynamically generate new type of enemies, but I could still use a loop to create multiple different types.
Accessing the prototype data that the unit was created with?
Re: Accessing the prototype data that the unit was created w
Just guessing, you try to create a td-like scenario?! That would be awesome.
Anyway back to topic:
There is a typo on the wiki. You can access the maximum health of the prototype with "maxhealth" instead of max_health...
But it is read only, so not really what you wanted I guess.
You could create different entities (or use a function that does the work for you) which share the same sprite but have different maxhealth-values (but not random-values, though)
Hope that helps
Anyway back to topic:
There is a typo on the wiki. You can access the maximum health of the prototype with "maxhealth" instead of max_health...
But it is read only, so not really what you wanted I guess.
You could create different entities (or use a function that does the work for you) which share the same sprite but have different maxhealth-values (but not random-values, though)
Hope that helps
Re: Accessing the prototype data that the unit was created w
Yup, you got it! I was trying to make a td like scenario! And thanks, that is actually good enough for now!