Home   Help Search Login Register  

Author Topic: Updating Tasks in briefing... teamSwitch again [SOLVED]  (Read 2542 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
EDIT: See last post for the solution.

Hi all,

Bizarre bug or my fault? I have no idea, this solution seems almost perfect but this happens:

1. I play my original unit (squad leader) I don't teamSwitch, triggers fire variables and the tasks are ticked off as expected. Great!

2. I play my original unit (squad leader) I DO teamSwitch to other units and then back to the original one, triggers fire the same variables but no tasks are ticked off. NOT GREAT!

All the units that haven't been played get their tasks ticked off great all the time, I can see that when I teamSwitch to them.

No tasks are doubled when teamSwitching, so it works well... almost  :-[

I am stumped, it is as if the trigger's variables are not recognized in a unit that you have played before.

init.sqf
Code: [Select]
BriefedUnits = [];
BriefedUnits2 = [];
BriefedUnits3 = [];
nil = [] execVM "briefing.sqf";

briefing.sqf
Code: [Select]
waitUntil {! isNil {player}};
waitUntil {player == player};

if (player in BriefedUnits) then
{
if (! isNil "onedone") then {tskObj2 setTaskState "SUCCEEDED"};
if (! isNil "twodone") then {tskObj3 setTaskState "SUCCEEDED"};
if (! isNil "threedone") then {tskObj4 setTaskState "SUCCEEDED"};
if (! isNil "alldone") then {tskObj5 setTaskState "SUCCEEDED"};
};

if (! (player in BriefedUnits)) then
{
player createDiaryRecord["Diary", ["Author's Info", "<br/>Mission designer: Laggy<br/><br/>Mission version: 0.75<br/><br/>Mission uses SIDE respawn, so you can use teamswitch in SP and MP.<br/><br/>Known bugs: The UAV module is quite buggy sometimes and the Simple Support Module (airstrikes, supplies etc.) don't work at all on a dedicated server, hardly even on a hosted server if you are a client. I hope BIS will fix this, since these modules are otherwise a great addition to the game.<br/><br/>Hope you enjoy the mission."]];
player createDiaryRecord["Diary", ["Friendly Forces", "<br/>You can call in supply drops, reinforcements and airstrikes through your communications menu (Space bar).<br/><br/>The UAV is also a great asset."]];
player createDiaryRecord["Diary", ["Enemy Forces", "<br/>Expect trained Takistani Forces and scattered Insurgents.<br/><br/>The mountains should be quite safe, but most of the roads are patrolled by the Takistani Army."]];
player createDiaryRecord["Diary", ["HMMWV SOV", "<br/>Your HMMWV SOV is a helpful tool behind enemy lines and has some interesting functions which can be accessed through the action menu.<br/><br/>You can create a camp for your team, where you will find weapons, a tent and camoflage cover.<br/><br/>The HMMWV SOV also acts as a UAV terminal, from which you can scout the terrain and mission areas. The UAV is currently circling the village of <marker name='uavmark'>Chak Chak</marker>, but as soon as you use the terminal you can change its flight pattern."]];
player createDiaryRecord["Diary", ["Situation", "<br/>You are a combined NATO Special Forces Team (Callsign: Stalker).<br/><br/>You are being sent behind enemy lines in central Takistan to perform sabotage, assassinations and to gather intel. You will be alone on hostile ground for quite a while, with no one to trust but yourselves.<br/><br/>A CH-47F Chinook (Callsign: Icarus) will drop you off one click <marker name='start'>South</marker> of Sar-e Sang pass. There you will recieve an updated briefing and continue by land. A HMMWV SOV has also been dropped for your disposal.<br/><br/>Good Luck!"]];

tskObj1 = player createSimpleTask["Land and get updated briefing."];
tskObj1 setSimpleTaskDescription["<br/>Land at the <marker name='start'>Insertion Point</marker>, get your updated briefing, board the HMMWV SOV and get on your way.","Land and get updated briefing.","Land and get updated briefing."];
player setCurrentTask tskObj1;

BriefedUnits = BriefedUnits + [player];
};

waitUntil {! isNil {update1}};

tskObj1 setTaskState "SUCCEEDED";

if (! (player in BriefedUnits2)) then
{
player createDiaryRecord["Diary", ["Updated Briefing", "<br/>Three Missions:<br/><br/>1. A mobile SCUD Launcher has been reported in the <marker name='scudmarker'>Central Parts</marker> of Takistan. Your mission is to detroy it. The SCUD is most likely guarded by Takistani Forces and well camoflaged to not be seen from the air. Destroy the SCUD to complete the task.<br/><br/>2. Colonel Aziz is one of the major players, without him the Takistani Forces will be demoralized and crippled. Intel reports say that he is travelling in a BLACK SUV between this <marker name='badguymark1'>Air Base</marker> and the <marker name='badguymark2'>Mosque</marker> in Bastam. Your mission is to assassinate him. Kill Aziz and confirm his death to complete the task.<br/><br/>3. Al Qaida is running an insurgent training camp in the <marker name='campmarker'>Eastern Mountains</marker>. The leader of this camp also has vital information on other Al Qaida activities, namely a map. The camp must be wiped out and the map retrieved. Clear the camp and take the map to complete the task."]];

tskObj4 = player createSimpleTask["Clear Al Qaida Camp and take the Map."];
tskObj4 setSimpleTaskDescription["<br/>Kill everyone in the Al Qaida training camp located in the <marker name='campmarker'>Eastern Mountains</marker>, search the body of the leader for a map (you are looking for the weapon ""Evidence (Map)"").","Clear Al Qaida Camp and take the Map.","Clear Al Qaida Camp and take the Map."];

tskObj3 = player createSimpleTask["Assassinate Colonel Aziz."];
tskObj3 setSimpleTaskDescription["<br/>Find a good spot to take out Colonel Aziz, who is commuting between the <marker name='badguymark1'>Air Base</marker> and the <marker name='badguymark2'>Mosque</marker> (you are looking for a BLACK SUV and a man with a Golden Gun, wearing a black beret.)","Assassinate Colonel Aziz.","Assassinate Colonel Aziz."];

tskObj2 = player createSimpleTask["Destroy mobile SCUD Launcher."];
tskObj2 setSimpleTaskDescription["<br/>Find and destroy the SCUD, which is located in the <marker name='scudmarker'>Central Parts</marker>.","Destroy mobile SCUD Launcher.","Destroy mobile SCUD Launcher."];

if (! isNil "onedone") then {tskObj2 setTaskState "SUCCEEDED"};
if (! isNil "twodone") then {tskObj3 setTaskState "SUCCEEDED"};
if (! isNil "threedone") then {tskObj4 setTaskState "SUCCEEDED"};

BriefedUnits2 = BriefedUnits2 + [player];
};

waitUntil {! isNil {update2}};

if (! (player in BriefedUnits3)) then
{
tskObj5 = player createSimpleTask["Move to Exfiltration Point."]; tskObj5 setSimpleTaskDescription["<br/>Get to the <marker name='start'>Exfiltration Point</marker> and call in your helo pickup.","Move to Exfiltration Point.","Move to Exfiltration Point."];

if (! isNil "alldone") then {tskObj5 setTaskState "SUCCEEDED"};

BriefedUnits3 = BriefedUnits3 + [player];
};

Trigger (true, repeatedly)
Code: [Select]
onTeamSwitch {execVM "briefing.sqf"}
Trigger (on Activation ticking off tasks)
Code: [Select]
tskObj2 setTaskState "SUCCEEDED"; hint "SCUD Launcher destroyed."; onedone = true; publicVariable "onedone"; leader heroes groupRadio "ra1"

The twodone and threedone triggers work exactly the same.

I find it really annoying that the hardest thing in mission making is to get the damn briefing to work  >:(

Grateful for advice,

Laggy
« Last Edit: 22 Aug 2010, 13:10:23 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Updating Tasks in briefing... teamSwitch again
« Reply #1 on: 16 Aug 2010, 21:25:54 »
Your report is hard to follow.

a) I assume the problem is that your initial unit is already in your array 'BriefedUnits'
as you have designed it. The caching makes no sense to me.

b) Did you debug your problem with diag_log?

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Updating Tasks in briefing... teamSwitch again
« Reply #2 on: 16 Aug 2010, 21:52:19 »
Hi Kju,

a) Every player unit is put in the array from mission start, every other unit becomes part of the array ones teamSwitched TO by a player as the briefing.sqf is run at every teamswitch. The problem is that the tasks don't get ticked off IF you play a unit that has been played "twice" due to teamSwitching. As you can see, the same "task succeeded" update is used for every unit on teamSwitch, whether already in the array or not.

