Jump to content
Sign in to follow this  
laggy

teamSwitch and briefing updates...

Recommended Posts

Okay, still haven't tried the debug console, but this mission structure is very simple and it should be quite clear what happens and what doesn't work.

A unit that has been played, teamSwitched away from and then teamSwitched back to, does NOT get their tasks ticked off as succeeded when the variables are broadcasted during the mission, they remain empty black boxes instead of turning green. Please note that you DO get the hints and radio messages, so there is no problem with the triggers.

init.sqf

BriefedUnits = [];
nil = execVM "briefing.sqf";

TeamSwitchTrigger:

Repeatedly
Condition: ! (player in BriefedUnits)
On Activation: nil = execVM "briefing.sqf"

Example of Task Trigger:

Condition: ! (alive scud)
On Activation: tskObj2 setTaskState "SUCCEEDED"; hint "SCUD Launcher destroyed."; onedone = true; publicVariable "onedone"; leader heroes groupRadio "ra1"

briefing.sqf

waitUntil {!(isNull player)};

BriefedUnits = BriefedUnits + [player];

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;

sleep 0.5;

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";

while {true} do {
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"};
sleep 1;
};

The same script is run in init as in the trigger used for teamSwitch.

IF scripts are not stopped/terminated on units that have been played but are not currently played, then why the hell don't the tasks get ticked off properly for them. The same update solution is used on every kind of unit AND I even tick it off in the trigger that WORKS.

On units that have not been played the tasks get ticked of when they are teamSwitched to. It seems to work really well. The same goes for if you never teamSwitch.

Either I should stop bothering you guys on this forum, because I'm a hopeless case, or there is a bug or something unrecorded at work here.

What happens to a script that is run on a unit/player when that unit is teamSwitched away from? In one way it seems like the script is attached to the actual unit in game, in another way it seems the script is run on the player, no matter what unit he plays. I'm very confused, does anyone have a simple example mission to share, one that deals with updated briefing and teamSwitching?

Thanks for your patience, I'm loosing day after day finishing my mission with this XXXX.

Laggy

Edited by laggy

Share this post


Link to post
Share on other sites

You override the task handle.

You set tskObj2 to Succeded. What is tskObj2? It is an task handle for the last unit to "get briefed". Eg.:

You start out as unit A

You run briefing; get notes and task for unit A.

You set tskObj2 to the task handle for the SCUD for unit A

You switch to unit B

You run briefing; get notes and task for unit B.

You set tskObj2 to the task handle for the SCUD for unit B

Task is completed you set tskObj2 to succeded. tskObj2 is unit B's Scud task.

You never set unit A's task handle to completed.

Another way is to store the tasks on the players using setVariable? Then you set it completed for all units in the trigger.

When you add briefing:

tskObj2 = player createSimpleTask ["Destroy mobile SCUD Launcher."];
player setVariable ["tskObj2", tskObj2];

When you trigger (The scud is gone or whatever):

//Instead of this part:
tskObj2 setTaskState "SUCCEEDED";
//You do something like this:
{(_x getVariable "tskObj2") setTaskState "SUCCEDED";} forEach BriefedUnits;

Share this post


Link to post
Share on other sites

Thanks a lot (mange takk) !

That was completely unknown to me, will try this asap.

Kind regards,

Laggy

---------- Post added at 03:08 PM ---------- Previous post was at 02:54 PM ----------

EDIT: It works beautifully, thanks a million !

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  

×