Driven keys in Blender? for specific problem

ok say I want a ball to bounce. no sweat. now say I want an expression that says “when the ball is at X height, Ball will squash by a lattice n amount” OR “when ball is at X height (i.e. impact with the floor) it turns on particles or emits a hundred particles”. how would I go about doing this? do I have to use python or could I do it with datablocks?