Like this:

Playing unit1 from mission start - tasks are active
Switching to unit2 - tasks are active
Switching back to unit1 - tasks are active
Tasks are succeeded as trigger variables are broadcasted
Playing unit1 - tasks are active but not succeeded (not ticked off)
Switching to unit3 - tasks are active and succeeded (ticked off properly)
Switching to unit4 - tasks are active and succeeded (ticked off properly)
Switching back to unit1 - tasks are active but not succeeded (not ticked off)
New tasks are activated and succeeded as new trigger variables are broadcasted
Playing unit1 - new tasks are active and succeeded (ticked off properly), old tasks still just active


If you never teamSwitch it works perfectly for unit1.

What do you mean by "caching"?

b) No, how is that done?

Thanks a lot,

Laggy
« Last Edit: 16 Aug 2010, 22:24:08 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Updating Tasks in briefing... teamSwitch again
« Reply #3 on: 17 Aug 2010, 08:49:29 »
I think it would help if you post screenshots of the different states.

http://community.bistudio.com/wiki/diag_log
logs to rpt
http://community.bistudio.com/wiki/arma.RPT

and use a dev console to do live debugging
http://www.armaholic.com/page.php?id=5773

If you add diag_log statements to your code, you can track the state of your variables.
With the console you can query them live.

