Jump to content
Sign in to follow this  
katipo66

COD style injury system for SP

Recommended Posts

Is it possible (in a mess with script way) to turn off gimping, or the script that renders you to only crawling when injured.

Im just a lowly SP who likes setting up my own scenarios in the editor, whats annoying is when im injured (no legs) then thats it, game over more or less as medics are hopeless, because they are not in your group... which in itself seems a bit silly, shouldn't medics heal anyone from the same faction?

Is there also somewhere in some script where you could enable the ability to heal over time, like in COD... im not after god mode, just something workable to give longer gameplay.

It just feels dumb you still have the ability fight although your legs are gone, and no option for recovery and it looks really stupid seeing injured AI in a group crawling beside their walking comrades when moving... or even worse a group of 2 or 3 injured AI all crawling to their next waypoint.

Or does someone know of another way to overcome this.

Edited by Katipo66

Share this post


Link to post
Share on other sites

Everything is possible to script, but a more realistic approach (if thats what ur after) might be to make a medevac script. And generally let a script run for all friendly groups to recognize & heal you if a medic is still active.

Share this post


Link to post
Share on other sites
)rStrangelove;1681801']Everything is possible to script' date=' but a more realistic approach (if thats what ur after) might be to make a medevac script. And generally let a script run for all friendly groups to recognize & heal you if a medic is still active.[/quote']

Yes im all for more realism alongside game play and enjoyment, but unfortunately gimping injured units doesn't give any of these, is there an example of this type of script that i might be able to find and look at? thanks

Share this post


Link to post
Share on other sites
Is it possible (in a mess with script way) to turn off gimping, or the script that renders you to only crawling when injured.

No, hard-coded.

But you can possibly work around it by changing your damage level/location.

Share this post


Link to post
Share on other sites

Here's a prototype i just made. It heals you slowly dpending on how bad you're injured. As i said, it's just a quick prototype so you might want to add some fancy color effects or adjust it a bit more.

heal.sqf

_unit = _this select 0;
_delay = _this select 1;

while (alive _unit) do {
waituntil {damage _unit >= 0.1};
switch (damage _unit) do {
	case 0.1 : {sleep _delay; _unit setDamage 0;};
	case 0.2 : {sleep _delay; _unit setDamage 0.1;};
	case 0.3 : {sleep _delay; _unit setDamage 0.2;};
	case 0.4 : {sleep _delay; _unit setDamage 0.3;};
	case 0.5 : {sleep _delay; _unit setDamage 0.4;};
	case 0.6 : {sleep _delay; _unit setDamage 0.5;};
	case 0.7 : {sleep _delay; _unit setDamage 0.6;};
	case 0.8 : {sleep _delay; _unit setDamage 0.7;};
	case 0.9 : {sleep _delay; _unit setDamage 0.8;};
};
};

Execute via:

nul = [soldier1,1] execVM "heal.sqf";

"soldier1" is the unit you want to use the script on and "1" is the (adjustable) delay between the heals. :)

Share this post


Link to post
Share on other sites
Here's a prototype i just made. It heals you slowly dpending on how bad you're injured.

Awesome!! this is exactly what i was wanting, have to play around with it tommorow... thanks :D

Edited by Katipo66

Share this post


Link to post
Share on other sites

@IndeedPete

I tested it by gimping my self, (bouncing grenades of a wall) i waited for about 10 minutes but the unit doesn't seem to heal, I removed the spaces in the script, does the adjustable delay work like this 0.1 - 1?

Share this post


Link to post
Share on other sites

Why not just use _unit setHit ["legs",0] in a loop? It constantly keeps legs at 100 %.

Like this:

Unit init line:

[this] exec "legheal.sqs"

legheal.sqs

_unit=_this select 0

#start
@alive _unit

#loop
?!alive _unit:goto "start"
_unit setHit ["legs",0]
~0.1
goto "loop"

Edited by Celery

Share this post


Link to post
Share on other sites

Cheers guys, ill try the option to keep legs at 100%, how would i keep it in a loop?

@Mosh ive used the Medevac Module, but found with the scenarios ive setup the heli mostly gets taken out... just had a thought, maybe if i set them to captive? it would be a more realistic and satisfying option, something else to play around with... actually i just looked at the link, looks like its been updated to cover those eventualities... nice

I think i liked indeedpetes script, the idea of being taken out off action and hiding until recovered seems fair and has a realistic element to it.

Edited by Katipo66

Share this post


Link to post
Share on other sites

