How to change the velocity of an entity (make it bounce off walls)?
Information by Greg Lewis. It seems that an entity’s velocity can’t be changed in the Touch function of the entity. Making the calculations there will be of no use. So just set entity.movetype to MOVETYPE_BOUNCE, entity.nextthink to 0.1 (to let it bounce off), and set entity.think to the name of a function that, when called 0.1 second later, will set entity.velocity to the right direction.