If you see and understand what happens, it will tell you most likely what goes wrong.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Updating Tasks in briefing... teamSwitch again
« Reply #4 on: 17 Aug 2010, 17:50:34 »
With screens,

Playing unit1 from mission start - pic 1
Switching to unit2 - pic 1
Switching back to unit1 - pic 1
Tasks are succeeded as trigger variables are broadcasted
Playing unit1 - pic 1
Switching to unit3 - pic 2
Switching to unit4 - pic 2
Switching back to unit1 - pic 1
New tasks are activated and succeeded as new trigger variables are broadcasted
Playing unit1 - pic 3


Piclist below:
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Updating Tasks in briefing... teamSwitch again
« Reply #5 on: 17 Aug 2010, 18:20:08 »
Thanks.

Firstly I fixed a couple of coding issues:

Code: [Select]
waitUntil {!(isNull player)};

if (player in BriefedUnits) then
{
if (!isNil "onedone") then {tskObj2 setTaskState "SUCCEEDED"};
if (!isNil "twodone") then {tskObj3 setTaskState "SUCCEEDED"};
if (!isNil "threedone") then {tskObj4 setTaskState "SUCCEEDED"};
if (!isNil "alldone") then {tskObj5 setTaskState "SUCCEEDED"};
}
else
{
player createDiaryRecord["Diary",["Author's Info","<br/>Mission designer: Laggy<br/><br/>Mission version: 0.75<br/><br/>Mission uses SIDE respawn, so you can use teamswitch in SP and MP.<br/><br/>Known bugs: The UAV module is quite buggy sometimes and the Simple Support Module(airstrikes, supplies etc.) don't work at all on a dedicated server, hardly even on a hosted server if you are a client. I hope BIS will fix this, since these modules are otherwise a great addition to the game.<br/><br/>Hope you enjoy the mission."]];
player createDiaryRecord["Diary",["Friendly Forces","<br/>You can call in supply drops, reinforcements and airstrikes through your communications menu(Space bar).<br/><br/>The UAV is also a great asset."]];
player createDiaryRecord["Diary",["Enemy Forces","<br/>Expect trained Takistani Forces and scattered Insurgents.<br/><br/>The mountains should be quite safe, but most of the roads are patrolled by the Takistani Army."]];
player createDiaryRecord["Diary",["HMMWV SOV","<br/>Your HMMWV SOV is a helpful tool behind enemy lines and has some interesting functions which can be accessed through the action menu.<br/><br/>You can create a camp for your team, where you will find weapons, a tent and camoflage cover.<br/><br/>The HMMWV SOV also acts as a UAV terminal, from which you can scout the terrain and mission areas. The UAV is currently circling the village of <marker name='uavmark'>Chak Chak</marker>, but as soon as you use the terminal you can change its flight pattern."]];
player createDiaryRecord["Diary",["Situation","<br/>You are a combined NATO Special Forces Team(Callsign: Stalker).<br/><br/>You are being sent behind enemy lines in central Takistan to perform sabotage, assassinations and to gather intel. You will be alone on hostile ground for quite a while, with no one to trust but yourselves.<br/><br/>A CH-47F Chinook(Callsign: Icarus) will drop you off one click <marker name='start'>South</marker> of Sar-e Sang pass. There you will recieve an updated briefing and continue by land. A HMMWV SOV has also been dropped for your disposal.<br/><br/>Good Luck!"]];

tskObj1 = player createSimpleTask ["Land and get updated briefing."];
tskObj1 setSimpleTaskDescription ["<br/>Land at the <marker name='start'>Insertion Point</marker>, get your updated briefing, board the HMMWV SOV and get on your way.","Land and get updated briefing.","Land and get updated briefing."];
player setCurrentTask tskObj1;

BriefedUnits = BriefedUnits + [player];
};

