As you have described it im guessing that the variable you’ve defined would look something like this right?
local Velocity = 0 -- just an example
Velocity = Velocity + 0.2 -- still an example
If you want the variable to be unique per entity, you shouldnt define it like that, because that will be the same variable for EACH of them.
So what you should do is create a variable INSIDE the entity. How do you do this you ask?
Just concatenating the Entity on Initialize and setting a variable inside it or as robotboy said out of it indexing the ENT being created. Example:
self.Velocity = 0 -- Variable is defined here for each different entity created from your entity base (or just entity)
ENT.Velocity = 0
So basically now the variable you have to use in hooks like think is instead of “Velocity” would be “ENT.Velocity”, being ENT the entity and therefore it being replaced by “self” in most of the entity hooks. So the think hook for it would finish something like this:
self.Velocity = self.Velocity + 0.2
This is exactly the same as before, but being a unique velocity per each entity created.
[editline]28th October 2016[/editline]