I believe this should be possible.
I want to randomly drop an object in a square area 416 x 416.
Which means it is divided into 13 square grids 32 x 32.
I want to drop the object squarely in the center of any one of these grids.
This is the code that drops the object randomly:
myObject = ent_create("physics_test.mdl",vector(random(384)-192,random(384)-192,340),NULL);
phent_settype(myObject,PH_RIGID,PH_SPHERE);
phent_setmass(myObject,360,PH_SPHERE);
phent_setfriction(myObject,100);
phent_setelasticity(myObject,15,100);
//phent_setdamping(myObject,30,5);
ph_setgravity(vector(0,0,-500));
I know this requires some maths.
I tried using sqrt(), but I am not getting it right.
Can someone help me out here please?