waitUntil {!isNil "update1"};

tskObj1 setTaskState "SUCCEEDED";

if (!(player in BriefedUnits2)) then
{
player createDiaryRecord["Diary",["Updated Briefing", "<br/>Three Missions:<br/><br/>1. A mobile SCUD Launcher has been reported in the <marker name='scudmarker'>Central Parts</marker> of Takistan. Your mission is to detroy it. The SCUD is most likely guarded by Takistani Forces and well camoflaged to not be seen from the air. Destroy the SCUD to complete the task.<br/><br/>2. Colonel Aziz is one of the major players, without him the Takistani Forces will be demoralized and crippled. Intel reports say that he is travelling in a BLACK SUV between this <marker name='badguymark1'>Air Base</marker> and the <marker name='badguymark2'>Mosque</marker> in Bastam. Your mission is to assassinate him. Kill Aziz and confirm his death to complete the task.<br/><br/>3. Al Qaida is running an insurgent training camp in the <marker name='campmarker'>Eastern Mountains</marker>. The leader of this camp also has vital information on other Al Qaida activities, namely a map. The camp must be wiped out and the map retrieved. Clear the camp and take the map to complete the task."]];

tskObj4 = player createSimpleTask ["Clear Al Qaida Camp and take the Map."];
tskObj4 setSimpleTaskDescription ["<br/>Kill everyone in the Al Qaida training camp located in the <marker name='campmarker'>Eastern Mountains</marker>, search the body of the leader for a map(you are looking for the weapon ""Evidence(Map)"").","Clear Al Qaida Camp and take the Map.","Clear Al Qaida Camp and take the Map."];

tskObj3 = player createSimpleTask ["Assassinate Colonel Aziz."];
tskObj3 setSimpleTaskDescription ["<br/>Find a good spot to take out Colonel Aziz, who is commuting between the <marker name='badguymark1'>Air Base</marker> and the <marker name='badguymark2'>Mosque</marker>(you are looking for a BLACK SUV and a man with a Golden Gun, wearing a black beret.)","Assassinate Colonel Aziz.","Assassinate Colonel Aziz."];

tskObj2 = player createSimpleTask ["Destroy mobile SCUD Launcher."];
tskObj2 setSimpleTaskDescription ["<br/>Find and destroy the SCUD, which is located in the <marker name='scudmarker'>Central Parts</marker>.","Destroy mobile SCUD Launcher.","Destroy mobile SCUD Launcher."];

if (!isNil "onedone") then {tskObj2 setTaskState "SUCCEEDED"};
if (!isNil "twodone") then {tskObj3 setTaskState "SUCCEEDED"};
if (!isNil "threedone") then {tskObj4 setTaskState "SUCCEEDED"};

BriefedUnits2 = BriefedUnits2 + [player];
};

waitUntil {!isNil "update2"};

if (!(player in BriefedUnits3)) then
{
tskObj5 = player createSimpleTask ["Move to Exfiltration Point."];
tskObj5 setSimpleTaskDescription ["<br/>Get to the <marker name='start'>Exfiltration Point</marker> and call in your helo pickup.","Move to Exfiltration Point.","Move to Exfiltration Point."];

if (!isNil "alldone") then {tskObj5 setTaskState "SUCCEEDED"};

BriefedUnits3 = BriefedUnits3 + [player];
};

