Jump to content
Sign in to follow this  
ZenWarrior

Capture Outpost script

Recommended Posts

Hi guys,

i´m making a mission where BLUFOR and OPFOR are able to take over Guerilla Outposts. Since i´m new to mission editing and scripting i could use a little help.

I placed some Guerilla units in the Outposts and made a trigger.

These are the triggers in the mission.sqm:

class Sensors

{

items=12;

class Item0

{

position[]={5195.4805,93.938622,3751.665};

a=80;

b=80;

rectangular=1;

activationBy="GUER";

activationType="NOT PRESENT";

interruptable=1;

type="GUER G";

age="UNKNOWN";

name="first_capture_1";

expActiv="hint ""Outpost 1 cleared""";

class Effects

{

};

};

class Item1

{

position[]={4542.8779,36.091125,4554.5161};

a=80;

b=80;

rectangular=1;

activationBy="GUER";

activationType="NOT PRESENT";

interruptable=1;

type="GUER G";

age="UNKNOWN";

name="first_capture_3";

expActiv="hint ""Outpost 3 cleared""";

class Effects

{

};

};

class Item2

{

position[]={6063.9858,70.928879,4306.1333};

a=80;

b=80;

rectangular=1;

activationBy="GUER";

activationType="NOT PRESENT";

interruptable=1;

type="GUER G";

age="UNKNOWN";

name="first_capture_2";

expActiv="hint ""Outpost 2 cleared""";

class Effects

{

};

};

class Item3

{

position[]={7205.6816,17.73057,5453.9482};

a=80;

b=80;

rectangular=1;

activationBy="GUER";

activationType="NOT PRESENT";

interruptable=1;

type="GUER G";

age="UNKNOWN";

name="first_capture_4";

expActiv="hint ""Outpost 4 cleared""";

class Effects

{

};

};

class Item4

{

position[]={5261.6021,120.61382,5973.1152};

a=80;

b=80;

rectangular=1;

activationBy="GUER";

activationType="NOT PRESENT";

interruptable=1;

type="GUER G";

age="UNKNOWN";

name="first_capture_5";

expActiv="hint ""Oupost 5 cleared""";

class Effects

{

};

};

class Item5

{

position[]={3788.7813,54.6455,5643.9199};

a=80;

b=80;

rectangular=1;

activationBy="GUER";

activationType="NOT PRESENT";

interruptable=1;

type="GUER G";

age="UNKNOWN";

name="first_capture_6";

expActiv="hint ""Outpost 6 cleared""";

class Effects

{

};

These are working good so far. What i want now is that BLUFOR and OPFOR Groups are able to take over the outpost if they cleared it, and by activating a terminal its captured (after a amount of time, sort of progression bar like in some Capture and Hold missions). And when it´s captured it should be generating some money like towns in warfare mission.

I hope you can help me here and give me some tips or examples.

Ok. Got another problem here, i placed some safezones at the map with triggers. The problem is that all enemy units in the camp are invulnerable now.

I used this type of trigger:

class Item6

{

position[]={5603.8721,10.848083,2218.3938};

a=400;

b=400;

rectangular=1;

activationBy="ANY";

repeating=1;

interruptable=1;

type="SWITCH";

age="UNKNOWN";

name="safezone_1";

expActiv="{_x allowDamage false} forEach allunits;";

class Effects

{

};

};

I thought this would only affect the units in the trigger radius and not all units on the map. So how do i have to change the trigger??

Edited by ZenWarrior

Share this post


Link to post
Share on other sites

I don't know how to do progression bars, it would be nice is someone could knock up a simple one. As for money, there are some scripts around for that although I've never tried that either.

for your second question, the trigger is working as it should allunits is all the units everywhere ,what you want is thislist

That will only work for one unit or the units present when the trigger first executes, if other units enter the trigger they won't be protected as the trigger won't repeat until conditions have changed.

You need to change the conditions constantly for it to work.

This will update the trigger every second

Cond

round (time %1) ==1

You will also need to remove the protection so you could try this in the on act, name the trigger trigP

{if ( _x distance trigP <150) then {_x allowDamage false} else {_x allowDamage true}} forEach thislist;

Make a trigger 200 x 200 , the protection zone would be 150

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Cool thanks :D,

i´ll try that immediately.

Really nice, it performs flawlessly.

Edited by ZenWarrior

Share this post


Link to post
Share on other sites

Ok, i skipped the idea with the progression bar and made it bit easier for me. I putted a Notebook on a table in the camp, with

this addaction ["Hack Terminal!!", "captured.sqf"] in init line.

captured.sqf:

if (side player == west) then {hint "BLUFOR captured an Outpost";};

if (side player == east) then {hint "OPFOR captured an Outpost.";};

if (side player == guer) then {hint "Guerillas captured an Outpost.";};

if (side player == civ) then {hint "Civs captured an Outpost.";};

The action menu pops up but the script should check what side the player is, but nothing is happen.

Also i don´t want all players on the server to see that someone captured an outpost.

Share this post


Link to post
Share on other sites

you need to add in the who is activating the addaction.

_caller = _this select 1;

if (side _caller == west) then {hint "BLUFOR captured an Outpost";};

they wont all see the hint as the hint in this case will be local to the player capturing it, that is if its on a dedi.

Share this post


Link to post
Share on other sites

Even if i write the captured.sqf just like you showed in the example, still nothing happens.

Do i have to modify the init line of the object also??

Share this post


Link to post
Share on other sites

just tried below with different sides - worked fine in editor- add all the variables see if it makes a difference.

ensure you dont have the capture script within a folder within your mission folder. should be in the main working folder.

_targ = _this select 0;
_caller = _this select 1;
_id - _this select 2; 

if (side _caller == west) then {hint "BLUFOR captured an Outpost";};
if (side _caller == east) then {hint "OPFOR captured an Outpost.";};
if (side _caller == guer) then {hint "Guerillas captured an Outpost.";};
if (side _caller == civ) then {hint "Civs captured an Outpost.";};

Share this post


Link to post
Share on other sites

Ok, this is weird.. it works.. but only with BLUFOR and OPFOR units, if the player is CIV or GUER then still nothing happens.

But thanks Mikie :) you really helped me with this.

Share this post


Link to post
Share on other sites
Ok, this is weird.. it works.. but only with BLUFOR and OPFOR units, if the player is CIV or GUER then still nothing happens.

But thanks Mikie :) you really helped me with this.

