Forum Jump :

Author Message


Posts: 89
Rank:


Level: Member

Country: in
Location:
Occupation:
Age:
In-game name:

 
#196167 Posted at 2017-02-06 04:46        
     
This script is only for placing units at any height in buildings level like rooftops or any floor level etc not for placing on terrain level thats why I didnt use screentoworld because it will only place the visual marker on terrain/ground not on structures floor level.And there is no command for moving the visual marker with cursor.Thanks for correcting missing codes.

Anyway anyone can make their own AI scripts with these script i was only
using these to see if one can select units or not.You can use AI-related
commands here-
https://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2
https://community.bistudio.com/wiki/ArmA:_Actions

init.sqf
sleep 1;
disableSerialization;
_display = findDisplay 46;
_display displaySetEventHandler ["KeyDown","_nil = _this execVM ""selectUnit.sqf"""];
titleText ["Press windows Left key once to activate script","plain down"];

selectunit.sqf
private['_handled'];
_handled = false;

sleep 0.1;
switch (_this select 1) do
{
// KEY windows Left 
case 219: 
{
_handled = true;
hintsilent "select any single unit in 5 seconds!";

sleep 1;
hintsilent "select unit in 5";
sleep 1;
hintsilent "select unit in 4";
sleep 1;
hintsilent "select unit in 3";
sleep 1;
hintsilent "select unit in 2";
sleep 1;
hintsilent "select unit in 1";
sleep 1;

SquadUnits = groupSelectedUnits player;
unit = Squadunits select 0; 

sleep 1;//Exit script if selected AI is in vehicle.
if (vehicle unit!= unit) exitwith {hintsilent "Selected unit cannot move while in vehicle!,call script again!";};

sleep 1;//Exit script if no AI unit is selected.
if (isNil "unit") exitwith {hintsilent "No unit selected,call script again!";};

hintsilent "unit selected!";

//Your code or script handle here....

};
};
_handled;

This post was edited by warbird (2017-02-15 21:13, ago)