Jump to content

Luft08

Member
  • Content Count

    197
  • Joined

  • Last visited

  • Medals

Everything posted by Luft08

  1. If you set the behaviour on a group, I wonder if subsequent units joining that group will pick up the behaviour where if you set the behaviour on all units then joining units would not be effected?? Just guessing here.
  2. The knowsAbout command can give me information about the knowledge level of various units. I would like to manually set that value. I've looked at the reveal command but that's now what I want to do. If I have a tank on the map and a player firesNear I want to set the tanks knowledge of that player based on his distance. Very far off the crew knows little to nothing so they just go from safe to combat mode but if the player is close the commander may have a good idea as to the player's position and will engage him.
  3. You're right! thanks! (I should be more careful when reading the wiki. 😀
  4. I'm looking to improve my code that checks to see if a group's knowledge of the players changes. Right now I use code that I repeatedly call using the BIS_fnc_loop function. I was hoping there would be an event handler which would be more efficient but I don't see it. Thanks.
  5. Out of curiosity what makes 1.5 interesting? Is that the value that something happens?
  6. I went through the Global Mobilization map gathering the rough position data on bridges: eastGermanBridges = [ [10577.8,17680.2],[10889.8,17545.4],[12102.7,17199.6],[13399.5,15948],[14312.1,15123], [13630.1,12722.1],[14927.9,15361.6],[14943.2,15220.9],[15658.5,14663.3],[15663.2,14166.2], [16256.9,12515.4],[17365.1,11464.7],[18684.4,11083.3],[14927.8,15360.4],[16192.9,15358], [18230.3,15977.5],[19959.8,4850.35],[18082.2,5211.08],[16399.4,6661.06],[16143.3,6951.2], [15553.2,8796.89],[14255.2,11924.2],[13137.8,8403.86],[12917.6,8265.83],[12582.7,7924.79], [13666.6,4606.77],[13870.7,4370.2],[15269.4,2432.02],[16340.1,178.734] ]; I wrote a function that takes a position and is suppose to return true if that position is at a bridge. However, it always returns false. isOnBridge: params["_pos"]; if((count _pos) == 2) then { _pos pushBack 0}; private _result = false; if(isOnRoad _pos) then { private _nearestRoad = [_pos, 10] call BIS_fnc_nearestRoad; private _roadInfo = getRoadInfo _nearestRoad; _result = (_roadInfo select 8); }; _result I was using bridge position data I gathered by hand so I figured that it wasn’t accurate enough so I wrote a function that takes the rough data and returns more precise data: private _bridgeSeg = []; { private _nearPos = _x; private _roadSegs = _nearPos nearRoads 50; { private _roadInfo = getRoadInfo _x; private _isBridge = _roadInfo select 8; if(_isBridge) then { _bridgeSeg pushBack (getPos _x); }; } forEach _roadSegs; } forEach eastGermanBridges; diag_log format ["Bridge Array = %1", _bridgeSeg]; The updated data: eastGermanBridges = [ [10578.4,17680.9,12.4872],[10889.6,17544.5,12.8538],[12102.4,17199.3,12.5763], [13400.2,15949.4,12.8326],[14315,15122.7,12.4278],[13628.6,12721.3,12.5986], [14928.2,15360,12.1543],[14943.7,15219.7,12.9992],[15660.1,14663.1,13.0124], [15664.2,14165.7,14.3585],[16255.7,12514.4,13.1765],[17356.8,11455.1,14.3627], [17371.4,11468.7,16.0603],[17386,11482.4,12.3864],[18685.7,11083.8,14.1605], [14928.2,15360,12.1543],[16193.1,15347.6,14.5347],[16193.4,15367.6,15.7658], [18223.9,15987.5,15.8225],[18235.9,15971.4,16.2582],[19959.6,4850.25,16.6743], [18082.3,5211.1,14.82],[16399.5,6661.06,12.4695],[16143.4,6951.2,14.6601], [16156.9,6965.9,13.1921],[15543.3,8794.17,14.8643],[15562.5,8799.49,14.7014], [14255.7,11925.7,14.6887],[13138.5,8405,14.5256],[12920,8264.23,14.1931], [12581.9,7926.16,12.985],[13667,4607.53,11.6135],[13869.8,4369.87,15.0714], [15269.2,2432,14.7458],[16338.1,177.258,16.1915] ]; When I tested the function again it still returns false even when I pass the exact bridge position.
  7. Thanks, I ended up using: params["_pos"]; private _result = false; private _pos2D = [_pos select 0, _pos select 1]; private _nearestRoad = [_pos2D, 5] call BIS_fnc_nearestRoad; if (!(_nearestRoad isEqualTo objNull)) then { private _roadInfo = getRoadInfo _nearestRoad; _result = (_roadInfo select 8); }; _result It doesn't tell me if the EXACT position is a bridge but does tell me if the nearest road within 5m of the specified position is a bridge. Close enough, I think.
  8. Sorry. Although the threads deal with similar issues aimed at solving problems in the same mission they ARE different. The first deals with a variable holding a bridge object. Only it didn't because it was being loaded with objects near the bridge. That issue was solved. You do have a point about the second thread and this thread. They are similar enough that perhaps I should have just reopened the second thread and tacked on the additional information but being that I wrote code that looks like it should work but doesn't, it seemed to me to be a different issue. In retrospect it may have been too close to an earlier post. I do apologize for the similar posts but still don't know why the code I posted fails.
  9. Thanks , I think you're right. With a few minor tweaks I got it working. It's cleaner and easier to understand. Because I'm scripting everything I couldn't put the code into an init field but I could just assign the EH directly to the vehicle. The vehicle is part of a convoy so I pushed the entire vehicle array ( [Vehicle, Crew, Group]) into another array and iterated through them looking for the ammo trucks and attaching the EH to just those. { private _veh = _x select 0; if(typeOf _veh == "gm_gc_army_ural4320_reammo") then { _veh addEventHandler["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; for "_c" from 1 to 10 do { private _bomb = "Bo_GBU12_LGB" createVehicle (getPos _unit); _bomb setDamage 1; }; }]; }; } forEach convoyArray; // [vehicle, crew, group] Works like a charm. Thank you to everyone replying to this thread.
  10. I want an ammo vehicle to blow up BIG when destroyed. I attached the Dammaged event handler. The Wiki says that it provides the following: params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"]; The docs further state that _unit is an object. My plan was to get the position of _unit and upon the _damage of the vehicle reaching 1 to spawn a Bo_GBU12_LGB at that position and immediately set its damage to 1. However I get an error telling me that _unit is an array not an object. code snippit: if(!isServer) exitWith {}; params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"]; private _el_0 = _unit select 0; // 0 Bravo 3-1-4 private _el_1 = _unit select 1; // hitpoint_lightfront_1_1 private _el_2 = _unit select 2; // Number each time shot It appears that _unit is the params array. What am I missing here??
  11. There's not much to post. if(!isServer) exitWith {}; params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"]; private _unitPos = getPos _unit; // -----------------------This throws an error. if(_damage == 1) then { // ------ This is wrong. _damage is NOT the total damage of the unit. for "_c" from 1 to 10 do { private _explosion = "Bo_GBU12_LGB" createVehicle _unitPos; _explosion setDamage 1; }; };
  12. My briefing is showing up if I run my mission on my PC but does not show up if I put my mission on a dedicated server. I am just starting to work with briefings so I have a few questions. 1. Must briefings be named "Briefing" or can it be named anything? My briefing is in the file: addBriefing.sqf 2. Must briefings be in the mission root or can they be in a subdirectory? 3. I have my code that calls addBriefing.sqf in the initPlayerLocal.sqf file. The code waits to run until the server is ready. i.e. waitUntil{sleep 1; !isNil "ServerReady"}; Must the briefing code run right away or can it be delayed in this manner? 4. Before setting the serverReady variable to true and making it a publicVariable the server sets another variable and makes it a publicVariable so that the briefing code can use its value to create a somewhat dynamic briefing. Is this okay? The initServer.sqf calls "scripts\common\initVariables.sqf" which contains the publicVariable used by the briefing code: if(!isServer) exitWith {}; spotterChance = floor random 100; publicVariable "spotterChance"; Based on the contents of missionPath a addBriefing.sqf is run. i.e. [] execVM (missionPath + "addBriefing.sqf"); example of addBriefing.sqf: private _satReliability = [] call satReliability; player createDiaryRecord ["Diary", ["Mission", "<img image='pictures\header.jpg' width='350' height='66'/><br/> Your mission:<br/><br/> There is a scientist working on a deadly nerve agent.<br/> Command does not want him to finish. His position<br/> is marked on your map. Go take him out.<br/> <br/> The defence satellite application program is " + _satReliability]]; The first part of the addBriefing.sqf calls satReliability. private _satReliability = "working well."; if(spotterChance < 91) then {_satReliability = "fairly good.";}; if(spotterChance < 76) then {_satReliability = "spotty.";}; if(spotterChance < 51) then {_satReliability = "flaky today.";}; if(spotterChance < 21) then {_satReliability = "nearly down.";}; _satReliability
  13. Luft08

    Briefing Questions

    Thanks, I'll try format. For now I found a work around. I wrote a separate method that uses a switch/case construct to create the diary records. It's grossly inefficient but allows me to move forward. switch (satReliability) do { case 1: { player createDiaryRecord ["Diary", ["Situation", "<img image='images\header.jpg' width='350' height='66'/><br/> Situation:<br/><br/> The defence satellite application program is nearly down so<br/> be careful."]]; }; case 2: { player createDiaryRecord ["Diary", ["Situation", "<img image='images\header.jpg' width='350' height='66'/><br/> Situation:<br/><br/> The defence satellite application program is flaky today so<br/> don't depend on getting accurate information."]]; }; case 3: { player createDiaryRecord ["Diary", ["Situation", "<img image='images\header.jpg' width='350' height='66'/><br/> Situation:<br/><br/> Be aware, the defence satellite application program is spotty today."]]; }; case 4: { player createDiaryRecord ["Diary", ["Situation", "<img image='images\header.jpg' width='350' height='66'/><br/> Situation:<br/><br/> The defence satellite application program is working fairly well."]]; }; case 5: { player createDiaryRecord ["Diary", ["Situation", "<img image='images\header.jpg' width='350' height='66'/><br/> Situation:<br/><br/> The defence satellite application program working well today."]]; }; }; I tried using the <var><var/> like html but no joy. I'll try format. Thanks.
  14. Luft08

    Briefing Questions

    Thanks R3vo, I am executing my briefing from initPlayerLocal.sqf. With further testing I have discovered that if I exclude the "The defence satellite application program is " + _satReliability line it works. Am I concatenating the strings wrong for the Briefing.sqf method?
  15. On my server I have the code: spotterChance = floor random 100; publicVariable "spotterChance"; I wish to push the spotterChance value to the clients but when I call the following function it throws an "undefined variable" error: private _satReliability = "working well."; if(spotterChance < 91) then {_satReliability = "fairly good.";}; if(spotterChance < 76) then {_satReliability = "spotty.";}; if(spotterChance < 51) then {_satReliability = "flaky today.";}; if(spotterChance < 21) then {_satReliability = "nearly down.";}; _satReliability
  16. I created a simple mission using the Weferlingen map in the Global Mobilization mod where the players are suppose to go to a bridge that has been picked randomly and destroy it. The bridge information is contained in an array: eastGermanBridges = [ // [[Position, object ID], [Position, object ID],...] [[10577.8,17680.2,0], 164227], [[10889.8,17545.4,0],165458], [[12102.7,17199.6,0],165582], [[13399.5,15948,0],164235], [[14312.1,15123,0],164249], [[13630.1,12722.1,0],164261], [[14927.9,15361.6,0],166646], [[14943.2,15220.9,0],166647], [[15658.5,14663.3,0],235425], [[15663.2,14166.2,0],238196], [[16256.9,12515.4,0],270828], [[17365.1,11464.7,0],275208], [[18684.4,11083.3,0],276575], [[14927.8,15360.4,0],166646], [[16192.9,15358,0],235165], [[18230.3,15977.5,0],266019], [[19959.8,4850.35,0], 1464670], [[18082.2,5211.08,0], 1470836], [[16399.4,6661.06,0], 1461107], [[16143.3,6951.2,0], 1460362], [[16004.2,7406.74,0], 174988], // Railroad bridge [[15553.2,8796.89,0], 293086], [[14255.2,11924.2,0], 280667], [[13137.8,8403.86,0], 1484167], [[12917.6,8265.83,0], 1487696], [[12582.7,7924.79,0], 1495446], [[12364.4,7602.17,0], 174563], // Railroad bridge [[13666.6,4606.77,0], 1507185], [[13870.7,4370.2,0], 1509436], [[15269.4,2432.02,0], 1517183], [[16340.1,178.734,0], 1518517] ]; I choose the bridge with the following code: if(!isServer) exitWith {}; private _bridgeArray = selectRandom eastGermanBridges; private _bridgePosition = _bridgeArray select 0; bridge = nearestObject _bridgePosition; I have the following code calls a function to check if the bridge has been destroyed: ["itemAdd", ["bridgeDestroyedID", { [] call bridgeDestroyedCheck; }, 1]] call BIS_fnc_loop; If the bridge has been destroyed it sets the task to succeeded and creates a new task to return to base to complete the mission: if(!isServer) exitWith {}; if(!alive bridge) then { ["itemRemove", "bridgeDestroyedID"] call BIS_fnc_loop; ["destroyBridgeTask","SUCCEEDED"] call BIS_fnc_taskSetState; [true, ["returnTask"], ["Bridge destroyed! Good work, now report to the officer.", "Report to Officer", "returnMarker"],officer_1, "ASSIGNED", 1, true, "navigate", true] call BIS_fnc_taskCreate; ["itemAdd", ["checkForWinID", { [] call checkForWin; }, 1]] call BIS_fnc_loop; }; When testing it I bring up a debug console and type: bridge setDamage 1; The bridge is destroyed and the task completes. However, if I sneak out to the bridge and plant explosive charges and blow the bridge up that way the task is not completed even though the bridge is destroyed.
  17. I have a PC that I use as a dedicated server. One of my friends who plays on the PC is almost unkillable. After dying I watch the blood splatters as he gets hit 20, 30, 40 times and not die. I saw him walk away after his helo blew up after being hit by a surface to air missile! Is there a server setting that I need to set to force players to use the server's difficulty levels? Is this guy cheating or is it an innocent client side setting that my server is not correcting? Thanks.
  18. Luft08

    Task not completing

    It Worked. I changed my bridge array to remove all of the object IDs and railroad bridges that are indestructable. No sense it keeping them. eastGermanBridges = [ [10577.8,17680.2],[10889.8,17545.4],[12102.7,17199.6],[13399.5,15948],[14312.1,15123], [13630.1,12722.1],[14927.9,15361.6],[14943.2,15220.9],[15658.5,14663.3],[15663.2,14166.2], [16256.9,12515.4],[17365.1,11464.7],[18684.4,11083.3],[14927.8,15360.4],[16192.9,15358], [18230.3,15977.5],[19959.8,4850.35],[18082.2,5211.08],[16399.4,6661.06],[16143.3,6951.2], [15553.2,8796.89],[14255.2,11924.2],[13137.8,8403.86],[12917.6,8265.83],[12582.7,7924.79], [13666.6,4606.77],[13870.7,4370.2],[15269.4,2432.02],[16340.1,178.734] ]; Then I use the following code to set the bridge variable: if(!isServer) exitWith {}; private _bridgePos = selectRandom eastGermanBridges; // Get a list of road segments within 10 meters of the position in the bridge array. private _roadSegArray = _bridgePos nearRoads 10; // Iterate though the list looking for a road type of bridge. { // forEach _roadSegArray private _roadInfo = getRoadInfo _x; if(_roadInfo select 8) then { bridge = _x; }; } forEach _roadSegArray;
  19. Luft08

    Task not completing

    Thanks pierremgi, I just woke up out of a sound sleep when what I believe to be the answer popped into my head. Much like what you suggest! I think what is happening is the nearest object at my positions are things UNDER the bridge. Maybe what I should do it get a list of road segments within a radius of my position and iterate through them looking for a road type of bridge. Hopefully the road segment IS the bridge and can be destroyed. I want to thank you and everyone in the Arma community that makes working on these projects so enjoyable. It would take so much longer without your support. Thanks!
  20. Luft08

    Task not completing

    oops... I just read that object IDs are unreliable and could change at each map update. Well, this should simplify my bridge array but now I'm really stuck. Can't I set a variable to the value returned by nearestObject? Does nearestObject return a copy or a reference?
  21. Luft08

    Task not completing

    Thanks, I though about that but I just made another test. I went to the bridge to get a snapshot of it blowing up. I set the damage to 1 and the task completed but the actual bridge was untouched! I'm thinking I need to do something with the bridge IDs. I collected this data a long time ago but forgot what I was going to do with the ID.
  22. I used BIS_fnc_taskDefend to get a group to defend a location but after a period of time I want the group to move to a new location and defend that position. I tried issuing another BIS_fnc_taskDefend but they ignore it. I also tried to set a waypoint but again they ignore it. How do I cancel the BIS_fnc_taskDefend so that I can issue new commands? Thanks.
  23. Thanks pierremgi. Wow that script does a lot. I will write my own using the guard waypoint and createGuardedPoint as you suggest. Thanks again for your info and advice.
  24. I was testing one of my coop missions on a dedicated server with a few friends. I died quickly so I was watching the other's play. One player was repeatedly hit by gun fire but just kept going. It happened so many times that I though maybe I had disabled damage for the unit. He did finally die and later checks showed that damage was enabled. So I looked through the difficulty settings and found a "reduced damage" setting. That appears to be what was happening but only to him. My question is: If a player sets reduced damage on HIS Arma does the dedicated server change it back or does he play with an unfair advantage? If so how do I enforce my server's difficulty settings on player's PCs? Thanks.
×