OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Blanco on 15 Sep 2002, 05:33:08

Title: Medic script
Post by: Blanco on 15 Sep 2002, 05:33:08
Hi,
I need a script that make it possible to heal yourself on a medic corps. But not to full health, but 25 % for example.

This because you don't have medic skills but you can still use the medikit from your dead mate. So if you can find the medic corps and you come close an action appear with "heal at medikit" (or something like that) with the animation when activated.

Is there someone who found a script like that, or if not is there a scripter who can write one?


 
Title: Re:Medic script
Post by: vektorboson on 19 Sep 2002, 00:09:28
Hi,

I scripted a "medipack" myself, that works as following:

- when you can't stand you're healed till you can stand
- when your hands are hit, you're healed till your hands are OK
- maximum heal is 25%, but if the other conditions are met, the medipack is used!

Code: [Select]
_handshit = handsHit _unit
_canstand = canStand _unit
_dmg      = getDammage _unit

_pri = 0
?_handshit == 1 && _canStand: _pri = 1
?!_canStand: _pri = 2
_oldpri = _pri

_maxHeal = 0.25

#mediloop
_unit setDammage (getDammage _unit - 0.02)
?_pri == 1 && handsHit _unit == 0: _pri = 0
?_pri == 2 && canStand _unit: _pri = 1
?(_dmg - getDammage _unit > _maxHeal || _oldpri - _pri == 1 || getDammage _unit == 0): goto "medinext"
goto "mediloop"

#medinext

you have to define what _unit is in this script! If you added this script with addaction you can make

Code: [Select]
_unit = _this select 0

in the head of the script!

greetings,

Vektorboson

EDIT:

please replace the * in handshit with an "i"
Title: Re:Medic script
Post by: Blanco on 30 Sep 2002, 03:25:30
It was a long time ago I posted this and I did not expect anything anymore...
I give it a try
Thank you very much!!!!!!!
 ;D  :thumbsup:
Title: Re:Medic script
Post by: Blanco on 30 Sep 2002, 04:10:52
ok, i tried it and changed the "*" with i"s
No error messages,

I threw some handgrenades close to hurt myself, my legs were dammaged and I couldn't stand anymore, but how can I heal myself??
Is it automatic??