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

NunesSergio

Member
  • Content Count

    25
  • Joined

  • Last visited

  • Medals

Everything posted by NunesSergio

  1. Something like: if !isServer exitWith {}; //Fade to black effect [0] remoteExec ["BIS_fnc_fadeEffect"]; //Wait till screen fades completely uiSleep 3; //Move all inside trigger area private _myTrigger = <your trigger name/object goes here>; private _playersToTeleport = allPlayers inAreaArray _myTrigger; { _x setVehiclePosition [_myPosition, [], 0, "NONE"]; sleep 0.3; } forEach _playersToTeleport; //Fade in effect [1] remoteExec ["BIS_fnc_fadeEffect"]; Important: This code must run in scheduled environment, so it should only be ran via execVM or spawn. Also because of all these commands global effect nature, I made it so even if you mistakenly start it on every machine, only the server will go through with it, as it's all that's needed.
  2. Hello! I'm trying to make players not die whenever they receive fatal damages. I figured it out for on-foot soldiers, but whenever in a vehicle, it's explosion/destruction causes the immediate death of the player regardless of any damage handling I apply to the soldier. Even "killed" Event Handler seems to fire past the point of all crew deaths. So I figured I'd have to intercept and manage the vehicle damage and manually destroy it only after I eject all crew. The thing is I can't really point out the main/more frequent causes of a vehicle destruction and didn't want to make it too unnatural. Using "HandleDamage" EH gives me many mixed signals, as different vehicles have different selections and hitpoints, and sometimes even giving >= 1 damage to all hitpoints doesn't make it go !alive. Also damage seems to play little to no role on vehicle destruction on the majority of times. Do any of you know a good / best practice way to check for vehicle integrity and perceive it's destruction?
  3. Is this for a solely SP mission? Or is it also MP? BIS_fnc_holdActionAdd codes run local on player machine. setUnconscious requires a local argument. Maybe you'd have to remoteExec it for it to work 100% of the time? If locality is not the issue, then I'm probably not good to help you now. Never used setUnconscious before.
  4. remoteExec'ing a .sqf goes like this: //Using "example.sqf" Local (normal) execution: [] execVM "example.sqf"; To remote execute on server machine: "example.sqf" remoteExec ["execVM", 2]; If the script requires argument(s): [[_arg1, _arg2], "example.sqf"] remoteExec ["execVM", 2];
  5. Is there any way (scripting command or function I overlooked) to draw trigger area in 3D space, while in-game, like it shows in 3DEN Editor? I've seen Mr. H's post and it's a handy solution, but I'd prefer the vanilla result if possible.
  6. Hello there! I'm trying to account for soldiers being spawned inside of rocks, so I figured I'd draw a line upwards above the soldier's head, pick the object of the first surface the line touches and call it a day. The thing is, the command does not throw me classname objects, it throws me proxy objects (p3d). Here is my code: _pos = getPosASL _unit; _objs = lineIntersectsWith [_pos, _pos vectorAdd [0,0,10], _unit]; _objs //This gives me: [155305: sharprock_spike.p3d] As you can see, that's just the kind of object I want to detect. But passing it through isKindOf doesn't help. Other "line" commands (lineIntersectsObjs, lineIntersectsSurfaces, etc), give me the same result. How can I detect if that object is a rock? The only thing I could think of was to convert that using str and check for "rock" in the resulting string, but I assume that's just sloppy and could cause some false alarms.
  7. Yes I use this a lot, but when spawning a whole group, the safe position is only guaranteed to be the group leader's. The other members spawn in formation (or any other) and can end up more often than not under terrain rocks 😞 I just didn't want to use findSafePos for every single unit I spawn.
  8. NunesSergio

    Get Caller of Script

    That is correct, but since you'd be messing with dialogs (thus on uiNamespace), you should consider setting the unit on this environment: uiNamespace setVariable ["TAG_myUnit", _caller]; Don't forget uiNamespace variables live through all the game execution duration, not just mission duration. So remember to always delete setted values on uiNamespace to avoid possible conflicts with other sessions the player may enter before closing the game. To erase the unit's reference from the variable once you close the dialog, you can use: uiNamespace setVariable ["TAG_myUnit", nil]; on the dialogs "onUnload" event handler.
  9. if (((units east) inAreaArray _myTrigger) findIf {player knowsAbout _x == 0} < 0) then { systemChat "Player knows about every EAST unit in trigger"; } else { systemChat "Player doesn't know about every EAST unit in trigger"; };
  10. Point to any vehicle (a vehicle able to be slingloaded) and run the following code. The nearest sling loading position to the player will be highlighted in red: _veh = cursorTarget; _selections = (_veh selectionNames "Memory") select {"slingloadcargo" in _x}; addMissionEventHandler ["Draw3D", { _thisArgs#0 apply { drawIcon3D [ "", [1,1,1,1], _thisArgs#1 modelToWorldVisual (_thisArgs#1 selectionPosition [_x, "Memory"]), 0, 0, 0, _x, 2 ]; }; }, [_selections, _veh]]; _distances = []; for "_i" from 0 to ((count _selections) - 1) do { _distances pushBack (_veh modelToWorldVisual (_veh selectionPosition [_selections#_i, "Memory"])); _distances set [_i, [player distance _distances#_i, _distances#_i, _selections#_i]]; }; _distances sort true; addMissionEventHandler ["Draw3D", { drawIcon3D [ "", [1,0,0,1], _thisArgs#0 modelToWorldVisual (_thisArgs#0 selectionPosition [_thisArgs#1, "Memory"]), 0, 0, 0, _thisArgs#1, 2 ]; }, [_veh, _distances select 0 select 2]];
  11. The way I did it was, upon initPlayerLocal.sqf I remotely add an Score event handler on server which, based on the value of the score, remotely fires my hitmarker function back on player machine: //initPlayerLocal.sqf params ["_player", "_didJIP"]; [_player, "configScore.sqf"] remoteExec ["execVM", 2]; //configScore.sqf params ["_player"]; _player addEventHandler ["HandleScore", { params ["_unit", "_object", "_score"]; //Score == 1 means you killed one soldier enemy unit (be it in or out of a vehicle) if (_score isEqualTo 1) then { ["hitMarkerAnimation.sqf"] remoteExec ["execVM", _unit]; }; }]; Keep in mind that if your mission has respawn of players, you'd have to re-assign the Score event handler to the respawned unit. So repeat the initPlayerLocal.sqf lines on onPlayerRespawn.sqf (changing _player for _newUnit): //onPlayerRespawn.sqf params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"]; [_newUnit, "configScore.sqf"] remoteExec ["execVM", 2]; Whenever you kill an enemy unit, wherever it's spawned from, or how it was handled by scripts, you get your hitmarker and are free from tracking enemy unit creation process.
  12. Hello there! So I have a dedicated server running a mission of mine. I want to possibly show JIP players which mods they could use if they want to. I know I can hardcode some info somewhere to the players but I'm looking for a way to do it dynamically, so when the "*.bikey" (s) on my server keys folder changes, connecting players would have access to the updated possible modset. Ps: I can wrap my mind around on how the server passes this information to JIP clients, but I can't seem to find a way to detect said keys in the first place. Ps²: I tried something along the lines of the fileExists command, but it seems to work only with mission-relative paths. Can it be done? Kinda would want to avoid having to create an extension for that (should that be the only way).
  13. Just use "false" as the third parameter of this command: heli1 AnimateDoor ["Door_rear_source", 1, false]
  14. If by team you mean group you could do: private _notOnMyGroup = []; _notOnMyGroup = allPlayers select { group _x isNotEqualTo group player }; _notOnMyGroup //every player not in player's group
  15. NunesSergio

    Fire support kill score problem

    How are you calling the fire support? If it's totally by script I can vaguely think of ways of carrying the caller reference as arguments all the way to the projectile to attribute credit to him. It would involve a "FiredMan" Event Handler on the fire support gunner, a temporary global variable and setShotParents. If it's a multiplayer mission it should execute server-side.
  16. So I have a dedicated server. I've been using inline functions (some on server, some on clients) since some server functions doesn't need to be called on client machines and vice-versa. Recently I discovered CfgFunctions in Description.ext which promisses to prevent functions from being recompiled, addition to Functions Library, hack-proofing, possibility to preInit and posInit, all that good stuff. But I'm under the impression that if I compile all my functions from there, both parties (server and clients) would have allocated RAM resources to ALL those functions, am I correct? Is there a way to define which functions to compile (using CfgFunctions) so I can free clients from compiling the ones they don't need, but make them DO compile functions they need to have? Or am I stuck with inline functions?
  17. Thanks for the reply. I'll do it then. I was just worried about performance for clients, since here in Brazil people often have crap PCs and every bit of RAM counts. But WTH.
  18. Thanks for the thorough explanation and examples. I did see the documentation mentioning about "player" not existing in an dedicated MP scenario but... it works! The code, as I posted above, works on a dedicated MP session for every player. Probably not a best practice and maybe a low-performance solution but got the job done for now. As I am still learning and me and my friends sessions are not that performance-testing intensive, we'll probably continue using this untill I have time to test and implement your late suggestions. Thank you for the tips!
  19. Hello there! I'm struggling to find the solution to my problem. Already googled a lot to no use. My friends and I have a dedicated server running a mission which has a HALO Jump SQF script. This script is tied to a whiteboard object. Basically we want the HALO Jump to be available only when there are no pilot roles taken. I can only think it must be something along the lines of filling an array with "typeOf allPlayers" and run "typeOf" through it to know if there's "B_Helipilot_F" in there, but I really can't wrap my mind around the syntaxes. Can anyone help? Thanks in advance!
  20. In case my necessity is anyone else's, I put this in the Init field of the whiteboard: [ this, "HALO Jump", "\a3\ui_f\data\gui\cfg\CommunicationMenu\supplydrop_ca.paa", "\a3\ui_f\data\gui\cfg\CommunicationMenu\supplydrop_ca.paa", "player distance HJ < 4", // 'HJ' being the variable name of the whiteboard "true", {}, {}, { []execVM "myHALOJump.sqf" }, {}, [], 1, 6, false, false, true ] call BIS_fnc_holdActionAdd Then the first lines inside "myHALOJump.sqf" are using an almost identical code M1ke_SK taught me, and it goes like this: if (allPlayers findIf { typeOf _x in ["B_Helipilot_F"] } > -1) exitWith { titleText ["<t size='2.0'>HALO Jump is disabled while there is a <t color='#006bb3'>pilot</t> logged in", "PLAIN DOWN", 1, false, true]; breakOut "main"; }; If there are any BLUFOR NATO Helicopter Pilots (B_Helipilot_F) roles taken by any player then the script prints the titleText message and stops right there.
  21. Thank you all, Harzach, pierremgi and M1k3_SK! It worked like a charm. I followed Hazarch's advice and, instead of actively scanning for pilots all the time, I put it in the code param of a holdAddAction and that's just what I needed. Thank you, boys!
  22. NunesSergio

    GF Kill info Script

    Thanks anyway! Your scripts are awesome and have helped me build missions much more robust I could have ever done it myself.
  23. NunesSergio

    GF Kill info Script

    Hello there! I love this script but I can't get it working on my mission which has the recent vanilla revive mode enabled. I was expecting the messages to pop-up when a player is downed and enters the incapacitaded state, but nothing happens. I wonder if it's got something to do with different Event Handlers used for death and incapacitation, maybe?! Is there any way to get it working under these conditions?
×