Alright, i see my mistake. The damage of a unit is returned with 5 decimal places, so the "switch-do" wasn't triggered at all. Plus i made a mistake in the "while-do" condition. I shouldn't write scripts without testing them... :rolleyes:

Anyway, here's a fixed and tested version. Works fine so far:

heal.sqf

_unit = _this select 0;
_delay = _this select 1;

while {alive _unit} do {
waituntil {damage _unit >= 0.1};
_x = (damage _unit) * 10;
_x = round _x;
hint format ["x: %1",_x];
switch (_x) do {
	case 1 : {sleep _delay; _unit setDamage 0;};
	case 2 : {sleep _delay; _unit setDamage 0.1;};
	case 3 : {sleep _delay; _unit setDamage 0.2;};
	case 4 : {sleep _delay; _unit setDamage 0.3;};
	case 5 : {sleep _delay; _unit setDamage 0.4;};
	case 6 : {sleep _delay; _unit setDamage 0.5;};
	case 7 : {sleep _delay; _unit setDamage 0.6;};
	case 8 : {sleep _delay; _unit setDamage 0.7;};
	case 9 : {sleep _delay; _unit setDamage 0.8;};
};
};

Still execute it via:

nul = [(soldier),(time between heals in seconds)] execVM "heal.sqf";

EDIT: Oh well, the hint is for testing only, you can delete the line if you wish.

Share this post


Link to post
Share on other sites

Hi Indeedpete, sorry im probably not doing this right, ive created a heal.sqf file and placed it in mission folder, in that file i have your script

_unit =_this select 0;
_delay =_this select 1;

while {alive_unit} do {
waituntil {damage_unit >= 0.1};
_x = (damage_unit) * 10;
_x = round_x;
hint format ["x: %1",_x];
switch (_x) do {
	case 1 : {sleep_delay;_unit setDamage 0;};
	case 2 : {sleep_delay;_unit setDamage 0.1;};
	case 3 : {sleep_delay;_unit setDamage 0.2;};
	case 4 : {sleep_delay;_unit setDamage 0.3;};
	case 5 : {sleep_delay;_unit setDamage 0.4;};
	case 6 : {sleep_delay;_unit setDamage 0.5;};
	case 7 : {sleep_delay;_unit setDamage 0.6;};
	case 8 : {sleep_delay;_unit setDamage 0.7;};
	case 9 : {sleep_delay;_unit setDamage 0.8;};
};
};

And i have placed a unit and named him "s1" and in the unit's init i have placed-

nul = [s1,1] execVM "heal.sqf";

and a few variations with brackets/quotes around name etc, i cant seem to get it to work:p

@celery, thanks that works great

Edited by Katipo66

Share this post


Link to post
Share on other sites
Hm strange, what happens exactly?

Well nothing, except ive become good at gimping myself by bouncing nades of walls.

Thanks for that mission, i narrowed it down to something wrong with my heal.sqf... anyway its working now when replaced with yours, thanks again, this is great :D

Share this post


Link to post
Share on other sites
Alright, i see my mistake. The damage of a unit is returned with 5 decimal places, so the "switch-do" wasn't triggered at all. Plus i made a mistake in the "while-do" condition. I shouldn't write scripts without testing them... :rolleyes:

Anyway, here's a fixed and tested version. Works fine so far:

heal.sqf

_unit = _this select 0;
_delay = _this select 1;

while {alive _unit} do {
waituntil {damage _unit >= 0.1};
_x = (damage _unit) * 10;
_x = round _x;
hint format ["x: %1",_x];
switch (_x) do {
	case 1 : {sleep _delay; _unit setDamage 0;};
	case 2 : {sleep _delay; _unit setDamage 0.1;};
	case 3 : {sleep _delay; _unit setDamage 0.2;};
	case 4 : {sleep _delay; _unit setDamage 0.3;};
	case 5 : {sleep _delay; _unit setDamage 0.4;};
	case 6 : {sleep _delay; _unit setDamage 0.5;};
	case 7 : {sleep _delay; _unit setDamage 0.6;};
	case 8 : {sleep _delay; _unit setDamage 0.7;};
	case 9 : {sleep _delay; _unit setDamage 0.8;};
};
};

Still execute it via:

nul = [(soldier),(time between heals in seconds)] execVM "heal.sqf";

EDIT: Oh well, the hint is for testing only, you can delete the line if you wish.

Great Script IndeedPete !

Only one problem, if a unit is wounded and later healed by your script it will still have that red icon for a wounded soldiers.

Any way to get the normal green one back if the soldiers is completly healed ?

I think its because the AI reports that it is wounded...so there should be a way to tell them that they are fine agein...

Edited by Wiggum

Share this post


Link to post
Share on other sites

Ok, i see the problem. So far i've two workarounds:

1) Let him report his status after the heal (select unit > 5 > 5). Now, the red icon is replaced by the normal one.

2) That means i have to "force" the unit to report it's status. Since i haven't found a command for that (i'm sure there is one but i just don't know it) i kick him out of his group and let him join again, so he reports his status:

heal.sqf:

_unit = _this select 0;
_delay = _this select 1;
_group = group _unit;

while {alive _unit} do {
waituntil {damage _unit >= 0.1};
_x = (damage _unit) * 10;
_x = round _x;
switch (_x) do {
	case 1 : {sleep _delay; _unit setDamage 0; [_unit] join grpNull; [_unit] join _group;};
	case 2 : {sleep _delay; _unit setDamage 0.1;};
	case 3 : {sleep _delay; _unit setDamage 0.2;};
	case 4 : {sleep _delay; _unit setDamage 0.3;};
	case 5 : {sleep _delay; _unit setDamage 0.4;};
	case 6 : {sleep _delay; _unit setDamage 0.5;};
	case 7 : {sleep _delay; _unit setDamage 0.6;};
	case 8 : {sleep _delay; _unit setDamage 0.7;};
	case 9 : {sleep _delay; _unit setDamage 0.8;};
};
};

I'm sure there's an easier way, but i haven't found it yet.

Share this post


Link to post
Share on other sites

Cool, maybe we can found a better solution !

Share this post


Link to post
Share on other sites

Im searched for such a command in the ArmA2 Script commands database but have not found anything.

@ IndeedPete

Have you found a command that lets the Ai report it's status ?

Share this post


Link to post
Share on other sites

Nope, only if you tell them to or if they join a group...

Share this post


Link to post
Share on other sites

Sorry to drag up an old thread, but I found a solution to the problem.

AISFinishHeal [name_of_your_wounded_unit,name_of_your_medic,true];

Changes the icon status back to grey (unwounded).

Share this post


Link to post
Share on other sites

Well, If anybody is still interested, I have pretty much the ultimate COD style heal script.

#loop

~1

if (damage player < 0.1) then {goto "loop"}

#restart

~15

player setdamage (damage player -0.1)

if (damage player < 0.01) then {goto "loop"}

_newdamage = damage player

~8

if (_newdamage < damage player) then {goto "restart"}

player setdamage (damage player -0.1)

if (damage player < 0.01) then {goto "loop"}

_newdamage = damage player

~5

if (_newdamage < damage player) then {goto "restart"}

player setdamage (damage player -0.1)

if (damage player < 0.01) then {goto "loop"}

_newdamage = damage player

~3

if (_newdamage < damage player) then {goto "restart"}

player setdamage (damage player -0.1)

if (damage player < 0.01) then {goto "loop"}

_newdamage = damage player

~2

if (_newdamage < damage player) then {goto "restart"}

player setdamage (damage player -0.1)

if (damage player < 0.01) then {goto "loop"}

_newdamage = damage player

~1.8

if (_newdamage < damage player) then {goto "restart"}

player setdamage (damage player -0.1)

if (damage player < 0.01) then {goto "loop"}

_newdamage = damage player

~1.6

if (_newdamage < damage player) then {goto "restart"}

player setdamage (damage player -0.1)

if (damage player < 0.01) then {goto "loop"}

_newdamage = damage player

~1.4

if (_newdamage < damage player) then {goto "restart"}

player setdamage (damage player -0.1)

if (damage player < 0.01) then {goto "loop"}

_newdamage = damage player

~1.2

if (_newdamage < damage player) then {goto "restart"}

player setdamage (damage player -0.1)

if (damage player < 0.01) then {goto "loop"}

_newdamage = damage player

~1

if (_newdamage < damage player) then {goto "restart"}

player setdamage (damage player -0.1)

if (damage player < 0.01) then {goto "loop"}

_newdamage = damage player

replace the ~x values with your desired values for the speed of healing. As you can see, it is more like the cod system because the healing accelerates, and also, if you are hit while healing, the healing process will not continue unabated.

Share this post


Link to post
Share on other sites

yes, needs to be called as .sqs, with [] exec "heal.sqs" in the mission init.

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  

×