Results 1 to 8 of 8

Thread: Add Action in MP: Intel Collection, Hostage Rescue, the whole 9 yards...

  1. #1

    Add Action in MP: Intel Collection, Hostage Rescue, the whole 9 yards...

    I'm comfortable with scripting for single player...but multiplayer is a whole new ball game!

    I'm working on a MP mission for my mates at DAGR, and basically am desperately trying to get addAction to work!

    Two things I'm trying to do:

    1. Have a hostage rescue scenario with a little hidden nasty IED surprise sitting behind him.

    I have this in the POW's init:

    Code:
    0 = [this] execVM "pow.sqf";
    And this in the IED's init:

    Code:
    0 = [this] execVM "disarm.sqf";
    The pow.sqf:

    Code:
    private ["_pow"];
    _pow = _this select 0;
    
    //Dedicated has no players to perform the action; that is, don't bother having dedi server run this
    if (!isServer) exitWith{};
    
    _pow addAction ["Rescue the Hostage","pow1.sqf"];
    The pow1.sqf:

    Code:
    if (!isServer) exitWith{};
    _pow = _this select 0;
    _caller = _this select 1;
    _id = _this select 2;
    _pow removeAction _id;
    
    if (_free) then {
    	_pow enableAI "MOVE";
    	_pow enableAI "ANIM";
    	//_pow switchmove "";
    	[_pow] joinsilent (group _caller);
    } else {
    	_IED="R_PG7V_AT" createVehicle [2114.48,1879.38,0.243683];
    };
    the disarm.sqf:

    Code:
    private ["_bomb"];
    _bomb = _this select 0;
    
    //Dedicated has no players to perform the action; that is, don't bother having dedi server run this
    if (!isServer) exitWith{};
    
    _bomb addAction ["Disarm the IED","disarm1.sqf"];
    the disarm1.sqf:

    Code:
    if (!isServer) exitWith{};
    _bomb = _this select 0;
    _free = TRUE;
    sleep 1;
    hint "Bomb has been disarmed."
    And of course this line in my init.sqf:

    Code:
    private ["_free"];
    _free = FALSE;
    So far nothing happens when I try to rescue the hostage with or without disarming the IED. He just sits there, and if I don't disarm the IED nothing explodes. I got this to work fine in SP without using all of these fancy schamcy variables and all that.

    Also, is there any way to condense these scripts into just one or two, rather than four. I'm still trying to wrap my mind around how MP works, so please bear with me, but I've been at this for weeks :/

    2. Next I have a number of maps, notebooks, satellite phones, etc. strewn throughout the AO for my team to locate and collect. Collecting the intel will then display markers on a map for everyone to find. I haven't fooled with these yet as I'm still just trying to get the hostage rescue/IED scripts to work. But this is what I have so far for one of the intel pieces:

    the intel's init:

    Code:
    this addAction ["Collect Intel","intel0.sqf"];
    Note* I know I have to make a public variable and all that and can't just put in the addaction into the item's init, but like I said I haven't fooled with this yet, but would still like some help on it.

    intel0.sqf:

    Code:
    if (!isServer) exitWith{};
    _rep = _this select 0;
    _caller = _this select 1;
    _id = _this select 2;
    _rep removeAction _id;
    
    deleteMarker "obja";
    
    hint "OPFOR markers have been added to your map.";
    
    _marker1 = createMarker ["redbush", getMarkerPos "ambush"];
    "redbush" setMarkerShape "ICON";
    "redbush" setMarkerType "mil_ambush";
    "redbush" setMarkerColor "ColorRed";
    "redbush" setMarkerText "засада";
    "redbush" setMarkerDir 270;
    
    
    _marker2 = createMarker ["redwep", getMarkerPos "weapons"];
    "redwep" setMarkerShape "ICON";
    "redwep" setMarkerType "hd_dot";
    "redwep" setMarkerColor "ColorRed";
    "redwep" setMarkerText "тайник с оружием";
    
    _marker3 = createMarker ["redhouse", getMarkerPos "safehouse"];
    "redhouse" setMarkerShape "ICON";
    "redhouse" setMarkerType "hd_flag";
    "redhouse" setMarkerColor "ColorRed";
    "redhouse" setMarkerText "безопасный дом";
    
    _marker4 = createMarker ["redpow", getMarkerPos "pow"];
    "redpow" setMarkerShape "ICON";
    "redpow" setMarkerType "hd_objective";
    "redpow" setMarkerColor "ColorRed";
    "redpow" setMarkerText "заключенный";


    Thanks in advance.

  2. #2
    Gunnery Sergeant Mikie boy's Avatar
    Join Date
    Jun 20 2009
    Location
    United Kingdoom
    Posts
    472
    from a very quick scan - The pow1.sqf: and disarm1.sqf:- change to if (isserver) exitwith etc - basically you are the person activating the script (or a human player) and not the server - so this will only activate locally.

    _free = local variable and is not transfered between scripts - change it to free - you may however run into a few probs that way - especially as it is multiplayer

    try using -
    Code:
    _bomb setVariable ["Rigged", 1, true];
    to set the bomb to active

    and
    Code:
    _bomb setVariable ["Rigged", 0, true];
    to disarm

    and then in pow script use something like
    Code:
    _rigged = _ied getVariable "rigged";
      if (_rigged == 0) then 
    { not explpode etc
    }else
    
    {explode};


    try it and see how you get on.

    oh dug this out from ages ago - try it and create suitcases and then use the addactions on the cases to see what happens.
    https://dl.dropbox.com/u/17725328/IEDsetup.Desert_E.rar
    Last edited by Mikie boy; Jun 29 2012 at 23:29.
    [FOCK] Mikie J

    Looking for New Players at Fockersteam
    http://fockers.moonfruit.com/

    A2/OA
    COOP Most Wanted - [Fockers] Most Wanted Co-x v07-09-2012
    Fock IED - http://www.armaholic.com/page.php?id...highlight=FOCK
    Fock Recruit/Group Management - http://www.armaholic.com/page.php?id=20580

    A3
    TvTCache Hunt - [FOCK]ers Cache Hunt TvT-x [ALPHA]
    Scripting Tutotial -http://www.armaholic.com/page.php?id=20465#comments
    Fock Recruit/Group Management - http://www.armaholic.com/page.php?id=19041

  3. #3
    Master Sergeant TheRev709's Avatar
    Join Date
    Jun 11 2009
    Location
    bluegrass
    Posts
    733
    Author of the Thread
    Okay, this is what I have now:

    disarm.sqf:

    Code:
    private ["_bomb"];
    _bomb = _this select 0;
    _bomb setVariable ["Rigged", 1, true];
    //Dedicated has no players to perform the action; that is, don't bother having dedi server run this
    if (!isServer) exitWith{};
    
    _bomb addAction ["Disarm the IED","disarm1.sqf"];
    pow.sqf:

    Code:
    private ["_pow"];
    _pow = _this select 0;
    
    //Dedicated has no players to perform the action; that is, don't bother having dedi server run this
    if (!isServer) exitWith{};
    
    _pow addAction ["Rescue the Hostage","pow1.sqf"];
    disarm1.sqf:

    Code:
    if (!isServer) exitWith{};
    _bomb = _this select 0;
    _bomb setVariable ["Rigged", 0, true];
    sleep 1;
    hint "Bomb has been disarmed."
    pow1.sqf:

    Code:
    if (!isServer) exitWith{};
    _pow = _this select 0;
    _caller = _this select 1;
    _id = _this select 2;
    _pow removeAction _id;
    _rigged = _pow getVariable "rigged";
    if (_rigged == 0) then {
    	_pow enableAI "MOVE";
    	_pow enableAI "ANIM";
    	//_pow switchmove "";
    	[_pow] joinsilent (group _caller);
    } else {
    	_IED="R_PG7V_AT" createVehicle [2114.48,1879.38,0.243683];
    };
    and nothing in the init.sqf pertaining to these scripts.

    The problem I'm having is in the pow1.sqf the _rigged = _pow getVariable "rigged"; doesn't work. If I put in the line: _pow setVariable ["Rigged", 0, true]; in the pow1.sqf then it will work, but that defeats the purpose. How do I get the variables to jump scripts? I've also tried using _bomb and _ied getVariable "rigged" to no avail.

  4. #4
    Gunnery Sergeant Mikie boy's Avatar
    Join Date
    Jun 20 2009
    Location
    United Kingdoom
    Posts
    472
    have you tried it with just naming the POW - as POW - then replace _pow with POW in the scripts -

    if not you can name the pow in the script (http://community.bistudio.com/wiki/setVehicleVarName) -

    then this will allow you to refer to the named object - that will work as that is the method i have used in the example script ( look in the objectclass file) i linked you to. then when calling the getvariable the script will know what you are directing it towards.

  5. #5
    Master Sergeant TheRev709's Avatar
    Join Date
    Jun 11 2009
    Location
    bluegrass
    Posts
    733
    Author of the Thread
    The problem I'm having isn't naming the pow variable, its the getVariable command for "rigged." "Rigged" is set in one script (disarm.sqf) but when called in the pow1.sqf it doesn't work.

  6. #6
    I'm not sure how it's supposed to work but it seems to.

    IF I go to the hostage I get two options

    1. disarm the bomb, if selected it explodes
    2. Rescue Hostage, nothing happens until I then select disarm bomb at which point the hostage joins the group.

    The only thing I changed was the bomb from [2114.48,1879.38,0.243683]; to getpos _pow;

    I only tested in single player so if it's an MP problem I don't know.

  7. #7
    Gunnery Sergeant Mikie boy's Avatar
    Join Date
    Jun 20 2009
    Location
    United Kingdoom
    Posts
    472
    in bomb.sqf - change the _bomb setvariable to POW setvariable (make sure you name him)

    basically your scripts are not telling one another what the changed variable is. you can use publicvariables for it as i have said before, but means you can only use this script one at a time. Although doing it this way you have to name the POW so its not that much more versatile.


    simplest way to do this - is to get rid of the ied/bomb!

    add all the actions to the pow. you can place an ied on the floor or by him for visual effects, but dont place anything in the init. thats how ive pretty much done it. otherwise you will have to name the objects and not use any local variables

  8. #8
    remove the [if (!isServer) exitWith{};]
    or replace with [if (isDedicated) exitWith{};]

Similar Threads

  1. Hostage rescue pvp mission need help
    By WalrusNZ in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 3
    Last Post: Sep 16 2011, 21:47
  2. Setcaptive (Hostage rescue)
    By Shape01 in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 5
    Last Post: Aug 8 2009, 14:06
  3. Need editing advice for hostage rescue
    By drkhrt532 in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 4
    Last Post: Aug 18 2002, 12:17
  4. Hostage rescue!?
    By Ginbo in forum GENERAL
    Replies: 5
    Last Post: Aug 8 2002, 14:25

Posting Permissions

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