Jump to content

Leopard20

Member
  • Content Count

    330
  • Joined

  • Last visited

  • Medals

Community Reputation

227 Excellent

2 Followers

About Leopard20

  • Rank
    Staff Sergeant

Contact Methods

  • Website URL
    https://github.com/leopard20

Profile Information

  • Gender
    Male
  • Location
    VR
  • Interests
    ARMA Scripting

Recent Profile Visitors

1774 profile views
  1. Nevermind. It was a mistake on my end. I was mistakenly applying an animation to the unit when he was inside, thus forcing him to disembark.
  2. Leopard20

    Friendly mines

    Good point. Try this instead. Set the activation side to all sides. Then the trigger units (list _trigger) gives all units on trigger area. You just have to use a "select {side _x == side player}" to see how many of them are on your side and how many of those units' bounding boxes are within the mine activation radius. This one should be the best. If you'd like to use oneachframe and have many mines, I recommend something like this: When creating the trigger: _trigg setVariable ["gc_mine", _mine]; As for activation code: [thisTrigger] call { params ["_trig"]; gc_trigs pushBackUnique _trig; ["gc_onEachF", "onEachFrame", { if (count gc_trigs == 0) exitWith { ["gc_onEachF", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; }; { _trig = _x; if !(triggerActivated _trig) then { gc_trigs = gc_trigs - [_x] } else { _mine = _trig getVariable ["gc_mine", objNull]; /* put the enableSim code here */ } } forEach gc_trigs; }] call BIS_fnc_addStackedEventHandler }
  3. Leopard20

    Friendly mines

    WaitUntil does run on each frame (it may miss a frame or two but it's not that important) but terminates the script if it gets too long. That's why it's faster. onEachFrame, however, runs the script completely and it may hurt performance. I had a semi heavy script running using onEachFrame and it caused nearly 7~8 FPS drops compared to waitUntil without any significant difference in terms of its effects. You can go with even bigger radius. 10 or 15 m should be fine, that way, the trigger will get activated in time.
  4. Ok. Let me try without some mods. See if it helps. I don't use any AI mods though. The only mod that might be responsible is CBA (others are just sound, unit, weapon, etc mods) BTW, all units and vehicles are vanilla. No waypoints, no nothing. It's just some code that orders units to mount a vehicle (either for being transported by another group or permanent use). I will post it when I get a chance.
  5. Tested addVehicle as well. No luck. Like I said, the leader DISEMBARKS the units (they remain inside for like a second or two). So obviously they are already INSIDE. So damage and free seat is irrelevant as I've already checked those out. The leader only disembarks the cargo units, not the gunner or commander or driver or even turrets. As if he's trying to tell them to go and fight! That's why it's weird.
  6. Leopard20

    Friendly mines

    Use a combination of trigger + enableSim. Set the trigger activation side to player side. And for the activation code, use: [thisTrigger] spawn { params ["_trig"]; waitUntil { _friendlies = list _trig; /* put the enableSim code here */ !(triggerActivated _trig) } } And obviously, for trigger deactivation code, you only need to re-enableSim. This code is more performance friendly (it only uses trigger units, faster than allVehicles, and waitUntil, which is faster than onEachFrame) P.S: Plz forgive any typos. I typed this on my phone!
  7. Hey everyone. I currently have a big problem with getting my mission to work properly and it's because the cargo units keep disembarking the vehicle. All units and vehicles (empty) are created after mission starts (it's a dynamic mission) and then I use assignAs... + orderGetIn to get the AI to get in vehicles. The only workaround I've found is to use: _unit moveInCargo [_veh, _index] ; [_unit] allowGetIn true; [_unit] orderGetIn true in an onEachFrame loop to get the unit to stay in. However, it causes the vehicle to stop every meter (excep for helicopters, thanks to allowGetIn which seems to work for helos), because the stupid leader still wants to disembark the units. Does anyone know a fix for this?
  8. Leopard20

    Arma 3 Notepad++ Syntax Highlighting

    Then perhaps it was a combination of update + changing the setting to Word and Function completion that made it work!
  9. Leopard20

    Variable Issue

    I know. That's what waitUntil is for. While is not needed.
  10. Leopard20

    Variable Issue

    Maybe you should update the variable? Besides, don't use while for such stuff (at least not without sleep). You only need a loop that runs on each frame, at most. A while loop runs multiple times per frame and wastes performance. Do it like this instead: _pla = player; if (_pla getvariable ["Restrained", false]) then { waitUntil { _pla playmove "AmovPercMstpSnonWnonDnon_Ease"; !(_pla getvariable ["Restrained", false]) } }; _pla switchMove ""; You can make this even better (and prettier) with a little effort yourself. Edit: Fixed a couple of typos.
  11. Leopard20

    Script response time

    Oh. Right. I think I missed the point! 😉
  12. Leopard20

    Script response time

    Sleep is not reliable when it comes to script computation time (e.g if the engine is busy the code won't be executed for some time). I recommend using something like: if (time - _lastRun >= 3) then { _lastRun = time; }; But again adding this to the above while loop makes no sense, so...dunno.
  13. Leopard20

    create an explosion effect?

    How about this one? playSound3D [ "A3\Sounds_F\arsenal\explosives\grenades\Explosion_HE_grenade_01.wss", player, true, ( player getPos [ 15, getDir player ] ) vectorAdd [ 0, 0, 5 ], 5, 1, 0 ]; _emitters = []; _source1 = createVehicle [ "#particlesource", ( player getPos [ 15, getDir player ] ) vectorAdd [ 0, 0, 5 ], [], 0, "CAN_COLLIDE" ]; _source1 setParticleClass "GrenadeExp"; _source1 setParticleParams [ [ "\A3\data_f\ParticleEffects\Universal\Universal", 16, 0, 32, 0 ], "", "Billboard", 0.3, 0.3, [ 0,0,0 ], [ 0,1,0 ], 0, 10, 7.9, 0.1, [ 0.0125 * 0.3 + 4, 0.0125 * 0.3 + 1 ], [ [1,1,1,-6],[1,1,1,0] ], [ 1 ], 0.2, 0.2, "", "", _this, 0, false, 0.6, [ [ 30,30,30,0 ],[ 0,0,0,0 ] ] ]; _source1 setParticleRandom [ 0, [ 0.4,0.1,0.4 ], [ 0.2,0.5,0.2 ], 90, 0.5, [ 0,0,0,0 ], 0, 0, 1, 0.0 ]; _source1 setParticleCircle [ 0, [ 0,0,0 ] ]; _source1 setParticleFire [1,15,0.1]; _emitters pushBack [ _source1, 0.3 ]; _source2 = createVehicle [ "#particlesource", ( player getPos [ 15, getDir player ] ) vectorAdd [ 0, 0, 5 ], [], 0, "CAN_COLLIDE" ]; _source2 setParticleClass "GrenadeSmoke1"; _source2 setParticleParams [ [ "\A3\data_f\ParticleEffects\Universal\Universal", 16, 9, 1, 0 ], "", "Billboard", 1, 8, [ 0,0,0 ], [ 0,1.5,0 ], 0, 0.0522, 0.04, 0.24, [ 0.013 * 8 + 3, 0.0125 * 8 + 6, 0.013 * 8 + 8, 0.013 * 8 + 10 ], [ [0.7,0.7,0.7,0.36],[0.8,0.8,0.8,0.24],[0.85,0.85,0.85,0.14],[0.9,0.9,0.9,0.08],[0.9,0.9,0.9,0.04],[1,1,1,0.01] ], [ 1000 ], 0.2, 0.2, "", "", _this, 0, false, 0.6, [ [ 30,30,30,0 ],[ 0,0,0,0 ] ] ]; _source2 setParticleRandom [ 2, [ 0.8,0.2,0.8 ], [ 2.5,3.5,2.5 ], 3, 0.4, [ 0,0,0,0 ], 0.5, 0.02, 1, 0.0 ]; _source2 setParticleCircle [ 0, [ 0,0,0 ] ]; _source2 setDropInterval ( 0.08 ); _emitters pushBack [ _source2, 5 ]; _light = createVehicle [ "#lightPoint", ( player getPos [ 15, getDir player ] ) vectorAdd [ 0, 0, 5 ], [], 0, "CAN_COLLIDE" ]; _light setLightAmbient [ 0,0,0 ]; _light setLightBrightness 10; _light setLightColor [ 1,0.6,0.4 ]; _light setLightIntensity 10000; _light setLightAttenuation [ 0, 0, 0, 2.2, 500, 1000 ]; _emitters pushBack [ _light, 0.3 ]; _time = diag_tickTime; while{ count _emitters > 0 } do { { _x params[ "_source", "_length" ]; if ( diag_tickTime > _time + _length ) then { deleteVehicle _source; _emitters set[ _forEachIndex, objNull ]; }; }forEach _emitters; _emitters = _emitters - [ objNull ]; }; I use something similar in my mission. You can tweak its variables to suit your need. Credit for this goes to Larrow
  14. Leopard20

    Knock Down Script HELP

    Dunno...maybe you're pointing at the player's weapon? Also test cursorObject, see if you have any luck.
  15. Leopard20

    Knock Down Script HELP

    Are you testing the command in multiplayer? I'm not sure about the cursorTarget command, but I think it should return the cursorTarget (as long as it is known to the player) regardless of locality. If you are testing this on yourself, obviously, you should change the first line to: _pla = player. Also, when you run this, the camera must be on the player. If for some reason it's not (e.g during a cutscene), you can save the original player to a variable (e.g myPlayer = player) before switching the camera, then use that variable instead.
×