Results 1 to 4 of 4

Thread: Heal pilot before rescue menu is active

  1. #1

    Heal pilot before rescue menu is active

    Guys,

    I'm very new to scripting but enjoying working on it. I'm having troubles creating my own scripts from scratch but can figure out and modify others with some success.

    I'm hoping someone can help me understand and add extra code to the below mission script. It's part of a mission script from Bon's 'TFOR' addon.

    I'd like to make it so that the pilot is slightly injured and before the player gets the 'rescue' action menu he first has to heal the pilot.

    What do I need to do to get that to work please?

    Code:
    _grp1 = createGroup tfor_friendly_side;
    _pilot = _grp1 createUnit [tfor_rescuepilot_pilottype, _pos, [], 0, "FORM"];
    _pilot setRank "CAPTAIN";
    _pilot setCaptive true;
    _pilot allowFleeing 0;
    _pilot setVehicleInit "
    this addAction ['Rescue','scripts\capture.sqf'];
    "; processInitCommands;

  2. #2
    Master Gunnery Sergeant twirly's Avatar
    Join Date
    Sep 13 2010
    Location
    Gods Own (NZ)
    Posts
    1,302
    Not tested...but give this a shot. Add the lines in RED. You might want to change the damage values.

    This will halt execution of whatever script is running (this script) until the pilot is healed! That may not have desirable effects depending on what's next in the script.

    Code:
    _grp1 = createGroup tfor_friendly_side;
    _pilot = _grp1 createUnit [tfor_rescuepilot_pilottype, _pos, [], 0, "FORM"];
    _pilot setRank "CAPTAIN";
    _pilot setCaptive true;
    _pilot allowFleeing 0;
    
    _pilot setDamage 0.6;
    waituntil {damage _pilot <= 0.1}; 
    
    _pilot setVehicleInit "this addAction ['Rescue','scripts\capture.sqf'];";
    processInitCommands;
    EDIT: If that's the case.... do it this way....

    Code:
    _grp1 = createGroup tfor_friendly_side;
    _pilot = _grp1 createUnit [tfor_rescuepilot_pilottype, _pos, [], 0, "FORM"];
    _pilot setRank "CAPTAIN";
    _pilot setCaptive true;
    _pilot allowFleeing 0;
    
    _pilot setDamage 0.6;
    
    nul = [_pilot] spawn {
    	private ["_pilot"];
    	_pilot = _this select 0;
    	waituntil {sleep 1;damage _pilot <= 0.1};
    	_pilot setVehicleInit "this addAction ['Rescue','scripts\capture.sqf'];";
    	processInitCommands;
    
    };
    
    //...script carries on here
    //...blah...blah...blah
    Last edited by twirly; Jun 13 2012 at 00:44. Reason: Clarity

    "Learn by doing!" - Quoted from a post by Imutep

    OUTERRA - OUTERRA - OUTERRA - OUTERRA - BLOWMIND!

  3. #3
    Hey Twirly, cheers for that. there's a fair bit more in the script that needs to run so I'm guessing I should try your second option.

    Thanks heaps, I'll report back what happens.

  4. #4
    Master Gunnery Sergeant twirly's Avatar
    Join Date
    Sep 13 2010
    Location
    Gods Own (NZ)
    Posts
    1,302
    Yeah mate... try that second option then. What that does is spawn a separate script that will run alongside the calling script. The spawned script will wait until the pilot is healed before he gets the action.

Similar Threads

  1. moveInCargo -> for any(?) vehicle ? (the obligatory rescue injured pilot scenario)
    By R.Flagg in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 1
    Last Post: Apr 22 2012, 00:04
  2. Movement keys not working when action menu active
    By No Use For A Name in forum ARMA 2 & OA - TROUBLESHOOTING
    Replies: 3
    Last Post: Jul 8 2010, 22:42
  3. Advice on my "Downed chopper pilot" rescue mission.
    By BF2_Trooper in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 18
    Last Post: Jul 10 2009, 16:34
  4. 2 Questions with pilot rescue/taking documents
    By ilovebeer in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 4
    Last Post: Jul 7 2009, 22:47
  5. Rescue pilot in laser guide
    By joeranger in forum OPF MISSIONS
    Replies: 0
    Last Post: Aug 22 2003, 01:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •