Jump to content
Sign in to follow this  
therev709

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

Recommended Posts

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:

0 = [this] execVM "pow.sqf";

And this in the IED's init:

0 = [this] execVM "disarm.sqf";

The pow.sqf:

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:

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:

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:

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:

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:

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:

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.

Share this post


Link to post
Share on other sites

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 -

_bomb setVariable ["Rigged", 1, true];

to set the bomb to active

and

_bomb setVariable ["Rigged", 0, true];

to disarm

and then in pow script use something like

_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

Edited by Mikie boy

Share this post


Link to post
Share on other sites

Okay, this is what I have now:

disarm.sqf:

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:

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:

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

pow1.sqf:

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

remove the [if (!isServer) exitWith{};]

or replace with [if (isDedicated) exitWith{};]

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  

×