Secondly the code design you use here seems faulty to me.

You execute the script once at mission start AND on each teamSwitch change.
Now you have a couple of waitUntils in there. If those do not pass directly on execution,
it seems to me they will cause havoc later on.

You need to be aware that teamSwitch does kill prior started scripts or that each unit does
NOT have their own VM or sth like that. As you use player to reference the units, this will be
true for every unit you switch to.

So first I suggest you do add debugging in there to see whats actually going on.
And probably you need to redesign the logic from the scratch here.

---

This is called data caching.

Code: [Select]
if (!player in BriefedUnits) then
{
 BriefedUnits = BriefedUnits + [player];
 ...

You remember each object/instance in your array.
« Last Edit: 17 Aug 2010, 18:22:59 by kju »

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Updating Tasks in briefing... teamSwitch again
« Reply #6 on: 17 Aug 2010, 19:04:07 »
EDIT: Can't make the debug console work in game, when hitting enter during interrupt menu I just save the game. I have the console in a mod folder, does it only work when put in original addons folder?

Thanks a lot Kju, really appreciate your help here.

Quote
You execute the script once at mission start AND on each teamSwitch change.
Now you have a couple of waitUntils in there. If those do not pass directly on execution,
it seems to me they will cause havoc later on.

The waitUntils are ALWAYS linear, there is no way update2 can happen before update1.

Quote
You need to be aware that teamSwitch does kill prior started scripts or that each unit does
NOT have their own VM or sth like that. As you use player to reference the units, this will be
true for every unit you switch to.

The idea was to run the script every time you teamSwitch. As you can see, all the stuff that has already been executed for units in BriefedUnits, BriefedUnits2, BriefedUnits3 will be ignored if the script is run again on the same unit. There is no doubling of tasks, which has been my problem in earlier coding.

If scripts are killed, doeas that mean the unit is also take out of the array?

Maybe I'm thinking completely wrong as you say, but I don't understand why the tasks don't get ticked off for unit1 when the variable (i.e "onedone") is obviously broadcasted, not even after getting the if (!isNil "onedone") then {tskObj2 setTaskState "SUCCEEDED"}; update when teamSwitched to.

It is as if the variables "onedone", "twodone" and "threedone" are Nil when you switch back to unit1. In fact they are treated as Nil even if the triggers broadcast the variables while you are actually playing unit1, if you have played unit1 twice that is.

I wish BIS could explain better what really happens when you teamSwitch.

If you don't mind, how would you solve it?

Thanks again, I'll try to find that debugger.
« Last Edit: 17 Aug 2010, 19:55:57 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Updating Tasks in briefing... teamSwitch again
« Reply #7 on: 18 Aug 2010, 09:15:33 »
Here is my modified version:
http://www.file-upload.net/download-2755475/stra_debug2.7z.html

It activates via ESC-2. Also works in MP.

Quote
The waitUntils are ALWAYS linear, there is no way update2 can happen before update1.

This is probably part of the problem. Without seeing the code for those vars,
one cannot say how their system works obviously. See next point in addition:

Quote
does NOT kill prior started

Sorry for the confusion. That NOT has to be in there.  :-[

So either your initial execution or a later probably still hangs in one of the waitUntils.
Now you teamSwitch again, another new instance of the script gets started.
Now at some point it seems the difference instances of the script interfere with each other.

Bottom line you need to understand what is going on.
Hence debug the script with the logging explained above, like add

diag_log ["1",time,variableX,variableY,...]; in your scripts at different parts of the execution phase.
Increment that string marker at the start to easily know which diag_log output you see in the rpt
relates to which code line.

---

In terms of overall design you should have at least three scripts.

a) on game init
b) on teamswitch
c) each task true execution independent to the both above (while in the "on teamSwitch" script too)

---

Another element to take into account - at least unknown to me.
Does teamSwitch clear the entities tasks or if you switch back,
does it still have those from before?

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Updating Tasks in briefing... teamSwitch again
« Reply #8 on: 18 Aug 2010, 13:29:42 »
Thanks again Kju,

Quote
In terms of overall design you should have at least three scripts.

