Jump to content
Sign in to follow this  
1para{god-father}

Addaction for MP and trigger

Recommended Posts

Ok really need some help with Addaction and getting it to work in MP,

This is what I have so far it all works great but when i put it on a dedi server I am having issues , it seems that the person who uses the Addaction , seems to be the only one who can get the timer and set off the IED.

I am trying to get it so anyone who sets off the trigger gets the timers and can defuse / setoff the IED

Any help advice would be most welcome....

init

intelstart= false;
publicvariable "intelstart";

Trigger In editor // to try and get it so it will activate for anyone

Con: intelstart
Act: Null = [] execVM "intelIED.sqf"

Addaction:-

MyCivAction1=this addAction ["Get IED", "starintelIED.sqf"]

starintelIED.sqf: // so it is not just local now ?!

intel1start= True;
publicvariable "intel1start";

intelIED.sqf

//////////////IED misssion////////////////////////////////////////////////////

if (!isServer) exitWith {}; // just run on server now

deletevehicle Cheget; // just incase it is still on map
["remove_action3", []] call CBA_fnc_globalEvent; // remove Addaction

[nil,nil,rHINT,"We have some Intel on another bomb location, you are to try and defuse the Bomb and stop collateral damage"] call RE;
waituntil { !isNil "BIS_fnc_init" }; 
[nil,nil,rPlaysound,"dropbox"] call RE;
_random = floor(random 5);
_spawnspot = ["boom1", "boom2", "boom3","boom4","boom5","boom6","boom7","boom8","boom9","convoywp10_a"] select _random; //get random location from markers
Cheget = "Suitcase" createVehicle getmarkerpos _spawnspot;
Cheget setVehicleInit "defuseaction = this addaction [""Defuse"", ""DefuseAction.sqf""]";
processInitCommands;

//Create Marker
_marker = createMarker[format["marker%1",Cheget],getmarkerpos _spawnspot ];
_marker setMarkerShape "ICON";
_marker setMarkerType "FLAG";
_marker setMarkerText "Bomb Location";
_marker setMarkerSize [.50, .50];

//Create Trigger to start
_triggeram1 = createTrigger["EmptyDetector",[getmarkerpos _spawnspot select 0,getmarkerpos _spawnspot select 1,0]];
_triggeram1 setTriggerArea [20,20,0,false];
_triggeram1 setTriggerActivation ["WEST","PRESENT",true];
_triggeram1 setTriggerTimeout [5,5,5,true];
_triggeram1 setTriggerStatements ["this", "BombTimerScript = [this, 25] execVM 'BombTimer.sqf';",""];
/////ctreate OPFOR//////////////////
_dis = 180;
_ang = random 360;
_dx = sin(_ang)*_dis;
_dy = cos(_ang)*_dis;
_positionToSpawnIn = [((getpos Cheget) select 0) + _dx, ((getpos Cheget) select 1) + _dy, 0];
_armourgrp1 = [_positionToSpawnIn, east,["Offroad_DSHKM_INS", "BTR90","BTR90","BTR90"],[[-3,-3], [3,3], [0,0], [3,-3]]]  call BIS_fnc_spawnGroup;
Sleep .5;
[_armourgrp1, getPos cheget, 380] call bis_fnc_taskPatrol;

// Initialize Functions
waitUntil{!(isNil "BIS_fnc_init")};
waitUntil{!(isNil "BIS_MPF_InitDone")};
// If you only wanted one of the two markers to get guys use this line.

// How many enemies in each group.
_enemyCount = 10 ;//_this select 0;

// Spawn the first group and have them attack.
_grprIED = [getPos Cheget, east, _enemyCount] call BIS_fnc_spawnGroup;

[_grprIED, getPos cheget, 180] call bis_fnc_taskPatrol;

waituntil{!alive Cheget};

["add_action3", []] call CBA_fnc_globalEvent;

[nil,nil,rHINT,"Well done come back for more intel when you have time "] call RE;

Deletemarker _marker;
deletevehicle _triggeram1;
deletevehicle Cheget;
_grprIED spawn {
_units = units _this;
waitUntil {sleep 300; ({alive _x} count _units) == 0};
{deleteVehicle _x} foreach _units;
deleteGroup _this;

{deletevehicle _x;} foreach crew _armourgrp1;

deletevehicle _armourgrp1;

Bombtimer:

private ["_bomb", "_timer"];
_bomb = _this select 0;
_timer = _this select 1;

waitUntil {_timer = _timer - 1; sleep 1; hintsilent format ["Time: %1", _timer]; _timer < 0 || DEFUSED};

if (_timer < 0) then {
_blast = "Bo_GBU12_LGB" createVehicle (position Cheget);
Cheget removeaction defuseaction;
deletevehicle Cheget;
};

Share this post


Link to post
Share on other sites

Without looking in great detail, it would appear you are setting the wrong value for the trigger:

intel[color="Red"]1[/color]start= True;
publicvariable "intel[color="Red"]1[/color]start";

While your trigger is looking for

intelstart

Share this post


Link to post
Share on other sites

Opppss that is just a type o , as the trigger does fire.

But like i said only the player who uses the addaction is able to see the timer and get the defuse etc..

Share this post


Link to post
Share on other sites

Not sure about the action I never use setVehicleInit. What about the MPF framework using RE and rADDACTION or rSPAWN.

I'm surprised it actually works for someone on a dedicated since triggers created via. scripting are local to the machine. Meaning the trigger you create to start "Bombtimer.sqf" only runs on the server.

---------- Post added at 21:45 ---------- Previous post was at 21:40 ----------

For the timer part I posted this in another thread. The time is synchronized and shown for all:

http://forums.bistudio.com/showthread.php?p=2008065#post2008065

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  

×