OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: nominesine on 21 Jan 2010, 18:39:48

Title: Embarrasing briefing problem
Post by: nominesine on 21 Jan 2010, 18:39:48
I've encountered a problem with my brifings that I wasn't aware of. I've never encountered them before upgrading to 1.05, but I can't guarantee that they weren't in there to begin with. Well here it goes:

Everytime a unit dies and respawn the tasks and notes vanishes. They work perfectly upon mission start. My briefings are set up the following way:

1) briefing.sqf is started from init.sqf, using the execVM command
2) briefing.sqf then adds the diary entries to the entity player, but not until I've checked that
Code: [Select]
waitUntil { !isNull player }; waitUntil { player == player };
I'm beginning to suspect that I'm making some kind of noob mistake here. That probably means that there's a simple solution to my problem, that I've overlooked. Bear in mind that the briefing works perfectly in SP and at MP startup. It only vanishes after group respawn and teamswitch.
 :dunno:
Title: Re: Embarrasing briefing problem
Post by: JamesF1 on 21 Jan 2010, 18:53:38
Sorry to say this is 'indented behaviour' - you'll have to re-execute (and update task conditions) on respawn.
Title: Re: Embarrasing briefing problem
Post by: nominesine on 21 Jan 2010, 18:54:57
How do I do that?
Title: Re: Embarrasing briefing problem
Post by: JamesF1 on 21 Jan 2010, 18:59:16
First off, re-execute your briefing.sqf file to give the tasks back - then create (and run) a script to check the status of the things that fired the tasks in the first place (e.g. destroyed buildings, etc.) and update the tasks accordingly.
Title: Re: Embarrasing briefing problem
Post by: nominesine on 21 Jan 2010, 19:09:27
It's not just the tasks that vanishes. It's everything that was added from briefing.sqs. i.e notes, objectives, images, etc. So I guess I must run the briefing all over again. With that said, how do I check when a player respawns? Is this trigger the answer???

CON: !(alive player)
ACT: execVM "briefing.sqf";

The problem also appears if I use teamswitch and I don't think that trigger would fire then, would it?
Title: Re: Embarrasing briefing problem
Post by: JamesF1 on 21 Jan 2010, 19:18:36
Well, a simple method would be to run the following on the player at the start:
Code: [Select]
player addEventHandler ["killed", {execVM "respawn.sqf"}];
Then, in "respawn.sqf":
Code: [Select]
waitUntil{alive player};
// Do your re-adding stuff here

I don't really know how to make it work with teamswitch... I've never used it, and so have no idea what (if any) EHs it fires, etc.  I simply use something like the above to re-add briefings/notes/tasks in my missions with respawn enabled.
Title: Re: Embarrasing briefing problem
Post by: Ironman on 21 Jan 2010, 19:21:43
I would imagine you have the same problem with JIPs?
Title: Re: Embarrasing briefing problem
Post by: nominesine on 21 Jan 2010, 19:41:30
Yes indeed, but I figured that if I solve the first problem first, I can solve the second one later  :D

I've managed to solve the JIP problem before. But this one confuses me, since it now appears in missions that I believed was working up until 1.04, but not in 1.05 (I'm about 98% sure they did).
Title: Re: Embarrasing briefing problem
Post by: Ironman on 21 Jan 2010, 20:02:54
Since this is a MP mission do you really have to worry about Team Switching? Since there is respawn it seems quite silly to have Team Switch and in that case the Kill EH should work fine.

I remember when briefings use to be easy.... Oh, OFP/ArmA, how nice you were...

I think this whole briefing script thing is just BS, they should bring it back to HTML, WTH was wrong with HTML? Obviously BIS needs a refreshment course on the KISS method.
Title: Re: Embarrasing briefing problem
Post by: nominesine on 21 Jan 2010, 20:37:12
Since Team Switching can be made available in MP with the respawn "side" option, I wanted it included as well. The reason  that I placed the topic under "general" was that I'm looking for a general solution. Preferably one that works equally well in SP/MP. I agree completely about the Keep it simple statement. I also miss the HTML file.

EDIT: Wit a little help rom Laggy I've found a nearly working solution to the teamswitch problem. There is an onTeamswitch command that makes it possible to run the briefing script all over again a split second after the first briefing is removed. But if I switch then back to the original unit again, every entry in the brifing will show up twice.
Title: Re: Embarrasing briefing problem
Post by: laggy on 22 Jan 2010, 02:30:45
Haven't done any thorough testing, but putting already played units in an array and checking if the new teamswitched unit is in that array seems to work, no doubling of briefing.

init.sqf or similar:
Code: [Select]
BriefedUnits = []; BriefedUnits = BriefedUnits + [player]
trigger or script:
Code: [Select]
onTeamSwitch {if (! (player in BriefedUnits)) then {execVM "briefing.sqf"; BriefedUnits = BriefedUnits + [player]}}
Works well in editor, haven't tried MP/host/dedi yet.

Not sure if the briefing gets doubled if another player has already played the unit, so maybe the BriefedUnits array needs to be PV'd.

Laggy
Title: Re: Embarrasing briefing problem
Post by: sharkattack on 10 Jul 2010, 14:37:45
Seems your not the only one to fall victim nominesine

I never had this issue previously as i would disable all AI.
With my latest mission attempt id like to have the team switch option available should it be played in SP mode
and group respawn options when played in multi player.  Can anyone confirm if the below code works on a dedicated server. Seems to be just the job for single player .

best wishes shark-attack