Hey guys!
In various activities with ArmA, and now ArmA2, I've found myself thinking, "Gee, I wish I could do ..." something, but I always got along without doing it. In an effort to make things easier for myself in ArmA2 work, I decided to go ahead and write these scripts.
They are:
- teleport
- switch the camera to the nearest AI to a point on a mapclick
- start camera sqs at a point near a mapclick
- make a helo appear at a mapclick
Now, these are primarily for devs - people may want to tweak them to "taste." And, there's basically no error catching. If it doesn't work, it is because it didn't find what it was looking for. Which may help in and of itself.
Anyway, here they are, in case anyone else finds them useful. And comments/suggestions are always welcome.
First, the implementation. In the init, I have a section where I do the addactions (and fix the groups-not-moving-on-teamswitch issue).
// @@ dev addactions
_JTD_teleport = player addAction ["teleport", "JTD_teleport.sqf","",10,false,false,""];
_JTD_intCam = player addAction ["Sel int cam", "JTD_intCamInit.sqf","",10,false,false,""];
_JTD_intCam = player addAction ["Remote cam", "JTD_remCamInit.sqf","",10,false,false,""];
_JTD_heloCall = player addAction ["Helo call", "JTD_heloCall.sqf","",10,false,false,""];
onTeamSwitch "selectPlayer (leader _from); {_x doFollow leader _from} foreach units _from; selectPlayer _to;";
// end dev addactions
The simple/tweaked teleport:
hint "Click on MAP to Teleport";
onmapsingleclick "player setpos _pos";
Next, the internal cam init. Basically, it passes the position of the mouseclick to a script:
titleText["Select Internal Cam Position", "PLAIN"];
onMapSingleClick "[_pos] execVM 'JTD_intCam.sqf'; onMapSingleClick ''; true;";
Then the cam code, it puts you into the unit nearest the point within 100m, and hit the buldozer exit to exit (default is numpad 0):
private ["_pos", "_list", "_cam"];
_pos = _this select 0;
_list = nearestObjects [_pos, ["MAN"], 100];
if (count _list > 0) then
{
_cam = _list select 0;
_cam switchCamera "INTERNAL";
// hit 0 or buldozer camera reset to exit
waitUntil {inputAction "buldResetCamera" > 0};
player switchCamera "INTERNAL";
};
Next is the remote camera, which also requires an init to send the position to a script:
titleText["Select Position for Remote Camera", "PLAIN"];
onMapSingleClick "[_pos] execVM 'JTD_remCam.sqf'; onMapSingleClick ''; true;";
Then the remote camera code. It finds anything within 50m and uses it to launch the camera, use the buldozer exit (default numpad 0) to exit:
private ["_pos", "_list", "_cam"];
_pos = _this select 0;
_list = nearestObjects [[_pos select 0, _pos select 1, 0], [], 50];
_cam = _list select 0;
_cam exec 'camera.sqs';
And finally, a simple script to conjure a helo to a map position.
titleText["Select location for helo", "PLAIN"];
onmapsingleclick "
_helo = 'UH1Y' createVehicle _pos;
_helo setDir (random 360);
onMapSingleClick '';
true;
";
hehe
Thanks to everyone here for all the wisdom you impart to us n00bs on a daily basis. And to all past members who've posted stuff I've found while searching! I am often amazed at the body of knowledge present here.