Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: Solved - Detect healing process  (Read 2210 times)

0 Members and 1 Guest are viewing this topic.

Offline Dobermann

  • Members
  • *
  • Ready to disturb you anytime
Solved - Detect healing process
« on: 09 Aug 2007, 20:40:06 »
Is there a way to detect that a unit is currently being healed ? I want to have the medic say something while healing units.
Detecting distance makes no sense for this. Actually the medic should only start talking when he is in the process of healing someone.
Any ideas ?
« Last Edit: 17 Aug 2007, 12:15:00 by Dobermann »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Detect healing process
« Reply #1 on: 09 Aug 2007, 22:35:15 »
Fill _medicanims array with the medic animation names when they heal other people.

Code: [Select]
// Checkmedic.sqf
_medicanims = ["blahblahblah","blehblehbleh", ...];
_medic = _this select 0;
while {true} do
{
   waitUntil {(animationState _medic) in _medicanims];
   hint "Medic healing";
   Sleep 15;
};

Offline Dobermann

  • Members
  • *
  • Ready to disturb you anytime
Re: Detect healing process
« Reply #2 on: 10 Aug 2007, 10:36:49 »
Ok thx for the input but it gives me several errors when trying to implement it.
I´m calling the script from the unit´s init with:
Code: [Select]
this exec "checkmedic.sqf"
the script looks like this now:
Code: [Select]
// Checkmedic.sqf
_medicanims = ["AinvPknlMstpSlayWrflDnon_medic"];
_medic = _this select 0;
while {true} do
{
   waitUntil [(animationState _medic) in _medicanims];
   hint "Medic healing";
   Sleep 15;
};

The hint is immedeately displayed even if the medic is not performing the anim and it gives me several errors from syntax
to generic error in expression with the Sleep 15 command.
 :scratch:

Offline Cheetah

  • Former Staff
  • ****
Re: Detect healing process
« Reply #3 on: 10 Aug 2007, 10:57:25 »
Try to use:
Code: [Select]
call { [medicName] execVM "checkmedic.sqf"; };
For more information: read this.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Dobermann

  • Members
  • *
  • Ready to disturb you anytime
Re: Detect healing process
« Reply #4 on: 10 Aug 2007, 12:48:50 »
Thx for the info. I have not changed to sqf yet, so expect some stupid errors.
Anyway I changed the init line of my unit med1 to:
Code: [Select]
call { [med1] execVM "checkmedic.sqf"; };
and the script checkmedic.sqf looks like this now:
Code: [Select]
// Checkmedic.sqf
_medicanims = ["AinvPknlMstpSlayWrflDnon_medic"];
_medic = _this select 0;
while {true} do
{
   waitUntil [(animationState _medic) in _medicanims];
   hint "Medic healing";
   Sleep 15;
};

It still doesnt work and gives me a long error message.  :scratch:

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Detect healing process
« Reply #5 on: 10 Aug 2007, 12:51:58 »
umm yeah... deres a syntax error dere try da next code

Code: [Select]
_medicanims = ["AinvPknlMstpSlayWrflDnon_medic"];
_medic = _this select 0;
while {true} do
{
   waitUntil {(animationState _medic) in _medicanims};
   hint "Medic healing";
   Sleep 15;
};

[edit] oops forgot 2 change da code... try it now

LCD OUT
« Last Edit: 10 Aug 2007, 12:54:02 by LCD »
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Dobermann

  • Members
  • *
  • Ready to disturb you anytime
Re: Detect healing process
« Reply #6 on: 10 Aug 2007, 14:12:40 »
Thx !

The errors went away, but there´s no hint when the medic is healing.
I also checked if the animation name is correct by hinting it from a trigger and it is the same one that
is questioned in the script.

Time to go nuts ?

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Detect healing process
« Reply #7 on: 10 Aug 2007, 17:34:51 »
heres interestin thing try editing da 1st line 2 lok like dat

_medicanims = [AinvPknlMstpSlayWrflDnon_medic];

:D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Detect healing process
« Reply #8 on: 10 Aug 2007, 18:08:44 »
Maybe there's more than one medic anim?

Put them all in an array if you find out theres more than one.

Offline Cheetah

  • Former Staff
  • ****
Re: Detect healing process
« Reply #9 on: 11 Aug 2007, 09:41:40 »
Code below works for me - case sensative. So had to remove all the capital letters from the _medicanims array.

Code: [Select]
_medicanims = ["ainvpknlmstpslaywrfldnon_medic"];
_medic = _this select 0;
hint format ["%1\n%2",_medic,_medicanims];
while {true} do
{
   waitUntil {(animationState _medic) in _medicanims};
   hint "Medic healing";
   Sleep 15;
};
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Dobermann

  • Members
  • *
  • Ready to disturb you anytime
Re: Detect healing process
« Reply #10 on: 17 Aug 2007, 12:14:03 »
Thx for your help.
Right now the script looks like this and does it´s job perfectly for me:

Code: [Select]
/* Speak while healing script

place this in the init line of the unit:  call{[unitname] execVM "Speak_while_healing.sqf"};
*/

_medic = _this select 0;
_ListOfSounds=["heal1","heal2","heal3","heal4","heal5"];
_run = true;

for [{}, {_run}, {_run}] do
{
if(animationState _medic == "AinvPknlMstpSlayWrflDnon_medic") then
{
_Sound=_ListOfSounds Select (floor (random (Count _ListOfSounds)));

_medic say _Sound;

sleep 2;
};
sleep 1;
};

Maybe it´s of use for other editors aswell.