Jump to content

sarogahtyp

Member
  • Content Count

    2494
  • Joined

  • Last visited

  • Medals

Everything posted by sarogahtyp

  1. sarogahtyp

    About distances

    mostly I use distanceSqr. I thought bout if distance2D is faster but never tested it. With nearestObjects I use 2d mode as well.
  2. do you have any remote execution restrictions in your description.ext as described here? https://community.bistudio.com/wiki/Arma_3:_CfgRemoteExec
  3. Try the object _x instead of 2
  4. I found this: https://steamcommunity.com/sharedfiles/filedetails/?id=2484775180 did you try it already? Edit: For me it seems to be a good port but its vanilla only.
  5. I did not fully understand what you want to do exactly but I guess you need to enable/disable the EH behaviour related on actions taken by clients. The important thing is to execute the event handler where the popups are local. This should be on server. If you need other behaviour then the event handler provides then you have to remove the EH from those targets. Therefore you should apply the EH everytime you need the behaviour and remove it after that. If a client decides on which popups the EH should get applied then you have to remoteExec the EH on the server. This can be done by first creating a sqf file with the EH. You could name it apply_EH.sqf apply_EH.sqf params ["_popup"]; //apply EH private _eh_index = _popup addEventHandler ["Hit", { private _hit_num = 10; private _down_time = 5; params ["_unit"]; private _phase = _unit animationPhase "Terc"; if ( _phase isNotEqualTo 0 ) exitWith { }; private ["_dummy"]; private _hit_already = _unit getVariable ["saro_hit_num", 0]; if ( _hit_already < _hit_num - 1) exitWith { _unit setVariable ["saro_hit_num", (_hit_already + 1) ]; _dummy = _unit spawn { sleep diag_deltaTime; _this animateSource ["Terc", 0]; }; }; _dummy = [_unit, _down_time] spawn { params [ "_unit", "_down_time" ]; private ["_phase"]; private _down_start = 0; sleep diag_deltaTime; waitUntil { _phase = _unit animationPhase "Terc"; if ( _phase isEqualTo 1 && _down_start isEqualTo 0 ) then { _down_start = diag_tickTime }; _unit animateSource ["Terc", 1]; _down_start > 0 and (diag_tickTime - _down_start) > _down_time }; _unit animateSource ["Terc", 0]; _unit setVariable ["saro_hit_num", 0]; }; }]; //store the EH index on popup to be able to remove the EH later _popup setVariable ["saro_eh_index", _eh_index]; for one specific popup (I call it _one_popup here) chosen by a client to get the EH behaviour on it you can do now: [_one_popup, "apply_EH.sqf"] remoteExec ["execVM", 2]; next thing you need a sqf file to remove that behaviour. remove_EH.sqf params [_popup]; //get the prior stored Index of the EH private _eh_index = _popup getVariable "saro_eh_index"; // no index found, just leave if (isNil "_eh_index") exitWith {}; //remove the EH _popup removeEventHandler ["Hit", _eh_index]; //destroy the index variable on popup _popup setVariable ["saro_eh_index", nil]; After that on the time a client decides to not need the EH behaviour anymore you can just do [_one_popup, "remove_EH.sqf"] remoteExec ["execVM", 2]; not tested but should work...
  6. sarogahtyp

    Deleting simple objects

    Try https://community.bistudio.com/wiki/nearObjects
  7. This is tested in init field of popup in SP only and working. Its a long thing and maybe there is a shorter solution. Should work in MP as well but not testet it there: if !(local this) exitWith {}; this addEventHandler ["Hit", { private _hit_num = 10; private _down_time = 5; params ["_unit"]; private _phase = _unit animationPhase "Terc"; if ( _phase isNotEqualTo 0 ) exitWith { }; private ["_dummy"]; private _hit_already = _unit getVariable ["saro_hit_num", 0]; if ( _hit_already < _hit_num - 1) exitWith { _unit setVariable ["saro_hit_num", (_hit_already + 1) ]; _dummy = _unit spawn { sleep diag_deltaTime; _this animateSource ["Terc", 0]; }; }; _dummy = [_unit, _down_time] spawn { params [ "_unit", "_down_time" ]; private ["_phase"]; private _down_start = 0; sleep diag_deltaTime; waitUntil { _phase = _unit animationPhase "Terc"; if ( _phase isEqualTo 1 && _down_start isEqualTo 0 ) then { _down_start = diag_tickTime }; _unit animateSource ["Terc", 1]; _down_start > 0 and (diag_tickTime - _down_start) > _down_time }; _unit animateSource ["Terc", 0]; _unit setVariable ["saro_hit_num", 0]; }; }]; you are able to adjust needed number of hits with variable _hit_num and the time the target is down with _down_time
  8. No need to use MP event handler. The Hit event handler executed where popups are local (most likely on server) should be enough. The problem is to suppress the engine animation for popping up again, but I m on it...
  9. Reading the faster topics first post helps...
  10. sarogahtyp

    MP scripting issues

    MP scripting is the higher level. One has to read the biki entries for each command carefully to get it done.
  11. sarogahtyp

    MP scripting issues

    missionNamespace setVariable ["sorted_locations", _sortedLocations]; creates the global variable sorted_locations on the machine where that line is executed. To get it a public variable (known by all machines) you have to set the third parameter of setVariable to true as stated in biki and shown in Example 1 there. therefore u should use this to get it public: missionNamespace setVariable ["sorted_locations", _sortedLocations, true]; but I did not verify if that solves your problems...
  12. i wrote and tested the script in above post. Should work for you.
  13. sarogahtyp

    how to count ai casualties?

    No, I'm out of here. This is too exhausting for me with you.
  14. sarogahtyp

    how to count ai casualties?

    no need to post that twice. Which way do you want to do this if you can't script anything? What have you done yet? If you write another "One-Short-Sentence-Answer" then I am outta here...
  15. sarogahtyp

    how to count ai casualties?

    If I remember correct then you can just open the map then click on a specific player and then you will see which AI was killed by that player.
  16. sarogahtyp

    how to count ai casualties?

    if u don't script, what for do u need it? Describe what u want to do!
  17. sarogahtyp

    how to count ai casualties?

    what casualties? what topic did u read? what did u try yet?
  18. sarogahtyp

    force spawned Ai to move on roads

    just in case someone is looking for something similar. spawning quad (near road) and driver - adding 2 random waypoints - endless driving between both waypoints: tested in initServer.sqf on Altis in Kavala: waitUntil { sleep 1; time > 0 }; //center position of waypoint and spawn position search private _center_pos = getPos saro_trigger; // maximum distance between center and waypoints/vehicle spawn private _waypoint_search_radius = 500; //minimum distance between both waypoints private _wp_min_distance = 50; //move player into vehicle (for testing) _player_move_in = true; //speed for moving ( "LIMITED" "NORMAL" "FULL" ) private _wp_speed = "FULL"; private ["_pos1", "_pos2", "_road1", "_road2", "_wp2"]; private _posvec = [0,0,8000]; private _wp_min_distanceSqr = _wp_min_distance^2; while { (_posvec nearRoads 15) isEqualTo [] } do { _posvec = [_center_pos, 0, _waypoint_search_radius, 7] call BIS_fnc_findSafePos; }; //spawn hunter _veh = createVehicle ["B_G_Quadbike_01_F", _posvec, [], 0, "NONE"]; //spawn unit and make driver _unit = (createGroup west) createUnit ["B_crew_F", [0, 0, 8000] , [], 0, "CAN_COLLIDE"]; _unit assignAsDriver _veh; _unit moveInDriver _veh; if ( _player_move_in ) then { player moveInAny _veh; }; while { isNil "_road1" || isNil "_road2" || { _road1 distanceSqr _road2 < _wp_min_distanceSqr } } do { _pos1 = _center_pos getPos [ (random _waypoint_search_radius) , (random 360) ]; _pos2 = _center_pos getPos [ (random _waypoint_search_radius) , (random 360) ]; _road1 = (_pos1 nearRoads 50) select 0; _road2 = (_pos2 nearRoads 50) select 0; }; saro_wp1 = (group _unit) addWaypoint [(position _road1), 0]; _wp2 = (group _unit) addWaypoint [(position _road2), 0]; saro_wp1 setWaypointType "MOVE"; _wp2 setWaypointType "MOVE"; saro_wp1 setWaypointCompletionRadius 10; _wp2 setWaypointCompletionRadius 10; saro_wp1 setWaypointSpeed _wp_speed; _wp2 setWaypointSpeed _wp_speed; _wp2 setWaypointStatements ["true", "(saro_wp1 select 0) setCurrentWaypoint saro_wp1;"];
  19. Why naming multiple units? Your code let AISoldier_1 join players group if player is near. nothing else. no reason to name the other AI.
  20. Into init field of each AI which should join if player gets near: this setVariable ["saro_joinable", true]; set the trigger to: none, none, repeatable Condition: not ( (units side player) findIf { _x getVariable ["saro_joinable", false] and { _x distance player < 2 } } < 0 ) On Activation: [] spawn { private _near_men = player nearEntities ["Man", 2]; private _marked_men = _near_men select { _x getVariable ["saro_joinable", false] }; private _man = _marked_men select 0; _man setVariable ["saro_joinable", false]; [_man] join player; }; Now if you reach any of the AI which was marked with the init field enrtry it will join players group.
  21. Whenever u script for multiplayer ask where (which machine) and when is the current script is running then look for each command in biki where the specific command has to run. Maybe on server or a specific client or on all clients or maybe everywhere. You can find the answer mostly on top of the biki page. There often is told if it is a server command only or if it takes effect only on the machine where it runs or if it has to run where its arguments (maybe an object) are located. Thats one reason to ask you where and how your scripts are executed as @Harzach did...
  22. sarogahtyp

    Arma 3 Apex: Old Man Feedback

    @sirrah Idk bout the old man but the list of arma 3 vanilla weapons is CfgWeapons There the Accessories column is what you are looking for.
  23. sarogahtyp

    Switchmove skips

    try to learn from what you read and restart here:
  24. sarogahtyp

    Local Variable in Global Space

    all posts 'bout wrapping are related to this. wrapping is just wrapping. ask your favorite translation software for it... what harzach means was to wrap your code with a call scope. that would look like what I posted but with the call instead of a spawn. Edit: huh, Ireland ... translation software should not be necessary 😉
×