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

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
3 hours ago, preserver833 said:

Also, too much commenting commands will make the .pbo file huge, which will have impact on net traffic of server when new player connecting, and will lag the connection of other players.

 

The purpose of this forum is to impart knowledge to other people. Therefore its very good to post well commented code here.

Everyone can decide himself to delete comments but most people are not running a 100+ player server with huge mission files. Most people asking for help here are starting to edit something for small player groups and with small mission files. In those scenarios its completly irrelevant if you use commented code or not.

 

Also the problem which you describe is especially common on servers with large mission files. Those mission file are mostly large because of using huge textures and sounds but not of some comment lines in their scripts. In terms of size, scripts are mostly a tiny part of those missions .

 

 

EDIT:

3 hours ago, preserver833 said:

The solution from @ZaellixA seems does not provide anything.

You yourself have not delivered more than replacing the number 0 with 1000...

 

  • Like 3

Share this post


Link to post
Share on other sites

Nevermind. The last comment was just mirroring your behavior of bashing someone who tries to help.

 

Therefore I hereby withdraw my last comment.

  • Confused 1

Share this post


Link to post
Share on other sites

Bashing all the time. Thats such a boring thing.

There is no need to get personal or to put someone in a labeled box just because he mirrored your bad behavior!

  • Haha 1

Share this post


Link to post
Share on other sites

I already wrote what your bad behavior was. No need to repeat it.

Not the first thread where you post in a manner I dislike.

I promise I will not waste any more time in any way by talking to you...

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, preserver833 said:

Also, do not talk to anyone without checking first for yourself! This will reduce wasting your time and the time of others. Also, will increase the quality of your suggestions, and increase the reputation of Bohemia which last time is decreased tooooo much.


The guy with 2 as reputation on forum (see avatar) should be more humble speaking about reputation of Bohemia with guys who really help the community.

  • Like 1

Share this post


Link to post
Share on other sites
3 minutes ago, preserver833 said:

Yes, it is your necessity to help the community because Tencent pay you for that

Neither employee nor a patreon nor any kind of retribution, except likes and congrats. Enough is enough.

  • 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

×