Jump to content
Sign in to follow this  
fathersarge

Autopardon Friendly Fire Incidents

Recommended Posts

The problem:

You and your buddies are under fire from the advancing enemy. You don't have time to repair your truck which is missing 2 wheels and isn't drivable. You blow it up to prevent the enemy from fixing it and using it against you.

Well crap, now the game has labeled you as some kind of traitor and now no one can get in another vehicle that you are inside.

 

This feature or bug (honestly not sure which it is) has always confused me in this game. In ACE3 there is an option to pardon someone of such offenses.

 

My question is... is there a way to either automatically pardon people via a script that runs every time something like this happens or is there a way to disable it from happening altogether? Really could use some help on this one.

  • Like 1

Share this post


Link to post
Share on other sites

Known problem as a bad choice for empty vehicle.

Simplest way:

player addRating 1000000;

 

  • Like 1

Share this post


Link to post
Share on other sites

// Rating handling: Stops the player being shot by friendly AI.
player addEventHandler [
    "HandleRating",
    {
        params["_player"];
        if (rating _player < 0) then {
            player addRating abs rating _player;
        };
    }
];

 

That's a quick and easy event handler that will always bounce the players rating back to 0 if they're below 0.

  • Like 1

Share this post


Link to post
Share on other sites

Or just make no rating change for empty vehicle only:

in init.sqf, you need to add a server condition if (isServer) then { code }; or simpler in initServer.sqf:
 

addMissionEventHandler ["entityKilled",{
  params ["_killed", "_killer", "_instigator","_rating"];
  if (isNull _instigator) then {_instigator = UAVControl vehicle _killer select 0};
  if (isNull _instigator) then {_instigator = _killer};
  if (isPlayer _instigator && count (crew _killed) ==0) then {
    _rating = rating _instigator;
    [_instigator,_rating] spawn {
      params ["_instigator","_rating"];
      waitUntil {rating _instigator != _rating};
      _instigator addRating (_rating - rating _instigator)
    }
  }
}];

 

  • Like 3

Share this post


Link to post
Share on other sites

So where would this go? initPlayerLocal?

8 hours ago, crazy538 said:

// Rating handling: Stops the player being shot by friendly AI.
player addEventHandler [
    "HandleRating",
    {
        params["_player"];
        if (rating _player < 0) then {
            player addRating abs rating _player;
        };
    }
];

 

That's a quick and easy event handler that will always bounce the players rating back to 0 if they're below 0.

 

Where would that go?

55 minutes ago, pierremgi said:

Or just make no rating change for empty vehicle only:


 


addMissionEventHandler ["entityKilled",{
  params ["_killed", "_killer", "_instigator","_rating"];
  if (isNull _instigator) then {_instigator = UAVControl vehicle _killer select 0};
  if (isNull _instigator) then {_instigator = _killer};
  if (isPlayer _instigator && count (crew _killed) ==0) then {
    _rating = rating _instigator;
    [_instigator,_rating] spawn {
      params ["_instigator","_rating"];
      waitUntil {rating _instigator != _rating};
      _instigator addRating (_rating - rating _instigator)
    }
  }
}];

 

 

Share this post


Link to post
Share on other sites
2 minutes ago, fathersarge said:
So where would this go? initPlayerLocal?
 


The first in initPlayerLocal, the other one in initServer I think...

 

Realised mine might not catch all conditions so I've made it a bit more intelligent. It's still really light weight being an EH.

 

// Rating handling: Stops the player being shot by friendly AI.
_player addEventHandler [
    "HandleRating",
    {
        params["_player", "_rating"];
        _return = _rating;
        if(rating _player < 0) then {
            _return = abs rating _player;
        } else {
            if(_rating + rating _player < 0) then {
                _return = 0;
            };
        };
        _return
    }
];

This one adds the difference between 0 and rating if the rating is below 0 already. If it's not, it checks to see if the current rating plus the new rating to add will be below zero. If it is then it won't change the rating. If neither of those two occurs the rating is added as normal.

Sent from my LG-H870 using Tapatalk
 

Edited by crazy538
Added new code
  • Like 1

Share this post


Link to post
Share on other sites

Awesome. I'll def be testing these this week!

 

@crazy538 Actually after looking at that, should it be _player addEventHandler or player addEventHandler?

 

I also found this

player addEventHandler ["HandleRating", {0}];

Would that work any different?

Share this post


Link to post
Share on other sites

Sorry yes, player not _player. I copied it from a framework of mine and for some reason I chose to use _player (it's passed as an argument to the initPlayerLocal.sqf).

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
Sign in to follow this  

×