Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Community Reputation

10 Good

About TKTom

  • Rank
    Lance Corporal

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. TKTom

    JIP with MenuPosition

    How to work around it? Don't use Init field. There used to be a command (in arma 2) to clear init fields but BIS removed it for arma 3. Other than that, you could protect your init fields with something like: if (isNil "initialised") then { <Normal Init Code> initialised = true; sleep 5;// <- to allow other players to initialise publicVariable "initialised"; }; I'm not sure exactly why it happens but init.sqf and init fields seem unreliable to me, I don't use them. (initServer.sqf is the only event script I use.)
  2. TKTom

    Mission Lose Event Handler

    This is true, he didn't ask for JIP capability though and I thought it was best to keep it simple. If you want to have this JIP capable, the only real change necessary would be an if (!isServer) exitWith{}; preventing the loop on any machine but the server. Then the event handlers would only execute on the server, the variable would only be on the server. Either set the trigger to send its effects over the network or publicvariable the "civsKilled" in order to make everyone's triggers activate. That is: if (!isServer) exitWith {}; civ = group this; civsKilled = 0; { 0 = _x addEventHandler ["killed", {if (side (_this select 1) == west) then {civsKilled = civsKilled + 1;publicVariable "civsKilled";};}]; } forEach units civ;
  3. ^^this will be the way to go about it^^ The only possible problem with the above is that BIS_fnc_MP doesn't propagate a function declared like: <funcname> = {code} unless you specifically tell it to. I will be interested to see if it works. If it doesn't, try setting up the function in the description.ext or (if you aren't sure how) call fnc mp like: [[[],teg_fnc_rain],"spawn",TRUE,false] call bis_fnc_mp; But, be aware that this will propagate the function code over the network, not just the name. (if you change the last FALSE to TRUE then any player that joins will also have the weather set to rain.)
  4. You are right in that it does need to be "handleDamage" though, "Hit" won't actually change anything. Maybe the OP needs to consider if its worth the extra bother/calculation time required to achieve what he actually asked for versus the effect that can be done simply (one/two shot kill.) And, as Iceman says, any unit that you want to be vulnerable needs the event handler. So when you create a unit, add the event handler. The code I gave you will add to all units on the map at the start of the misison (if placed in init.sqf). Alternatively: If you are using third party scripts to spawn enemies then a loop may be better, I would recommend: [] spawn { while {true} do { { if (_x getVariable["exempt",true])then { _x addEventHandler["HandleDamage",{ (_this select 2)*2; }]; _x setVariable["exempt",false]; }; } forEach allUnits; sleep 6; }; };
  5. The way I read the wiki, "HandleDamage" returns the total damage level for the unit and "Hit" returns the damage caused by the hit. So in this case it MUST be "Hit" (or ((_this select 2) - getDammage (_this select 0))*2; ) { _x addEventHandler["Hit",{ (_this select 2)*2; }]; } forEach allUnits;
  6. //ALL MARKERS IS ALREADY HAS BEEN PLACED IN EDITOR// _grpheli = createGroup west; //_pilot = "B_Helipilot_F" createunit [getMarkerPos "barracks",_grpheli,"",1,"NONE"]; "B_Helipilot_F" createUnit [ getMarkerPos "barracks1", _grpheli]; //In both cases created a unit perfect,i'v try both of it for the rest piece of code// //_heli = createVehicle ["B_Heli_Transport_01_camo_F",getMarkerPos "helispawn",[],0,"FORM"]; _heli = "B_Heli_Transport_01_camo_F" createVehicle getMarkerPos "helispawn"; //_____________________________________________________________________________________// _pilot = leader _grpheli; _pilot assignAsDriver _heli; [_pilot,1] orderGetIn true; //Working good the pilot is in heli// _troops = createGroup west; _soldier1 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"PRIVATE"]; _soldier2 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"PRIVATE"]; _soldier3 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"PRIVATE"]; //player joinAs [_troops, 4];//If this command is not active , i am able getin but if the command is active , the heli is locked for me and other group members. // //Units creates fine // _wpPilot1 = _grpheli addWaypoint [position _heli, 0]; _wpPilot1 setWaypointType "MOVE"; _wpPilot2 = _grpheli addWaypoint [getMarkerPos "HeliPad", 0]; _wpPilot2 setWaypointType "LOAD"; _wpPilot3 = _grpheli addWaypoint [getMarkerPos "LZ", 0]; _wpPilot3 setWaypointType "TR UNLOAD"; //The WP are working excellent // _wpTroops1 = _troops addWaypoint [getMarkerPos "HeliPad", 0]; _wpTroops1 setWaypointType "MOVE"; _wpTroops2 = _troops addWaypoint [getMarkerPos "helispawn", 0]; _wpTroops2 setWaypointType "GETIN"; _wpTroops3 = _troops addWaypoint [getMarkerPos "LZ", 0]; _wpTroops3 setWaypointType "GETOUT"; _wpPilot2 synchronizeWaypoint [_wpTroops2]; _wpPilot3 synchronizeWaypoint [_wpTroops3]; //All Waypoints in this section is working, but group won't mount, they just proceed to the next Waypoint // Try the above code. Pay close attention to how addWaypoint works : addWaypoint[<position>,<RADIUS>,<Index>]; You weren't actually setting the index there, you were making the radius larger. I changed your code to reference the waypoints (which you were storing anyway) so this should now work. Also, I believe that your indexes were off by one because any created unit gets a zero-index waypoint on its spawn location.
  7. TKTom

    Mission Lose Event Handler

    Since the release of OFP (2001) one way or another. My personal progress has been a lot greater in the last few years than at any time before that, however.
  8. TKTom

    Mission Lose Event Handler

    Does that code you have there actually do what you want? It looks to me like it will trigger when there are 2 or fewer civilians LEFT not 3 killed, unless that is just how the numbers line up? Anyway: In the init of any unit that counts if its killed. 0 = this addEventHandler ["killed", {civsKilled = civsKilled + 1;}]; civsKilled = 0; then set up a trigger (or equivalent) with the condition civsKilled >= 3 EDIT: You could use this in group leader: (This will also count only if its a BLUFOR that killed the civ.) civ = group this; civsKilled = 0; { 0 = _x addEventHandler ["killed", {if (side (_this select 1) == west) then {civsKilled = civsKilled + 1;};}]; } forEach units civ;
  9. Put a line: Hint str _pilot; In somewhere and you will see what we are talking about. Yes, the unit creates fine but your _pilot variable is not referencing anything because the create is not returning anything. I know it seems very counter-intuitive but you are not using the same command as Jshock has in his line.
  10. Just got to point out that my code is fully working and will do anything that could be done in a trigger... You just need to identify what position you want it on and put the effects in the action.
  11. My version... You will need to change the top line _position = position <some object you want to put the tool kits by>; _position = position player; while {true} do { //hint str _position; _groundEquipmentArray = nearestObjects [_position,["GroundWeaponHolder"],10]; { _added = _x getVariable ["ActionAdded",false]; if !(_added) then { if (({"ToolKit" == _x} count (itemCargo _x))>1) then { _x addAction ["Use Toolkits!",{hint "You used the toolkits!"}]; _x setVariable["ActionAdded",true]; }; }; } forEach _groundEquipmentArray; sleep 1; };
  12. I believe that the syntax of CreateUnit that you are using does not return the object, use the other one. https://community.bistudio.com/wiki/createUnit_array <-- gives the usage you want https://community.bistudio.com/wiki/createUnit <-- gives the usage you got (_pilot is nothing) Alternatively, before the moveInDriver. (Assuming the pilot is the only member of the group.) _pilot = leader _groupheli;
  13. TKTom

    [CODE] markers

    // Markers.sqf while {true} do { { deleteMarkerLocal _x; } foreach Markers; Markers = []; if (side player == civilian) then { if((player getVariable "gps") == 1) then{ { if ((side _x == civilian)&&(_x getVariable ["gps",0] == 1)) then { _marker = createMarkerLocal[name _x, getpos _x]; _marker setMarkerTypeLocal "o_unknown"; _marker setMarkerColorLocal "coloryellow"; _text = format ["%1: %2",_x,(name _x)]; _marker setMarkerTextLocal _text; Markers pushBack _marker; }; } foreach playableUnits; }; }; sleep 2; } ;
  14. TKTom

    [CODE] markers

    You've got nothing checking if the other character has that phone variable. correction: if ((side _x == civilian)&&(_x getVariable ["gps",0] == 1)) then { _marker = createMarkerLocal[name _x, getpos _x]; _marker setMarkerTypeLocal "o_unknown"; _marker setMarkerColorLocal "coloryellow"; _text = format ["%1: %2",_x,(name _x)]; _marker setMarkerTextLocal _text; Markers pushBack _marker; }; Also, don't use: Array = Array + [element];, use: Array pushBack element; It's faster.
  15. https://www.dropbox.com/sh/umohsp005ot4ruq/AABiPhoR9oYI0bxeW97zrogva?dl=0 Give it a DL and see if that meets your requirements.* Instead of attaching a character (or a camera, which I did attempt as you can see from commented code.) I created a camera, with the helicopter as the target and then moved it along behind the helicopter as the movement plays. I used camCommit <time>; to smooth it out. Try changing the time (currently 0.5) to experiment with the smoothness/closeness to the helicopter you want. Theres still a bit of sharp movement, but that can't be avoided with unitPlay. Higher framerate on the recording will help that smooth out. Radio Bravo will activate the camera. * actually, just insert this code in path.sqf: vkam = "camera" camCreate [0,0,0]; vkam setDir -2; vkam camSetTarget helo1; vkam camSetRelPos [-2, -5, -2]; vkam camCommit 0; cameraEffectEnableHUD false; vkam cameraEffect ["INTERNAL", "BACK"]; _firingdata = [] ; _sequence = [helo1, _movementdata] spawn BIS_fnc_UnitPlay; [] spawn { while {true} do { vkam camSetRelPos [-2, -5, -2]; vkam camCommit 0.5; }; }; [helo1, _firingdata] spawn BIS_fnc_UnitPlayFiring; waitUntil {scriptDone _sequence};