Jump to content

krabban333

Member
  • Content Count

    3
  • Joined

  • Last visited

  • Medals

Posts posted by krabban333


  1. Heyo,

    Long time scripter, first time modder here.
    Check out my attempt at improving the morale system of ARMA 3, hopefully making the AI feel a little less like terminator robots. Mind the jank.

     

    Features

    • New AI behaviours: fleeing, surrendering, cowering and fighting retreat
    • Surrendered units may turn hostile if not monitored or handcuffed
    • Cowering and surrendered units will flee if shot at
    • Adds cable ties to each unit. No extra scripting needed
    • Morale check is dependent on squad skill. Higher skilled squads are less likely to have negative outcomes on morale checks
    • Players can rally surrendered, cowering or fleeing allies, having them join their squad
    • Automatic cleanup of fleeing and surrendered units when no players are nearby and within line of sight
    • Should work in both singleplayer and multiplayer
       

    Requirements

    CBA_A3
    ACE3
    LAMBS Danger (Might work without this one, but may result in weird behaviours)

     

    Steam workshop link

    Extended Morale System

     

     

    Github

    • Like 3

  2. Thanks, was an interesting read!

    Long story short;

    I'm working on a surrender scriptmod where if a surrendered unit is fired upon they will start fleeing.

    I managed to solve my issue by using the EH HitPart for the projectile. The finished code looks like this:
     

    // Check if a player fires at a surrendered or cowering unit
    fnc_addPlayerFiredHandler = {
    
    	{
    		_player = _x;
    
    		if (isNil {_player getVariable "logicAdded"}) then {
    
    			// On player fire event
    			_player addEventHandler ["Fired", {
    				params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    
    				// Throttle fire event
    				if (!(_unit getVariable ["onCooldown", false])) then {
    
    					[_unit, 0.6] call fnc_addGeneralCooldown;
    
    					// On projectile hit event
    					_projectile addEventHandler ["HitPart", {
    						params ["_projectile", "_target", "_shooter", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];
    
    						[_shooter, _position] spawn fnc_handleBulletImpact;
    
    					}];
    
    				};
    
    			}];
    
    			_player setVariable ["logicAdded", true];
    
    		};
    
    	} forEach PLAYERS;
    
    };

     


  3. Hi,
    I'm trying to add an event handler for projectiles fired by the player, but I'm getting the error Error Foreign error: Unknown enum value: "EpeContact"

    Any ideas on why this happens? Dumping the _projectile variable returns an object, so I'm kinda lost.

    Thanks in advance!

    Here's my code:

    _player addEventHandler ["Fired", {
      params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    
      _projectile addEventHandler ["EpeContact", {
          params ["_object1", "_object2", "_selection1", "_selection2", "_force", "_reactVect", "_worldPos"];
      }];	
    
    }];
×