It should be

if (side _caller == resistance) then {hint "Guerillas captured an Outpost.";};

if (side _caller == civilian) then {hint "Civs captured an Outpost.";};

also some objects are detected as civilian in triggers so you will have to remove them from the area or filter them out with a script.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Great, that works. I could have been so clever to try that out but...:eek:

Thx

Share this post


Link to post
Share on other sites

I think the switch command is very helpful for that task. Thx for the tip.

So right now i´m placing some objects on the map via script.

The script for spawning units works fine, but i encounter some difficulties with spawning objects.

They are placed on the map, but not at the exact position i want them to.

Here´s part of script:

_Canarray = [[6615.35, 2985.29, 0],[5699.75, 2118.57, 0],[5675.33, 2137.4, 0],[5650.11, 2141.55, 0],[5600.74, 2133.64, 0],[5397.49, 1581.51, 0],[5082.09, 2027.62, 0],[3708.02, 3500.09, 0],[3705.42, 3534.2, 0],[4249.05, 4311.43, 0],[5829.93, 3554.5, 0],[5196.15, 5521.29, 0],[5781.96, 6043.3, 0],[6229.8, 6454.35, 0],[6191.52, 6512.67, 0],[6143.53, 6519.56, 0],[3993.38, 6692.02, 0],[3497.75, 8928.43, 0],[3391.04, 8920.09, 0],[6203.18, 7773.43, 0],[6258.3, 7718.79, 0],[6094.34, 7761.73, 0],[5247.67, 8121.26, 0],[5237.81, 8157.25, 0]];

