The empty pointer error means that "player" doesn't relate to anything. You need to make sure that you set the player pointer to a valid entity either by using it in an action like "player = me" or from the result of an ent_create call >> "player = ent_create(...)".