Jump to content

Photo
- - - - -

End mission when player dies


  • Please log in to reply
11 replies to this topic

#1 Janat

Janat

    Corporal

  • Members
  • 94 posts

Posted 05 December 2010 - 12:26 PM

When the player dies in SP mission, I'd want the screen to fade black and then end the mission. Is this possible?

Edited by Janat, 06 December 2010 - 04:54 PM.


#2 MelvinNor

MelvinNor

    Lance Corporal

  • Members
  • 58 posts

Posted 05 December 2010 - 02:35 PM

Hello.

Yes it's possible.

http://forums.bistud...ad.php?t=109926

Kind Regards
Melvin

#3 Janat

Janat

    Corporal

  • Members
  • 94 posts

Posted 05 December 2010 - 02:53 PM

Thanks. But now if I wanted the mission to end only after a certain trigger has been activated, and if player dies before the trigger's been activated the default menu with revert and abort options shows up. Would that be possible?

#4 MelvinNor

MelvinNor

    Lance Corporal

  • Members
  • 58 posts

Posted 05 December 2010 - 02:59 PM

Thanks. But now if I wanted the mission to end only after a certain trigger has been activated, and if player dies before the trigger's been activated the default menu with revert and abort options shows up. Would that be possible?


Hello.

In the trigger you want to have activated first put a variable (ie. cheesecake) true. onAct: cheesecake = true;

then in the ending trigger put

condition: !(alive player) AND cheesecake
or whatever you had there already and add AND cheesecake.

Regards
Melvin

#5 Janat

Janat

    Corporal

  • Members
  • 94 posts

Posted 05 December 2010 - 03:21 PM

Hello.

In the trigger you want to have activated first put a variable (ie. cheesecake) true. onAct: cheesecake = true;

then in the ending trigger put

condition: !(alive player) AND cheesecake
or whatever you had there already and add AND cheesecake.

Regards
Melvin

I did so but the mission doesn't end. You just die normally. There's no debriefing. That's why I came to ask about it here. Though I've only tried it in editor, maybe it indeed works outside of editor? I don't know and can't try right now.

Edited by Janat, 05 December 2010 - 03:23 PM.


#6 MelvinNor

MelvinNor

    Lance Corporal

  • Members
  • 58 posts

Posted 05 December 2010 - 03:50 PM

Hello.

I'm wondering, did you read the other post? Because I think it explains the exact problem you have. Or maybe I didn't understand the post I linked. I think I did though :)

Kind Regards
Melvin

#7 Janat

Janat

    Corporal

  • Members
  • 94 posts

Posted 05 December 2010 - 04:02 PM

I have to admit that I read it very quickly and didn't see all those important bits. Now I think I know how to do it.

#8 Janat

Janat

    Corporal

  • Members
  • 94 posts

Posted 06 December 2010 - 02:05 PM

After experimenting a little bit, I can't get my onPlayerKilled.sqs work properly. I have tried this script:
titleCut ["","BLACK OUT",5]
5 fadeMusic 0
~7
if outroo  then endMission "END1" else enableEndDialog
exit
But regardless of whether "outroo" is true or false, mission ends. I've also tried outroo == true and outroo = true in place of outroo, but none of them work.

On the other hand, this script always gives the revert menu, no matter what "outroo" status is.
enableEndDialog
titleCut ["","BLACK OUT",5]
5 fadeMusic 0
~7
if outroo  then endMission "END1"
exit

Also tried this but it didn't work at all. No dialog what so ever, I had to alt-F4 out of the game.
titleCut ["","BLACK OUT",5]
5 fadeMusic 0
~7
? outroo: endMission "END1"
? !outroo: enableEndDialog
exit


#9 Janat

Janat

    Corporal

  • Members
  • 94 posts

Posted 07 December 2010 - 06:24 AM

No one knows what's wrong with my script?

#10 zwobot

zwobot

    Master Sergeant

  • Members
  • 620 posts

Posted 08 December 2010 - 01:16 PM

I can't verify this in the editor right now but my guess is there are some brackets missing in your if .. then statement:
if (outroo)  then {endMission "END1";}
// maybe you even have to use if {...} instead of if (...) - not sure about the syntax right now

In addition I think you are not supposed to actually use the endMission command. Instead you should use a boolean variable in conjunction with an end trigger in the editor and the variable as condition.

#11 Janat

Janat

    Corporal

  • Members
  • 94 posts

Posted 08 December 2010 - 02:31 PM

I can't verify this in the editor right now but my guess is there are some brackets missing in your if .. then statement:

if (outroo)  then {endMission "END1";}
// maybe you even have to use if {...} instead of if (...) - not sure about the syntax right now

In addition I think you are not supposed to actually use the endMission command. Instead you should use a boolean variable in conjunction with an end trigger in the editor and the variable as condition.

Doesn't work with those brackets either. Also, I now have onPlayerKilled.sqs with execVM "onPlayerKilled.sqf" and onPlayerKilled.sqf with this script:
titleCut ["","BLACK OUT",5];
5 fadeMusic 0;
sleep 7;
if (outroo == false) then {
enableEndDialog;
} else {
endMission "END1";
};
And using it I have to alt-F4 out of the game.

EndMission should work in scripts.

Never mind I got it working using sqs:
titleCut ["","BLACK OUT",5]
5 fadeMusic 0
~7
if outroo then {endMission "LOSER"} else {enableEndDialog}

Also sqf version works too
titleCut ["","BLACK OUT",5];
5 fadeMusic 0;
if outroo then {
sleep 7;
endMission "END1";
} else {
enableEndDialog;
};

Edited by Janat, 08 December 2010 - 02:54 PM.


#12 zwobot

zwobot

    Master Sergeant

  • Members
  • 620 posts

Posted 08 December 2010 - 02:54 PM

Sorry, I might have confused the endMission with forceEnd...