a) on game init
b) on teamswitch
c) each task true execution independent to the both above (while in the "on teamSwitch" script too)

Great! That makes a lot of sense even to an in this case rookie scripter like me.
I will travel for two days, so I won't have time to test this until Friday, but I'll post the results then.
Thanks for taking your time explaining this, I personally think it is the hardest part of mission editing.
Especially since I haven't found any documentation regarding teamSwitch and what actually happens.
I don't understand how scripters like you can know stuff like this... Do you "unPBO" the whole game engine   :D

Kind regards,

Laggy
« Last Edit: 18 Aug 2010, 13:32:40 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Updating Tasks in briefing... teamSwitch again
« Reply #9 on: 18 Aug 2010, 20:13:58 »
Well I have no special insights to tell. Just the standard:

* Look at other people's missions and scripts. Also the ones from BI can get good insights.
* Ask and talk to other people.
* Use the BIKI (via google search).
* Use search on sites like ofpec, BIF, ah.com etc.
* Getting a good tool set to search for and inside files, code editor and search-replace for example.
* Having a degree in software development and/or practical experience in other languages certainly helps.

From the other perspective to me to reduce time/effort needed as much as possible is among the most crucial
aspects of modding. At least I try to organize my involvement to follow that idea.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Updating Tasks in briefing... teamSwitch again
« Reply #10 on: 21 Aug 2010, 15:52:08 »
Solution below, thanks to Kju and Muzzleflash.

init.sqf - Take away the "nil = execVM", because it interferes with BIS' UAV scripting.
Code: [Select]
BriefedUnits = [];
execVM "briefing.sqf";

TeamSwitchTrigger:
Code: [Select]
Repeatedly
Condition: ! (player in BriefedUnits)
On Activation: call {[] execVM "briefing.sqf"}

Example of Task Trigger:
Code: [Select]
Condition: ! (alive scud)
On Activation: {(_x getVariable "tskObj2") setTaskState "SUCCEEDED"} forEach BriefedUnits; hint "SCUD Launcher destroyed."; onedone = true; publicVariable "onedone"; leader heroes groupRadio "ra1"

briefing.sqf
Code: [Select]
waitUntil {!(isNull player)};

BriefedUnits = BriefedUnits + [player];

player createDiaryRecord["Diary",["Author's Info","<br/>Mission designer: Laggy<br/><br/>Mission version: 0.92<br/><br/>Mission uses SIDE respawn, so you can use teamswitch in SP and MP.<br/><br/>Known bugs: The Simple Support Module (airstrikes, supplies etc.) don't work at all on a dedicated server. Ambient Civilians Module doesn't spawn anything on a dedi either as far as I know.<br/><br/>I hope BIS will fix this, since these modules are otherwise a great addition to the game.<br/><br/>Hope you enjoy the mission."]];
player createDiaryRecord["Diary",["Friendly Forces","<br/>You can call in supply drops, reinforcements and airstrikes through your communications menu (Space bar).<br/><br/>The UAV is also a great asset.<br/><br/>The Simple Support Module is still bugged, see Author's Info"]];
player createDiaryRecord["Diary",["Enemy Forces","<br/>Expect trained Takistani Forces and scattered Insurgents.<br/><br/>The mountains should be quite safe, but most of the roads are patrolled by the Takistani Army."]];
player createDiaryRecord["Diary",["HMMWV SOV","<br/>Your HMMWV SOV is a helpful tool behind enemy lines and has some interesting functions which can be accessed through the action menu.<br/><br/>You can create a camp for your team, where you will find weapons, a tent and camoflage cover.<br/><br/>The HMMWV SOV also acts as a UAV terminal, from which you can scout the terrain and mission areas. The UAV is currently circling the village of <marker name='uavmark'>Chak Chak</marker>, but as soon as you use the terminal you can change its flight pattern."]];
player createDiaryRecord["Diary",["Situation","<br/>You are a combined NATO Special Forces Team (Callsign: Stalker).<br/><br/>You are being sent behind enemy lines in central Takistan to perform sabotage, assassinations and to gather intel. You will be alone on hostile ground for quite a while, with no one to trust but yourselves.<br/><br/>A CH-47F Chinook(Callsign: Icarus) will drop you off one click <marker name='start'>South</marker> of Sar-e Sang pass. There you will recieve an updated briefing and continue by land. A HMMWV SOV has also been dropped for your disposal.<br/><br/>Good Luck!"]];

