Jump to content

Grumpy Old Man

Member
  • Content Count

    4333
  • Joined

  • Last visited

  • Medals

Everything posted by Grumpy Old Man

  1. Grumpy Old Man

    Change mass when sling

    Not sure what you mean, filtering by classNames is already in there. Cheers
  2. Grumpy Old Man

    Change mass when sling

    Something like this: TAG_fnc_handleSlingMass = { params ["_chopper"]; _chopper addEventHandler ["RopeAttach",{ params ["_chopper", "_rope", "_slingLoad"]; _massArray = [["B_Quadbike_01_F",50],["B_T_Boat_Transport_01_F",100]];//quadbike will have 50 mass, boat will have 100 during slingloaded state _vehClasses = _massArray apply {_x#0}; _vehMasses = _massArray apply {_x#1}; _index = _vehClasses find typeOf _slingLoad; _slingLoaded = _slingLoad getVariable ["TAG_fnc_slingLoaded",false];//this is needed because EH fires for every attached rope, so you prevent overwriting the actual mass with the replacement mass if (_index > -1 AND !_slingLoaded) then { _slingLoad setVariable ["TAG_fnc_slingLoaded",true]; _slingLoad setVariable ["TAG_fnc_oldMass",getMass _slingLoad]; _slingLoad setMass _vehMasses#_index; }; }]; _chopper addEventHandler ["RopeBreak",{ params ["_chopper", "_rope", "_slingLoad"]; _oldMass = _slingLoad getVariable ["TAG_fnc_oldMass",200];//200 will be used as a default value _slingLoad setMass _oldMass; }]; true }; _handleMass = [chopper] call TAG_fnc_handleSlingMass; //to test on quadbike named test: onEachFrame {hintSilent format ["Current Mass:%1\nStored Mass: %2",getMass test,test getVariable ["TAG_fnc_oldMass",-1]]}; Cheers
  3. Grumpy Old Man

    Making AI ignore specific players

    For proper mission testing environment you can use TADST to set up a local dedicated server to prevent any future surprises. Once set up it's as easy as exporting your edited mission, start the dedi and launch another client to join it. Cheers
  4. Grumpy Old Man

    Does white space affect performance?

    Makes sense to speed up websites like that, in arma .sqf files are downloaded with the mission file and usually remain in memory. Unless you broadcast the actual function via network, removing whitespaces in .sqf has no real benefits (unless someone else can come up with one). Cheers
  5. Grumpy Old Man

    Does white space affect performance?

    In your regular, run of the mill .sqf files? No. Doubt it's even measurable unless we're talking about 200mb+ files filled with space/tab whitespaces. Cheers
  6. Grumpy Old Man

    Making AI ignore specific players

    Of course a simple command won't fix it, how you implement it is up to you. You can always run a loop on the server that checks if a certain player (filtered by UID or what seems to fit) is in the target list or at a certain distance, then use setCaptive and forgetTarget in that specific order. Cheers
  7. The respawn module has an expression field that will be executed upon respawn, passed parameters are [newVehicle,oldVehicle], so could go like this: //respawn module expression field: params ["_newVehicle","_oldVehicle"]; _newVehicle addWeaponTurret ["gatling_30mm",[0]]; _newVehicle addMagazineTurret ["250Rnd_30mm_HE_shells",[0]]; _newVehicle addMagazineTurret ["250Rnd_30mm_HE_shells",[0]]; _newVehicle addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]]; _newVehicle addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]]; _newVehicle addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]]; _newVehicle addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]]; _newVehicle addWeaponTurret ["missiles_Jian",[0]]; _newVehicle addMagazineTurret ["4Rnd_LG_Jian",[0]]; _newVehicle addMagazineTurret ["4Rnd_LG_Jian",[0]]; _newVehicle addMagazineTurret ["4Rnd_LG_Jian",[0]]; _newVehicle addMagazineTurret ["4Rnd_LG_Jian",[0]]; _newVehicle addMagazineTurret ["4Rnd_LG_Jian",[0]]; Cheers
  8. Grumpy Old Man

    Help: Random Spawn

    Posted this in a thread earlier this week (last week? who knows): GOM_fnc_spawnPatrol = { params ["_pos","_units","_side","_size","_distance"]; _grp = createGroup [_side,true]; for "_i" from 0 to _size do { selectRandomWeighted _units createUnit [_pos, _grp]; }; //patrol random points at n distance while {{alive _x} count units _grp > 0} do { waitUntil {sleep (5 + random 20);unitReady leader _grp AND combatMode leader _grp != "COMBAT"}; _grp move (_pos getPos [random _distance,random 360]); } }; //90% chance to spawn soldier_f, 10% chance to spawn TL_F _units = [ "O_G_Soldier_F",0.9,"O_G_Soldier_TL_F",0.1 ]; _patrol = [getPos player,_units,east,10,50] spawn GOM_fnc_spawnPatrol; Easy to go from there. Cheers
  9. Back in the days we ended arguments under 4 eyes in the backyard of an abandoned factory. Not that easy over forum posts, well maybe I'll live the day to see teleporters become a thing... Doubt that someone other than the dev who implemented it can give a proper reasoning. Same goes for why most script commands are always overriden by default AI (i.e.: make vehicle always have its lights on, no matter the behavior etc...) Only thing I can think of is to somehow work out the screen coordinates of the control, get its center position and align the text from there, your usual workaround. Cheers
  10. Grumpy Old Man

    Making AI ignore specific players

    Did you try setCaptive? Cheers
  11. Grumpy Old Man

    Script Loading

    CfgFunctions should do the trick, even allows to call functions during pre/postInit, for (vastly) increased performance. Cheers
  12. Grumpy Old Man

    Randomness

    Depends on how many missions you want to rotate. If you only have 5 missions and want to play a random mission out of those 5 for 3 or 4 restarts you're absolutely right in seeing a pattern, since the brain is a pattern detection device. Try this: test = ["A","B","C","D","E"]; output = []; for "_i" from 1 to 10 do {output pushBack selectRandom test}; systemchat str output; hint str output; //will print ["E","D","E","A","C","D","E","B","D","C"] //consolidated in order of first occurence: [["E",3],["D",3],["A",1],["C",2],["B",1]] That's bound to happen with a small sample size. Increase the for loop to 100 and see the difference, a more normal distribution on occurrences, the order might still pick the same mission 2-3 times in a row. Better randomize an array of missions to choose from, play through all of them and randomize it again after the last one. Cheers
  13. Grumpy Old Man

    cant get score on server

    Doubt this even works because wlkscore is never initialized. Seems like an odd approach, why not use EntityKilled eventhandler and run it from initServer.sqf? Something like this: //initServer.sqf wlkscore = 0; addMissionEventHandler ["EntityKilled", { params ["_unit", "_killer", "_instigator", "_useEffects"]; if (isPlayer _unit AND side group _unit isEqualTo civilian) then { wlkscore = wlkscore + 30 }; if (!isPlayer _unit and side group _unit isEqualTo independent) then { wlkscore = wlkscore + 3 }; }]; Might be easier to handle everything from the server with a single EH. Cheers
  14. Count the amount of round brackets. A giveaway for any text editor supporting .sqf syntax highlighting. Cheers
  15. Grumpy Old Man

    Help: Spawn AI Unit and Begin Patrolling

    The error you're getting depends on what "this" is, first parameter you're passing to bis_fnc_taskPatrol. Here's a barebones version that I enjoy using for simple unit spawning and sending them on patrol: GOM_fnc_spawnPatrol = { params ["_pos","_units","_side","_size","_distance"]; _grp = createGroup [_side,true]; for "_i" from 0 to _size do { selectRandomWeighted _units createUnit [_pos, _grp]; }; while {{alive _x} count units _grp > 0} do { waitUntil {sleep (5 + random 20);unitReady leader _grp AND combatMode leader _grp != "COMBAT"}; _grp move (_pos getPos [random _distance,random 360]); } }; _units = [ "O_G_Soldier_F",0.9,"O_G_Soldier_TL_F",0.1 ]; _patrol = [getPos player,_units,east,10,50] spawn GOM_fnc_spawnPatrol; Using selectRandomWeighted you can dictate the chance which unit class will be picked, in the above case 90% chance to spawn a rifleman, 10% chance to spawn a TL. Can easily enhance this to add custom speedModes and combat modes upon spawning. Cheers
  16. From what I know it's an event where programmers write stuff within a certain timeframe for a certain theme. Cheers
  17. Grumpy Old Man

    [Release] GOM - Aircraft Loadout V1.35

    Looks like the hydra weapon still stays on the helicopter, pylons removed and 0 ammo, as you stated. On the wipeout the clear all pylons command removes all weapons and pylons correctly, GOM_fnc_clearAllPylons in line 679 of GOM_fnc_aircraftLoadoutInit.sqf is executed to clear all pylons (which works for all vanilla aircraft I tested so far). Feel free to adjust it so it removes any possible remainders (not really sure why the hydra weapon still stays on the chopper even with pylon and mags removed, maybe there's something I missed), the following lines from the aforementioned function should leave no weapon on the aircraft: _pylonWeapons = []; { _pylonWeapons append getArray (_x >> "weapons") } forEach ([_veh, configNull] call BIS_fnc_getTurrets); { [_veh,_x] remoteexec ["removeWeaponGlobal",0] } forEach ((weapons _veh) - _pylonWeapons); Cheers
  18. You could use the take eventhandler and simply check if the item taken is a compatible mag and do your swap. player addEventHandler ["Take", { params ["_unit", "_container", "_item"]; _compatibleMags = ["someClassnames"]; if (_item in _compatibleMags) then { _unit removeMagazine "rhs_30Rnd_545x39_7N10_AK"; _unit addMagazine ["rhs_30Rnd_545x39_AK",_ammoCount]; }; }]; Just an untested quick example, adjust as needed. This will check if the item is in the compatible mag array and switch it out. Cheers
  19. Grumpy Old Man

    [Release] GOM - Aircraft Loadout V1.35

    Does this happen in an empty mission without mods? If so please post which aircraft and setting (best step by step) is causing this. Cheers
  20. Grumpy Old Man

    Change Faction

    Elaborate further on how the initial sides have been set up, was the unit initially civ (editor placed civilian)? Cheers
  21. Grumpy Old Man

    Ingame time script

    Wasn't really helpful during covert ops, I admit. Cheers
  22. Grumpy Old Man

    Change Faction

    Uhm maybe you're not following through on this one or I'm confused but have you tried using side player to check for a players side? As stated above by @mrcurry, read the whole thing, heh. Cheers
  23. Grumpy Old Man

    Help with dialog

    Don't try to make everything with one function, make multiple functions that do one thing only. I guess you can also add custom eventhandlers to handle what you need. Cheers
  24. Grumpy Old Man

    Change Faction

    Why do you need to use playerSide? Cheers
×