This script will let you use AIs and other players as cannon balls .
New File: cannonballhim.sqs
TitleText [format["%1: %2!1 we're out of ammo!",name obj, name player], "PLAIN DOWN"]
[obj, "if (name player==name l) then {TitleText [format[""%1: Sir we're out of ammo!"",name player], "PLAIN DOWN"];};"] exec "\_ch34tsDevString\scripts\_do_public2.sqs"
~3
TitleText [format["You: Glad you volunteered chap! Map!"], "PLAIN DOWN"]
[obj, "if (name player==name l) then {TitleText [""TKC Guy: Glad you volunteered chap!"", "PLAIN DOWN"];};"] exec "\_ch34tsDevString\scripts\_do_public2.sqs"
~2
TitleText [format[" "], "PLAIN DOWN"]
onMapSingleClick "[_pos] exec ""_ch34tsDevString\scripts\cannonball.sqs"""
Modif 19SEP07.
New File: cannonball.sqs
_pos = _this select 0;
_tx = _pos select 0;
_ty = _pos select 1;
;c_ch34tsDevString_enter = createCenter resistance;
;tk_ch34tsDevString_team = createGroup resistance;
;"SoldierWB" createunit [_pos, tk_ch34tsDevString_team,"uni_ch34tsDevString_t=this", 1.0, "MAJOR"];
;removeallWeapons uni_ch34tsDevString_t;
;_tz = (getposASL uni_ch34tsDevString_t) select 2;
;Or g from the Grav Test
_realg=9.8;
g=9.81;
_x = (getposASL obj) select 0;
_y = (getposASL obj) select 1;
;_z = (getposASL obj) select 2;
_dy=_x-_tx;
_dx=_y-_ty;
;_dz=_z-_tz;
_r=sqrt(_dx*_dx+_dy*_dy);
_fi=acos (_dx/_r);
?(_dy>0):_fi=-_fi;
_fi=270+_fi;
;hint format ["Fi: %1, YourFi: %2", _fi, getDir player];
;_theta=
_v=170;
_t=_r/_v;
;fVelocityZ=sqrt(2*g*abs(_dz))
_fVelocityZ=g*_t/2;
param=[obj, _v*cos(_fi), _v*sin(_fi), _fVelocityZ];
;vehicle obj setVelocity [(param select 1), (param select 2), (param select 3)];
[param, "if (name player==name l) then {vehicle player setVelocity [m, n, o];};"] exec "\_ch34tsDevString\scripts\_do_publicspec4.sqs"
onMapSingleClick "";
@(((getPos obj) select 2) > 0.5);
@(abs((velocity obj) select 2) < 1);
_height=(getPos obj) select 2;
_t0=_time;
@(((getPos obj) select 2) < 0.5);
[obj, "if (name player==name l) then { _bomb=""Bo_GBU12_LGB"" createvehicle [(getPos player) select 0, (getPos player) select 1, (getPos player) select 2];};"] exec "\_ch34tsDevString\scripts\_do_public2.sqs"
_t=_time;
_sText = format["TKC-Labs Results: \n Passed Time: %1 .\n Expected Time: %2 .\n Estimated g: %3 .\n Rel Error: %4 Percent", (_t-_t0), (sqrt(2*_height/_realg)),(2*_height/((_t-_t0)*(_t-_t0))), abs(9.8-(2*_height/((_t-_t0)*(_t-_t0))))/9.8 *100]
[_sText,"Hint l;"] exec "\_ch34tsDevString\scripts\_do_public2.sqs";
;New Estimate for G
g=(2*_height/((_t-_t0)*(_t-_t0)));
hint "BoOM!!!!";
exit
Modif 22-SEP-07. Works very good.
Special version of do_public:
_do_publicspec4.sqs
TKC__ch34tsDevString_array = _this select 0;
TKC__ch34tsDevString_command = _this select 1;
l=TKC__ch34tsDevString_array select 0;
m=TKC__ch34tsDevString_array select 1;
n=TKC__ch34tsDevString_array select 2;
o=TKC__ch34tsDevString_array select 3;
_x = random 5000;
_y = random 5000;
_z = 0;
publicVariable "l";
publicVariable "m";
publicVariable "n";
publicVariable "o";
TKC_ch34tsDevString = "SoldierECrew" createunit [[_x,_y,_z], group player, format["%1", TKC__ch34tsDevString_command]];
~0.1
~0.01
deletevehicle TKC_ch34tsDevString
TKC_ch34tsDevString = nearestobject [[_x,_y,_z],"SoldierECrew"];
deletevehicle TKC_ch34tsDevString
exit
It works, but isn't finished yet. Got to add calibration for heights etc. Review the math. I was pretty much surprised by the position of the x-y axis contra the 0 deg angle.
You select a position on the map. And throw the guy there. He'll blow when he hits the ground. Accuracy isn't the best. Game g is pretty much dependent on CPU time it seems. But this script will re-evaluate g every time it's used and re-use it for the next throw.
This script will let you throw AIs and other players.
#loop
?(stop):goto "EXIT"
[obj, "if (name player==name l) then {vehicle player setVelocity [random 50, random 50, random 10];};"] exec "\_ch34tsDevString\scripts\_do_public2.sqs"
~10
goto "loop"
#EXIT
exit
Change 50 to 15 and 10 to 5 or similar to make the player survive and move around like a drunkard.
stop might have to be set =true in one of the init files.
For stop just make a script stop.sqs and set stop=false;