Entity specific vars

Hello FP,
I wanted to code an entity today, which uses some vars for times etc
but when I spawn a 2nd entity, it sets both entities vars, how would I go about it making entity specific ones?

entity.MyVariable = “blah”

Where entity is the entity object.

[editline]18th August 2015[/editline]

Do not make your variables like ENT.blah in the entity file, use self.blah in ENT:* functions.

like in the init function?, besides if I create vars there, they arent accessable in other functions eg ENT:Draw :x

Yes, like the Initialize function. They aren’t accessible because you are probably trying to access a serverside variable on the client, which will never work and you have to network in any way you prefer.

Initialize is a SHARED function ( called on client in multiplayer and on server in any case ), ENT.Draw is a CLIENTSIDE function, meaning it is only called on client.


Wat? The purpose of local variables is to be inaccessible outside of the scope where they were defined. If you want them to be accessible outside then define them outside of a function. What exactly are you trying to do anyway? Can you show us an example?