Jump to content

misterpete

Member
  • Content Count

    4
  • Joined

  • Last visited

  • Medals

Community Reputation

14 Good

About misterpete

  • Rank
    Rookie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. misterpete

    Reducing player damage

    There is some outdated information here (some bis name changes) and a bug (namely that _damageRecieved is inaccurate if _selection is ""). There is some helpful updated info here: Here's an updated version of the reduce damage script: params[ "_unit" ]; // Damage reduction from https://forums.bistudio.com/forums/topic/198136-reducing-player-damage/ // Exit if we are a player and not local // Otherwise add EH for AI every where just in case their locality // changes due to moving into a players group // the EH will only fire where the AI is local if ( isPlayer _unit && { !local _unit } ) exitWith {}; if ( isPlayer _unit ) then { _unit removeAllEventHandlers 'HandleDamage'; }; // Only damage from last applied handleDamage EH is taken into consideration by the engine // Apply a new EH so as we can override the damage applied _unit addEventHandler [ "HandleDamage", { params ["_unit", "_hitSelection", "_damage","_source","_projectile","_hitPartIndex", "_instigator", "_hitPoint"]; // Damage multipliers. The damage of each projectile will be multiplied by this number. private _damageMultiplierHead = 0.3; private _damageMultiplierBody = 0.25; private _damageMultiplierLimbs = 0.15; private _damageMultiplierOverall = 0.25; // Damage limits. Each projectile will be limited to a max of this much damage. private _limitHead = 1.0; private _limitBody = 0.25; private _limitLimbs = 0.1; private _limitOverall = 0.25; private _oldDamage = 0; if (_hitSelection isEqualTo "") then {_oldDamage = damage _unit} else {_oldDamage = _unit getHit _hitSelection}; private _newDamage = _damage - _oldDamage max 0; private _incomingDamage = _newDamage; private _playerHealth = damage _unit; // Infantry selections // Keep in mind that if revive is enabled then incapacitation may occur at around 0.7 damage. // "": The overall damage that determines the damage value of the unit. Unit dies at damage equal to or above 1 // "face_hub": Unit dies at damage equal to or above 1 // "neck": Unit dies at damage equal to or above 1 // "head": Unit dies at damage equal to or above 1 // "pelvis": Unit dies at damage equal to or above 1 // "spine1": Unit dies at damage equal to or above 1 // "spine2": Unit dies at damage equal to or above 1 // "spine3": Unit dies at damage equal to or above 1 // "body": Unit dies at damage equal to or above 1 // "arms": Unit doesn't die with damage to this part // "hands": Unit doesn't die with damage to this part // "legs": Unit doesn't die with damage to this part // Do any other damage calculations here // _damage is the previous damage plus any new damage and will be applied // as the total damage the unit has for this selection once this EH returns // Only modify damage if it is a known projectile (leave falling damage etc alone) if (_newDamage > 0 && !(_projectile isEqualTo "")) then { // Reduce damage by damage multiplier private _damageMultiplier = _damageMultiplierBody; private _upperLimit = _limitBody; switch (_hitSelection) do { case "face_hub"; case "head": { _damageMultiplier = _damageMultiplierHead; _upperLimit = _limitHead; }; case "arms"; case "hands"; case "legs": { _damageMultiplier = _damageMultiplierLimbs; _upperLimit = _limitLimbs; }; case "": { _damageMultiplier = _damageMultiplierOverall; _upperLimit = _limitOverall; }; default { _damageMultiplier = _damageMultiplierBody; _upperLimit = _limitBody; }; }; _newDamage = _newDamage * _damageMultiplier; // Place an upper limit on projectile damage done at once if (_newDamage > _upperLimit) then { _newDamage = _upperLimit; }; _damage = _oldDamage + _newDamage; }; // For players ignore damage if they are incapacitated and pass damage to bis revive handler if ( isPlayer _unit ) then { if ( lifeState _unit == "INCAPACITATED" ) then { //if we are incapacitated take no additional damage _damage = _oldDamage; } else { _this set[ 2, _damage ]; //Call BI REVIVE HandleDamage EH passing new _damage value _damage = _this call bis_fnc_reviveEhHandleDamage; }; }; systemChat format[ "pHealth: %1 selection: %2 oldTotal: %3 newTotal: %4 incomingDmg: %6 appliedDmg: %6", _playerHealth, _hitSelection, _oldDamage, _damage, _incomingDamage, _newDamage]; _damage }]; systemChat format[ "Damage reduction applied to %1", _unit ]; Place this at the end of your mission initPlayerLocal.sqf and just change the multipliers you would like for the damage and remove the systemChat lines which are there for debugging. You can also remove the if statement with "INCAPACITATED" if you want players to be able to be killed while incapacitated. EDIT: Added in location based multipliers and upper limits of damage per projectile and a check for _projectile not "" to avoid modifying falling damage etc. You can set limits to 1 if you don't want an upper limit or fractions to ensure a number of shots to kill/incapacitate, keep in mind that players die at 1.0 damage but may be incapacitated at around 0.7 depending on the revive system.
  2. There's a bug in the damage reduction code above. Namely that "private _damageRecieved = (_damage - _selectionDamage) max 0;" is not accurate when _selection is "". Here's some useful updated info on HandleDamage: Here's an updated version of the reduce damage script: params[ "_unit" ]; // Damage reduction from https://forums.bistudio.com/forums/topic/198136-reducing-player-damage/ // Exit if we are a player and not local // Otherwise add EH for AI every where just in case their locality // changes due to moving into a players group // the EH will only fire where the AI is local if ( isPlayer _unit && { !local _unit } ) exitWith {}; if ( isPlayer _unit ) then { _unit removeAllEventHandlers 'HandleDamage'; }; // Only damage from last applied handleDamage EH is taken into consideration by the engine // Apply a new EH so as we can override the damage applied _unit addEventHandler [ "HandleDamage", { params ["_unit", "_hitSelection", "_damage","_source","_projectile","_hitPartIndex", "_instigator", "_hitPoint"]; private _incomingDamage = _damage; private _oldDamage = 0; if (_hitSelection isEqualTo "") then {_oldDamage = damage _unit} else {_oldDamage = _unit getHit _hitSelection}; private _newDamage = _damage - _oldDamage max 0; private _playerHealth = damage _unit; // Do any other damage calculations here // _damage is the previous damage plus any new damage and will be applied // as the total damage the unit has for this selection once this EH returns if (_newDamage > 0) then { // Reduce the new damage to 1/4 the amount _damage = _oldDamage + (_newDamage * 0.25); }; // For players ignore damage if they are incapacitated and pass damage to bis revive handler if ( isPlayer _unit ) then { if ( lifeState _unit == "INCAPACITATED" ) then { //if we are incapacitated take no damage _damage = 0; } else { _this set[ 2, _damage ]; //Call BI REVIVE HandleDamage EH passing new _damage value _damage = _this call bis_fnc_reviveEhHandleDamage; }; }; systemChat format[ "pHealth: %1 selection: %2 prevDmg: %3 incomingDmg: %4 appliedDmg: %5", _playerHealth, _hitSelection, _oldDamage, _incomingDamage, _damage]; _damage }]; systemChat format[ "Damage reduction applied to %1", _unit ]; // End damage reduction Place this at the end of your mission initPlayerLocal.sqf and just change 0.25 to be whatever multiplier you would like for the damage and remove the systemChat lines which are there for debugging. You can also remove the if statement with "INCAPACITATED" if you want players to be able to be killed while incapacitated.
  3. Just updated (using playwithsix) to version 2015.4.10 and it did not seem to work. No errors but the active components did not pop up. Confirmed and at least the HUD did not work with tactical glasses. It seemed none of the other active components were working either. Tested several times and with all other mods other than cba deactivated. I finally reverted to 2015.4.8 and that is working fine.
  4. Hi Shay, I love the mod, great work. I've just recently updated mcc to v0.4.12.1 and found a couple of issues. I'm testing only with mcc (and cba). 1) Respawn with saved gear often results in no primary weapon. This was pointed out by someone else in this thread, just wanted to confirm I have the same issue. 2) When creating a mission with the 'secure hvt' objective I am only able to get them to join the squad by first restraining them and then ordering them around (options available by holding the windows key). It's a rescue mission so it seems that you should be able to get them to join immediately, pretty sure it used to work this way. 3) How can we get bandages and other items for the medic system? I didn't see a way to spawn them through zeus or mcc (at least without using the addItem command). Thanks and looking forward to new updates. I'm liking the vault over obstacle and cover system and as always it's great to be able to quickly make a mission. -MisterPete
×