OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Dajan on 09 Sep 2010, 17:35:31
-
Hey all, standard disclaimer: I've searched & can't find anything etc, if other info exists please redirect and obliterate.
Occasionally I like to start missions with (slightly morbidly) the player surrounded by dead comrades - say as the sole survivor of a crash. Prob is since leaving OFP all those years ago I can't get the recently deceased to start of lying down in a state of rigor mortis. Instead my poor soldier is witness to all those around him suddenly taking 100 points of damage and dropping like stones.
So...
How do I start the dead AI units lying down, very dead, covered in blood?
TIA
-
You've tried using the "Health" slider in the mission editor and "setDamage=1" (or whatever) via script, correct?
Have you considered using a fade-in at the start of the mission to allow time for the AI units to die and keel over?
-
That's what I'm resorting to at the moment. It just seems odd that I can't set them up to begin in a prone position or somesuch.
unitname setunitpos "down"
doesn't seem to work, and I can't work out if there's an animation that i could use.
-
Use something like this in a SQF script:
_dead_unit = _this select 0;
_dead_unit setUnitPos "DOWN";
sleep 0.5;
_dead_unit disableAI "ANIM";
_dead_unit switchMove "AdthPpneMstpSrasWrflDnon_1";
sleep 0.5;
_dead_unit setDamage 1;
And execute by putting the following in the unit's init line:
null = [this] execVM "<script name>.sqf"
That will make him play the prone death animation and kill him half a second afterward. Hope that helps. :)
-
Thanks zipper, will give that a go! :good:
-
I think using that script will produce dead units with the same animation.
That is, if a unit is dying with its face on the dirt, all other units will be the same too.
I think you should add a fading (black in) at the start and put the sound volume to 0 (to avoid hearing the dropping body sounds).
init.sqf
put the following at the VERY START of init.sqf
titleCut ["","BLACK IN",10];
//10 seconds to fade in
0 fadeSound 0;
sleep 5;
0 fadeSound 1;
there might be a better way for example, selecting random dying anims out of an anim array..
but at the moment, I could only give you the above solution...
Regards,
Haroon1992
-
I think I'm going to have to do a little of both:-
The script suggested by Zipper works -sort of. The scripted unit will assume the necessary position (nothing kinky involved here) without falling, however there is a brief period (maybe half a second) in which they arre still upright. I think I'm just going to have to add a fade to cover that few milliseconds :confused:
{EDIT}
Just an update if anyone is interested - by starting the units in stealth behaviour in the script the visual impact of entering dead state is lessened.
-
Yes, there is a 0.5 second delay as you can see in the script. Some switchMoves you cannot execute right as the mission starts, as the unit won't recognize it, but adding a short delay between the start of the mission and the switchMove will make the unit always perform the animation.