Hey all!
Edit: Version 1.1 is out now, should be ready for review/upload. Check it out if you can find any bugs
I -might- yet in the future create a version which adds the possibility for proper anims upon death (currently a rather ugly switchmove) using Mando Unit Position to see if they're crouching or standing etc, and maybe incorporate some kind of POW-taking ability on enemies/yourself. But those can be done by mission makers as well, and might require external scripts.
This isn't really much : just a tiny self-sufficient script that simulates a -very- crude "body armor" which might increase the survivablity of at least your own soldiers. It is not suggested to use these on enemies - it's no fun scoring a straight headshot and getting nothing for your pain.
Also, 1.09beta is recommended, since I'm using a whole bunch of globals and the like, hopefully making things a bit faster.
Script call: [UnitName, Mode, Init] execVM "RUG_BodyArmor.sqf" (can also be used with for instance foreach to give body armor to each member of your squad).
Unitname : name of the unit, quite simply. Can be this if called from init.
Mode : Currently supports four modes : 0, 1, 2 and 3. In 0, once the unit's body armor has been depleted and the unit has been knocked down, it will never return and the unit will be as defenceless as a standard ArmA dude. In 1, the body armor is fully regenerated between knock downs, which means there are only really two good ways to kill these people: high caliber weapons, or shoot 'em when they're down. 2 is the "Medevac" mode; the unit will regain full body armor once it has been fully healed, for instance by a medic or a medic tent. 3 is essential invulnerability: the unit is knocked unconscious, but can be revived, and is invulnerable during all these stages.
Init: this number should be less than 0, which tells the script it's initializing. The number also determines the total amount of body armor the unit should have in a relative way: the total body armor is directly derived from their config "armor" entry (for normal soldiers it's 3); this is then multiplied with the positive equivalent of the Init value. Make it -1 to give the units 3 body armor, -2 to give them 6, 0.5 to give them 1.5 and so on.
How the "body armor" works: It uses the little-known fact that you can set negative values to a unit's Damage using setDamage: however these negative values aren't persistent, and disappear with the first "hit". By having a "hit" eventhandler however which constantly resets the negative value, you can have invulnerable units. This has been used in various missions before, such as in Surdus Priest's. What my script does is stores the amount of damage done in each hit (which the "hit" eventhandler picks up), and once it surpasses the total body armor value, the unit is knocked "unconscious".
Being unconscious: Once the total body armor has been surpassed, you're unconscious (well, the units are switchmoved into a prone position and setCaptived, nothing else). This either lasts a random period (presently set to about 2 minutes), until a medic gets to you (your damage levels decrease) or someone uses the "first aid" action that's added to you. After that, depending on your "mode", your body armor is entirely regenerated, or you're left without it. Note that although units that are unconscious can call an AI medic to help them, it doesn't always work (depends on at what angle the medic approaches if the knocked down AI can use the medic action or not).
As of v.1.0, a knocked-out player or AI will automatically "call for help" within a 50 meter radius, prompting any friendly AI unit nearby to move to the knocked out unit's location and perform first aid. Note that the AI will smartly first check if any known enemies are closer than 100 meters: if that is the case, the fighting is still too intense to perform healing actions. Note that as team leader, you can still order the AI to heal someone (for instance you) via the action menu, regardless of the proximity of enemies.
Caveats: Since this uses a simple "hit" eventhandler with setdamage, the body armor does not take into account WHERE you are hit; headshots, legshots, they're all the same. Also, certain large caliber weapons such as the .50 cal, rockets, etc. will still kill you immediately (unless using mode 3). And finally, I have no idea if this works on a larger scale or not, or how it takes to streaming and such.
This is more or less finished now, although I sort of wrote it pretty quickly over the weekend, so it's no master piece of coding. But it's kind of nifty, I think. Attached example mission (sorry about the size) and script. Note both the mission and the script still has a bunch of hints and such in it to track the progress of stuff. Enjoy!
Version history:
0.1 BETA
-Initial release
1.0 RC
- Added ability for AI to independently administer first aid
- Added modes 2 and 3.
- Minor changes to demo mission (can choose mode at start, random weather/time just for fun, player = team leader...)
1.1 RC
- Fixed some minor bug with the helpers
- Other slight fixes and tweaks
- Minimized size of demo mission
- Added an explanation to the script itself on how to call it
Wolfrug out.
RUG_Bodyarmor v1.1