Silderoy
Member-
Content Count
158 -
Joined
-
Last visited
-
Medals
Everything posted by Silderoy
-
How to check raining and numer of soldiers in vehicle
Silderoy replied to NightIntruder's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
ok lets see... 1) the "rain" command gives you the answer... if (isServer) then { _rainLevel = rain; if (_rainLevel > 0) then { *its raining* } else { *its not raining* }; }; just note that in Arma2 the rain is local, so the server and each client might have different value. this code will give you the rain on the server's side. 2) while {alive _chopper} do { _inChopper = {vehicle _x == _chopper} count allUnits; sleep 5; }; this will return the number of units inside _chopper, including the pilot and gunners (if they are manned). just change it to the name... 3) _startLevel = fuel _chopper; while {alive _chopper} do { _fuelLevel = fuel _chopper; if (_fuelLevel <= _startLevel - 0.1) then { _startLevel = _fuelLevel; hint format ["Fuel Level: %1%", (_fuelLevel * 100)]; }; sleep 5; }; this will check the fuel level of _chopper every 5 seconds, and every 10% it will give you a hint with the percents of fuel left. 4) cant help you with that one... sorry. NOTE: non of those are tested, just off the top of my head... if something doesnt work just write it down here and me or anyone else will try to fix it. -
change inventory color?
Silderoy replied to Gonobob's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
only way it might be the TrueMods pack. not sure but looks like the correct color... -
I cant get it to work... I try using null = [nearestobject [_this select 0,_this select 4]] spawn { lastPos = [ 0,0,0]; while {!(isNull _this)} do { lastPos = getPosATL _this; and its not working... is there any other way of getting the position where a bullet hitted?
-
Bullet hit position
Silderoy replied to Silderoy's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
the problem is, Its not an object im aiming at... its an area of ground (map tarrein)... or if anyone is awere of a circular object? >= 1 meter? i could fill the area with object and then check if any of them is hit, but I think its over working for a circle target with a radius of 7.5 Meters... -
Trigger activated when vehicle is despawned (Need help)
Silderoy replied to Yolo Joe's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
name the vehicles. now in the cond field: (isNull _veh1) && (isNull _veh2) && (isNull _veh3); _veh1-3 is the names. -
How to make the mission end after a certain number of friendly casualties?
Silderoy replied to Jambird's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
it has nothing to do with east, because he is interested in bluefor only... -
Multiple AND and Ors in trigger conditions.
Silderoy replied to Jigsor's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
your condition should be: (aachenon == 1) && (timesup == 0) && ((alive tsk1tower1) || (alive tsk1tower2) || (alive tsk1tower3) || (alive tsk1tower4) || (alive tsk1tower5) || (alive tsk1tower6)); -
create/delete vehicles within trigger via addAction Script?
Silderoy replied to SteelSampson's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
{deleteVehicle _x} forEach (nearestObjects [[getPos _trig select 0, getPos _trig select 1, 0], ["Tank"], 100]); _trig is the name of your trigger. 100 is the radius of the trigger. it will delete all the tanks within this trigger. -
How to make the mission end after a certain number of friendly casualties?
Silderoy replied to Jambird's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
if he have spawn, it wont work. and if I got it right then he have... EDIT: But, you got me an idea! name all of the bluefor units. something like b1,b2,b3,b4,b5,b6.... now in the casualtiesCheck.sqf put this: DEADBLUEFOR = 0; _blueForUnits = [b1,b2,b3,b4,b5,b6...]; while {true} do { { if (!alive _x) then { DEADBLUEFOR = DEADBLUEFOR + 1; hint "casualty detected"; sleep 1; hint format ["casualties: %1", DEADBLUEFOR]; }; } forEach _blueForUnits; sleep 2; }; in _blueForUnits put all the names of the bluefor units. :p if that one doesnt work I think you can make it with Event Handlers. to do that get the following code into the casualtiesCheck.sqf, but only if the above doesnt work: DEADBLUEFOR = 0; _blueForUnits = [b1,b2,b3,b4,b5,b6...]; while {true} do { { _x addMPEventHandler ["MPKilled", {DEADBLUEFOR = DEADBLUEFOR + 1}]; waituntil {!alive _x}; waituntil {alive _x}; } forEach _blueForUnits; sleep 1; }; -
How to make the mission end after a certain number of friendly casualties?
Silderoy replied to Jambird's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
the problem over here is that when a unit dies, it becomes a civilian, and leaves its group. Im trying to find a way to get it but an the moment no luck... -
Teleport Vehicle and Crew
Silderoy replied to SteelSampson's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Tank2_1 addAction ["Crew To Identification","Scripts\Teleports\TankTele.sqf", [], 10, true, true, "", "Tank2_1 in (list _trig);"]; replace "_trig" with the name of your trigger. -
How to forbid enemy report on radio
Silderoy replied to 630R93's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
you can disable those calls by disabling only group chat, which the massages are beeing sent in. to do that put this in your description.ext: disableChannels[]={3}; not sure whats the effect, but it might work. -
there is another, easier way. you dont need any script at all: create a trigger and in its Condition field write this: (!alive npc1) || (!alive npc2) || (!alive npc3) || (!alive npc4) || (!alive npc5) || (damage player > 0); now you have 5 units, if one of them is dead, you have 4... then if ncp1 dies, or ncp2 dies, or npc3.... then you have 4 units. on the on act you write whatever you want...
-
How to make the mission end after a certain number of friendly casualties?
Silderoy replied to Jambird's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
ok to check whats working and whats not, put that into the causaltiesCheck.sqf: DEADBLUEFOR = 0; hint "script is running"; sleep 1; while {true} do { hint "'while' loop started"; sleep 1; { hint "'forEach' loop started"; sleep 1; if (side _x == west) then { hint "unit is bluefor"; sleep 1; if (!alive _x) then { hint "unit is dead"; sleep 1; DEADBLUEFOR = DEADBLUEFOR + 1; hint "casualty saved"; }; }; } forEach playableUnits; hint "'foreEach' loop finished"; sleep 2; }; now it should have alot of hints. tell me which hint you see and which you do not, what is the last hint you can see. -
How to make the mission end after a certain number of friendly casualties?
Silderoy replied to Jambird's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
you have the percents because you had spaces in the ingame name. arma files cannot have spaces, so their "name" for a space is %20... about the script, is it showing the hints or nothing? -
How to make the mission end after a certain number of friendly casualties?
Silderoy replied to Jambird's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
ok my bad, stupid mistake, change "_deadbluefor" to "DEADBLUEFOR", without the _. both on the script and in the trigger. and make sure its in the Cond field and not the On Act. so delete anything from the casualtiesCheck.sqf, and paste this into it: DEADBLUEFOR = 0; while {true} do { { if ((side _x == west) && (!alive _x)) then { DEADBLUEFOR = DEADBLUEFOR + 1; hint format ["causualties: %1", DEADBLUEFOR]; }; } forEach playableUnits; sleep 2; }; now it should hint you the number of casualties every time a bluefor unit dies. -
How to make the mission end after a certain number of friendly casualties?
Silderoy replied to Jambird's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
that might work, not tested though: create a file called "casualtiesCheck.sqf". inside put the following: _deadbluefor = 0; while {true} do { { if ((side _x == west) && (getdammage _x == 1)) then { _deadbluefor = _deadbluefor + 1; }; } forEach playableUnits; sleep 2; }; then in your init.sqf put this: null = [] execVM "casualtiesCheck.sqf"; and it the end "lose" trigger, write in the Cond field:\ _deadbluefor = 25; -
How do I spawn (via script) a unit or group near a certain object or vehicle?
Silderoy replied to SteelSampson's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
You have to create each unit by itself and get them to the same group. something like this: _group1west = createGroup west; _unit1 = _group1west createUnit ["USMC_Soldier", [(getPos Vehi1 select 0) - 15*sin(random 359), (getPos Vehi1 select 1) - 15*cos(random 359), 0], [], 0, "NONE"]; _unit2 = _group1west createUnit ["USMC_Soldier", [(getPos Vehi1 select 0) - 15*sin(random 359), (getPos Vehi1 select 1) - 15*cos(random 359), 0], [], 0, "NONE"]; _unit3 = _group1west createUnit ["USMC_Soldier", [(getPos Vehi1 select 0) - 15*sin(random 359), (getPos Vehi1 select 1) - 15*cos(random 359), 0], [], 0, "NONE"]; [_unit1,_unit2_unit3] joinsilent _group1west; select x is a way to get a value of an array elemet. lets say for example you have an array of 3 elements called _names. _names = [jack,bob,dan]; in this case, jack = _names select 0; bob = _names select 1; dan = _names select 2; got the idea? arma counts in 0 index, which means you start counting from 0 (and not from 1). first element = arrayname select 0, second element = arrayname select 1, third element = arrayname select 2, X element = arrayname select (x-1). this can be used for any array. The getPos command returns an array of 3 elements: [X,Y,Z (altitude)]. so getPos player select 0 is the X value of the player's position, getPos player select 1 is the Y value of the player's position, and getPos player select 2 is the Z value of the player's position, which is his altitude. when you go Advanced, you have above the text box alot of symbols. the middle right-most icon is a paper with "php" written on it. press it and write whatever you want between the 2 parts that appear. -
I've gotten my player stuck... literally
Silderoy replied to SteelSampson's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
you can make it via a radio action, so Alpha is attach, Bravo is detach... -
How do I spawn (via script) a unit or group near a certain object or vehicle?
Silderoy replied to SteelSampson's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
unit = "USMC_Soldier" createVehicle [(getPos Vehi1 select 0) - 5*sin(random 359), (getPos Vehi1 select 1) - 5*cos(random 359), 0]; this will spawn the unit in a random position within 5 meters of the vehicle, ignoring all objects. I remember there was a function to spawn units in an emptyspace, but cant remember it right now... -
killing trees?
Silderoy replied to SteelSampson's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
hideObject _x by itself wont work, I ment using it with the forEach command, like that: {_x hideObject true} forEach things; -
I searched this forum but could not find a solution that works to my problem. I want to create a plane (AN-2) using an action, that will start while airborne and will keep flying through some waypoints. now the problem is, it spawns moving as it should, engine is on, but then it just dive into the sea. like there is no pilot. I tried CreateVehicle, and creating a pilot, and putting him in the plane. changed nothing, the plane just dropped to the sea. and I tried the spawn vehicle function you can see in the script. So my script is this: _target = _this select 0; _caller = _this select 1; _id = _this select 2; _an2 = [[getMarkerPos "an2start" select 0, getMarkerPos "an2start" select 1, 150], 360,"An2_TK_EP1", grpNull] call BIS_fnc_spawnVehicle; _an2grp = group _an2; _an2wp1 = _an2grp addWaypoint [markerPos "an2way1", 50]; [_an2grp, 1] setWaypointType "MOVE"; [_an2grp, 1] setWaypointCompletionRadius 50; [_an2grp, 1] setWaypointCombatMode "BLUE"; [_an2grp, 1] setWaypointSpeed "NORMAL"; _an2wp2 = _an2grp addWaypoint [markerPos "an2way2", 50]; [_an2grp, 2] setWaypointType "MOVE"; [_an2grp, 2] setWaypointCompletionRadius 50; _an2wp3 = _an2grp addWaypoint [markerPos "an2start", 50]; [_an2grp, 3] setWaypointType "CYCLE"; [_an2grp, 3] setWaypointCompletionRadius 50; _target removeAction _id; _mrkpos = [getMarkerPos "an2start" select 0, getMarkerPos "an2start" select 1]; _grid = mapGridPosition _mrkpos; hint format ["A single AN-2 was spotted over grid %1!",_grid]; Im saying again, I searched the forums, found one with a similiar problem, but the solution he got (the function) did not work for me. Thanks in advance, Silderoy.
-
killing trees?
Silderoy replied to SteelSampson's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
hideObject _x -
Moving a object from point 'A to B' and 'B to A' using another object.
Silderoy replied to zippy's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Ok so here is an explenation of addAction: When you use addAction, you call a file (sqf or sqs). The addAction command has to have an Identefier (the word infront of the "="). It could be a number or a variable (local or global). The Identefier is used to remove the action and basicly Identefy the action and seperate it from any other action. Now the addAction returns an array to the identefier. The array contain the object the addAction was assigned to, the unit that pressed the action, and a uniqe number assigned to the action. So for example you created the "closed" action. So when the action is used, "closed" will be equal to an array, that will look like this: closed = [target, caller, id]; So this array is now part of the script you called. So you can refer to those just like any array's elements, with the "_this" local variable. Those elements are being called in the script file with _target = _this select 0; //first element of the array. _caller = _this select 1; //second element of the array. _id = _this select 2; //third element. Then to remove the action, for example, you can use _target remove _id; Hope it helped :) for future use. -
Moving a object from point 'A to B' and 'B to A' using another object.
Silderoy replied to zippy's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Stupid question, did you make sure the gate is called "gate" in the editor? Worth a try. One more thing I noticed, you can't write "this" in the script, as it doesn't mean specific object. Use: Opendoor.sqf: _table = _this select 0; _id = _this select 2; _table removeAction _id; gate setpos [ getPos gate select 0, getPos gate select 1, 2.6]; _table addAction ["Close Door","closedoor.sqf"]; closedoor.sqf: _table = _this select 0; _id = _this select 2; _table removeAction _id; gate setpos [ getPos gate select 0, getPos gate select 1, 0]; _table addAction ["Open Door","opendoor.sqf"];