for "_i" from 0 to ((count _Canarray) -1) do

{

_vehicle = objnull;

_pos = _Canarray select _i;

"Garbage_can" createvehicle _pos;

sleep 0.1;

_vehicle setpos _pos;

sleep 0.1;

};

Everything works fine, but something isn´t right with the _vehicle setpos _pos;

I try to figure it out whats missing in that script...

Share this post


Link to post
Share on other sites

Another Problem if i try to script the "safezone" trigger that i placed in the editor in the first time.

I don´t understand why i just can´t use the same line from the editor for the script...

_safez1 = createTrigger ["EmptyDetector",[5492.9136,2219.6995]];

_safez1 setTriggerArea [400,400,0,false];

_safez1 setTriggerActivation ["ANY", "PRESENT",true];

_safez1 setTriggerStatements ["round (time %1) ==1";"{if ( _x distance _safez1 <380) then {_x allowDamage false} else {_x allowDamage true}} forEach thislist", ""];

My other triggers in the script are working but this one isn´t.

Share this post


Link to post
Share on other sites

_safez1 setTriggerStatements ["round (time %1) ==1"[color="#FF0000"],[/color]"{if ( _x distance _safez1 <380) then {_x allowDamage false} else {_x allowDamage true}} forEach thislist", ""];

just a stab in the dark - try a comma.

Everything works fine, but something isn´t right with the _vehicle setpos _pos;

I try to figure it out whats missing in that script...

whats not happening correctly?

Share this post


Link to post
Share on other sites

The Problem with the setpos Problem is in this one:

_Canarray = [[6615.35, 2985.29, 0],[5699.75, 2118.57, 0],[5675.33, 2137.4, 0],[5650.11, 2141.55, 0],[5600.74, 2133.64, 0],[5397.49, 1581.51, 0],[5082.09, 2027.62, 0],[3708.02, 3500.09, 0],[3705.42, 3534.2, 0],[4249.05, 4311.43, 0],[5829.93, 3554.5, 0],[5196.15, 5521.29, 0],[5781.96, 6043.3, 0],[6229.8, 6454.35, 0],[6191.52, 6512.67, 0],[6143.53, 6519.56, 0],[3993.38, 6692.02, 0],[3497.75, 8928.43, 0],[3391.04, 8920.09, 0],[6203.18, 7773.43, 0],[6258.3, 7718.79, 0],[6094.34, 7761.73, 0],[5247.67, 8121.26, 0],[5237.81, 8157.25, 0]];

for "_i" from 0 to ((count _Canarray) -1) do

{

_vehicle = objnull;

_pos = _Canarray select _i;

"Garbage_can" createvehicle _pos;

sleep 0.1;

_vehicle setpos _pos;

sleep 0.1;

};

The objects are placed on the map but not at the exact postition. Even if i force them to with the "_vehicle setpos _pos" command.

Share this post


Link to post
Share on other sites

I got helped with the setpos Command problem. So Objects are now on the position where i want them to be.

But another problem occured with the safezone...

The script itself works really good but if i´m leaving the safezone with a vehicle then i´m invulnerable, actually the vehicle itself takes the damage like it should out of safezone.

Even if i´m getting out of the vehicle then i can get no damage at all.

Heres the script:

_safez1 = createTrigger ["EmptyDetector",[5492.9136,2219.6995]];

_safez1 setTriggerArea [400,400,0,false];

_safez1 setTriggerActivation ["ANY", "PRESENT",true];

_safez1 setTriggerText "safezone_1";

_safez1 setTriggerStatements ["round (time %1) ==1","{if ( _x distance thisTrigger <380) then {_x allowDamage false} else {_x allowDamage true}} forEach thislist", ""];

How do i have to modify the script so that players take regular damage if the leave the safezone on vehicles?

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  

×