Jump to content
Sign in to follow this  
DecimusAquila

help with a needed script

Recommended Posts

One of my missions is in progress and it came up with a funny need to add syntax for the mission to be enjoyed. I had it to work but it took me 5 triggers to set. I was wondering if any one can help me with a shorter method on the issue I will explain now.

E.g -

I have got 6 units in all in my group called "charlie". After finishing the first objective, I lost 3 men and left with 3 in all.

Now I am to go to complete the second objective by boat transport and I need 6 men in all to complete the mission.

So I put 5 more units next to the boat and 5 triggers next to them.

Once I reach the boat with my 3 men left, the trigger I put now add 3 more units from the five to make 6.

This was my command in each of the 5 triggers;

trigger 1:

cond: {alive _x} count units charlie == 1;

act: [z1,z2,z3,z4,z5] join player;

trigger 2:

cond: {alive _x} count units charlie == 2;

act: [z1,z2,z3,z4] join player;

trigger 3:

cond: {alive _x} count units charlie == 3;

act: [z1,z2,z3] join player;

trigger 4:

cond: {alive _x} count units charlie == 4;

act: [z1,z2] join player;

trigger 5:

cond: {alive _x} count units charlie == 6;

act: [z1] join player;

It works fine, but like I said, could someone help me with a shorter way to do this, via using a single syntax for 1 or 2 triggers or a script. Thanks.

Share this post


Link to post
Share on other sites

reinforce.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_a = ["",z1,z2,z3,z4,z5];

_c = 6 - (count units charlie);

for "_i" from 0 to _c do { [_a select _i] join player; };

Trigger

onAct: nul=[] execVM "reinforce.sqf"

Share this post


Link to post
Share on other sites

Salute Shuko,

Thankyou for the script, I tried it as you wrote in "SQF", though for some reason it did not work.

Share this post


Link to post
Share on other sites

Copy&paste the 3 lines in the code sample into an empty notepad, save it as reinforce.sqf

Make a trigger near the boat.

Activation: BLUFOR, Present, Repeatedly

Condition: player in thislist

On Act.: nul=[] execvm "reinforce.sqf"

Of course you can just use once instead of repeatedly, if you make sure the reinforcement guys arent going to be standing on the trigger area. In this case, you can leave the condition line to just "this".

I tried this in editor and it works just fine.

Share this post


Link to post
Share on other sites

Thankyou Shuko,

I followed all you did and it still was not working. I later looked at the error it gave and it wrote down "error line1". Was wondering what in goodness it meant.

The problem came from "Chris' OFP Script Editor".

As you open OFP script editor and choose new page SQF files;

It will first add this in the new page...

Quote[/b] ]; *****************************************************

; ** Operation Flashpoint Script File

; *****************************************************

It created the problem for the script not too work. I deleted it and all went fine. At least something new I learnt today smile_o.gif always delete the top if using this editor programme. biggrin_o.gif

Thanks Shuko, a great help.

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  

×