tskObj1 = player createSimpleTask ["Land and get updated briefing."];
tskObj1 setSimpleTaskDescription ["<br/>Land at the <marker name='start'>Insertion Point</marker>, get your updated briefing, board the HMMWV SOV and get on your way.","Land and get updated briefing.","Land and get updated briefing."];
player setCurrentTask tskObj1;

sleep 0.1;

player createDiaryRecord["Diary",["Updated Briefing", "<br/>Three Missions:<br/><br/>1. A mobile SCUD Launcher has been reported in the <marker name='scudmarker'>Central Parts</marker> of Takistan. Your mission is to detroy it. The SCUD is most likely guarded by Takistani Forces and well camoflaged to not be seen from the air. Destroy the SCUD to complete the task.<br/><br/>2. Colonel Aziz is one of the major players, without him the Takistani Forces will be demoralized and crippled. Intel reports say that he is travelling in a BLACK SUV between this <marker name='badguymark1'>Air Base</marker> and the <marker name='badguymark2'>Mosque</marker> in Bastam. Your mission is to assassinate him. Kill Aziz and confirm his death to complete the task.<br/><br/>3. Al Qaida is running an insurgent training camp in the <marker name='campmarker'>Eastern Mountains</marker>. The leader of this camp also has vital information on other Al Qaida activities, namely a map. The camp must be wiped out and the map retrieved. Clear the camp and take the map to complete the task.<br/><br/>IMPORTANT: A map doeas not survive a Laser Guided Bomb."]];

tskObj5 = player createSimpleTask ["Move to Exfiltration Point."];
tskObj5 setSimpleTaskDescription ["<br/>When all your tasks are done, you will move to the <marker name='start'>Exfiltration Point</marker> and call in your helo pickup.","Move to Exfiltration Point.","Move to Exfiltration Point."];

tskObj4 = player createSimpleTask ["Clear Al Qaida Camp and take the Map."];
tskObj4 setSimpleTaskDescription ["<br/>Kill everyone in the Al Qaida training camp located in the <marker name='campmarker'>Eastern Mountains</marker>, search the body of the leader for a map, you are looking for the weapon ""Evidence (Map)"".","Clear Al Qaida Camp and take the Map.","Clear Al Qaida Camp and take the Map."];

tskObj3 = player createSimpleTask ["Assassinate Colonel Aziz."];
tskObj3 setSimpleTaskDescription ["<br/>Find a good spot to take out Colonel Aziz, who is commuting between the <marker name='badguymark1'>Air Base</marker> and the <marker name='badguymark2'>Mosque</marker>, you are looking for a BLACK SUV and a man with a Golden Gun, wearing a black beret.","Assassinate Colonel Aziz.","Assassinate Colonel Aziz."];

tskObj2 = player createSimpleTask ["Destroy mobile SCUD Launcher."];
tskObj2 setSimpleTaskDescription ["<br/>Find and destroy the SCUD, which is located in the <marker name='scudmarker'>Central Parts</marker>.","Destroy mobile SCUD Launcher.","Destroy mobile SCUD Launcher."];

tskObj1 setTaskState "SUCCEEDED";

player setVariable ["tskObj2", tskObj2];
player setVariable ["tskObj3", tskObj3];
player setVariable ["tskObj4", tskObj4];
player setVariable ["tskObj5", tskObj5];

if (! isNil "onedone") then {tskObj2 setTaskState "SUCCEEDED"};
if (! isNil "twodone") then {tskObj3 setTaskState "SUCCEEDED"};
if (! isNil "threedone") then {tskObj4 setTaskState "SUCCEEDED"};
if (! isNil "alldone") then {tskObj5 setTaskState "SUCCEEDED"};

The key is to put:

player setVariable ["tskObj2", tskObj2];
player setVariable ["tskObj3", tskObj3];
player setVariable ["tskObj4", tskObj4];
player setVariable ["tskObj5", tskObj5];


In the briefing

And for example put:

{(_x getVariable "tskObj2") setTaskState "SUCCEEDED"} forEach BriefedUnits

In the global triggers

Laggy
« Last Edit: 22 Aug 2010, 13:08:01 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.