Jump to content
juleshuxley

Don't punish player for friendly fire against AI team mates

Recommended Posts

Two things happen when you kill your own teammates: 1, your team opens fire on you and 2, in most single player missions, BIS_fnc_endMission is called

Do you think it would be possible to create an addon that patches out this behaviour? So you can literally do what you want to your own team mates with no repercussions, sort of like how you could shoot marines in Halo?



 

Share this post


Link to post
Share on other sites

Which mission(s) are you talking about? 

Share this post


Link to post
Share on other sites

I did a module for that.

Load MGI advanced modules and place on map the "kill punishment" module.

If you set it to 'licensed to kill" you can kill what you want. On the other hand, if you set a limit, the renegade time will be limited (few minutes).

 

Further more you can add a simple revive module for SP respawn, or the revive/heal one.

  • Like 1
  • Sad 1

Share this post


Link to post
Share on other sites

Another scripting solution (haven't looked at pierremgi's modules, and I am sure they will perform way better than the solution I present below) would be to use an event handler. Something in the lines of

// Add an event handler to the player to handle the rating
player addEventHandler["HandleRating", {
	// Get the passed parameters
	params["_unit", "_rating"];
	
	// Check if rating to be added is negative (killed some friend)
	if(_rating <= 0) exitWith {
        // Return the number to be added as rating to the user (effectively cancelling the default behaviour)
    	0;
    };
}];

The above code could be placed in the init.sqf of your mission. Additionally, if you want multiplayer compatibility you could place it in the initPlayerLocal.sqf.

 

I am not sure whether the event handler is persistent after respawn so what I would do would be something like

/*
 * Place in initPlayerLocal.sqf
 */
// Get the unit (inside initPlayerLocal.sqf)
params["_unit"];

// Create a function to call to add the event handler to handle rating
YOU_fnc_handleRate = {
	params["_unit"]; // Get the unit inside the function

	// Add an event handler to the player to handle the rating
	_unit addEventHandler["HandleRating", {

		// Get the passed parameters to the event handler
		params["_unit", "_rating"]; // Unit (inside the event handler) and rating
	
		// Check if rating to be added is negative (killed some friend)
		if(_rating <= 0) exitWith {
    	    // Return the number to be added as rating to the user (effectively cancelling the default behaviour)
    		0;
	    }; // End of if
	}]; // End of event handler
}; // End of function

// Add the event handler for the rating to the unit
[_unit] call YOU_fnc_handleRate;

// Add event handler to add the rating event handler when unit respawns
_unit addEventHandler["Respawn", {
	// Get the unit inside this event handler
	params["_unit"];

	// Add the event handler for rating
	[_unit] call YOU_fnc_handleRate;
]};

I know this may be a bit ugly, but it's a "quick-and-dirty" solution in case you would like to refrain from using addons.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×