Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×

TKTom

Member
  • Content Count

    48
  • Joined

  • Last visited

  • Medals

Everything posted by TKTom

  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};
  16. To follow on from my previous input. I would recommend two changes to the way you are going about solving this problem. 1. DONT call the script from init field or init.sqf: I find both of the above to be highly unreliable (last time I checked, which was perhaps 6-8 months ago.) Quoted from https://community.bistudio.com/wiki/Functions_Library_%28Arma_3%29#Initialization_Order: Notice init.sqf shifts depending on single or multiplayer mission, I also believe that it will fire for any player that joins within the first 30 seconds (maybe 3 minutes, some time anyway) of the mission. INSTEAD: Call from a reliable join in progress structure. For instance, initServer.sqf executes ONCE on the server right at the start of the mission. Set up initServer.sqf to include a line: [[nil,"JIPinit.sqf"],"BIS_fnc_execVM",true,true] call BIS_fnc_MP; This executes a script called "JIPinit.sqf" on ANY client that joins (red bit) every time they join (blue bit) and ALSO once on the server. But ONLY ONCE for each time they join (and NEVER again on the server.) This is a reliable structure from which to launch your script. You might be thinking at this point "My script won't call correctly from this structure", well that's my next suggestion. 2. REMOVE the "CASE" parameter: It seems to me that the "CASE" is only determined by the role of the character. Why not use the typeOf the character instead? This is the classname seen in the upper corner of the unit placement box in the editor. You can change your switch section to: switch (typeOf _this) do { case "B_Soldier_TL_F": {<equipment stuff>}; }; Which reduces the parameters you need to just the unit that the script needs to work on. Now you can call your script in the initServer.sqf like this: { if( side _x == west && local _x) then { _x execVM "gear.sqf"; }; } forEach allUnits; // Or whatever you need to identify the men in the group (units group player) is probably better, but you can work it out And then in the JIPinit.sqf like this: player execVM "gear.sqf"; Obviously, these are suggestions that are how I would personally go about doing this. You can feel free to think them inadequate. EDIT: Also, you worked out why the backpack stuff wasn't working, right? addBackpackCargo is for adding BACKPACKS to VEHICLES (as cargo). addItemToBackpack is for adding ITEMS to BACKPACKS
  17. The reason your bis_fnc_mp calls aren't working is your implementation of the third parameter (call where the unit is local.) This is being evaluated on the fnc_mp call NOT the gear.sqf call. I would suspect that your JIPs are joining into a slot that was not AI before? Thereby creating the character. When you called your fnc mp this char didn't exist, so it is trying to call gear.sqf where objnull is local (nowhere, it falsifies almost any boolean evaluation). Consider setting the mp call to run for all clients on jip (TRUE in third param) and operating only on a local unit.
  18. You could put the if statement inside the eventhandler. Isplayer works if the client controlling the unit is not local. Alternatively, you could add the eventhandlers only on the server, then remove them onplayerconnected. Something like: Onplayerconnected "[player,removealleventhandlers,FALSE,false] call bis_fnc_mp;
  19. camera camSetTarget heli1; camera camCommit 0; Is that what you are looking for? I'm not entirely sure what your issue is, if you have a mission file I could take a look at that would make it clearer. https://community.bistudio.com/wiki/camSetTarget
  20. Indeed, I believe that he could do that. Care would still be necessary to ensure that a JIP doesn't reset the HQ, however.
  21. Locality will be the issue. Here's some code I used for a very similar situation. I made a choice to keep the actions on the vehicle and enable/disable them by using the conditional variables "deployed" and "cooldown". If I were to re-write this now I would use setVariable on the vehicle to create a public variable in a sensible place. As it is, the scripts "makeBase.sqf", "cooldown.sqf" and such just use the variables and then public them as well as doing the actual necessary work of generating the base. The advantage of not adding and removing the actions is that you can't have a JIP player reset the base to undeployed mode or vice versa. removeAllActions hq; hq addAction["<t color='#ff1111'>Deploy Base</t>", { if (({(side _x)== resistance} count (getPos hq nearObjects ["Man",300])) > 0) then { titleText ["You can't deploy here, enemies are within 300m","PLAIN",1]; } else { [[[],"scripts\makeBase.sqf"],"BIS_fnc_execVM",false,false] spawn BIS_fnc_MP; }; [[[],"scripts\cooldown.sqf"],"BIS_fnc_execVM",false,false] spawn BIS_fnc_MP;}, nil,1.5,true,true,"", "(side player != resistance)&&(!deployed)&&(!cooldown)&&((abs (speed hq)) < 2)"]; hq addAction[ "<t color='#ff1111'>Undeploy Base</t>", {[[[],"scripts\breakBase.sqf"],"BIS_fnc_execVM",false,false] spawn BIS_fnc_MP;[[[],"scripts\cooldown.sqf"],"BIS_fnc_execVM",false,false] spawn BIS_fnc_MP;}, nil,1.5,true,true,"", "(side player != resistance)&&(deployed)&&(!cooldown)"];
  22. Is there anything like VAS for filling a crate? I.E. A GUI which allows you to select an inventory of items to load into a crate and then spawns a crate for you? At the moment my logistics guys spawn empty crates and then load them from a VAS box by putting items into their inventory and then dumping into the crate, if there's something slicker already out there I'd like to know if anyone has come across it. EDIT: Just to specify, this is for use DURING a mission by the players, not by the mission maker.
  23. Thanks, I never would have guessed that was the one I needed.
  24. EDIT: I HAVE AN IDEA FOR HOW TO MAKE THIS SPECIFIC SCRIPT WORK BETTER, BUT I WOULD STILL LIKE AN ANSWER TO THIS QUESTION FOR OTHER PURPOSES. I have a script that I am using to fire a flare over the heads of BLUFor when detected by OPFor. I want a flare to fire over where the AI are searching approximately every 40 seconds as long as the AI believes that they know where the BLUfor are. At the moment I use the true position of the BLUfor agents and update this every 40 seconds, as long as theres a BLUfor agent in the "list" of a trigger that is fired when blufor detected by opfor. The problem: BLUFor agents stay in the list for the trigger for as long as the AI BELIEVE that they know where they are, which is however long it takes for the AI to actually go up to the last known location and have a look around. With the current implementation this means that the flares fire over where the BLUFor REALLY are even if the AI ONLY THINK they have found them. It also causes the flare to fire when, for instance, BLUFor have detonated an explosive from some distance (which I think is just how the AI currently handles an alert status.) A solution: If I had some way to retrieve where the AI THINK the BLUfor are then I could fire a flare over that location, so is it possible to retrieve that from either the trigger or the AI somehow? PS: I intend to alter my script so that it creates a new instance (which will use only the location of the BLUfor at that time) each time the trigger is fired, which will then launch the flares until either the contact is lost or a new detection is made.
  25. When I play multiplayer domination, the ACE elevation change appears to have no effect on the zeroing of the weapon. That is, if I aim at an object 600m away, set elevation to 42 MOA and fire (it will miss, obviously) then set elevation to 0 MOA, aim at the same point and fire then the round will follow the same trajectory. In single player this system works fine so I can only assume that the system is not initialising properly in multiplayer. Does anyone else have this experience?
×