Jump to content
Sign in to follow this  
panicsferd

How to end a mission, with failure text and briefing when the player is killed?

Recommended Posts

What I would like to know how to do is make it so that when the player is killed on this mission that I'm working on it will not go to the death screen where you load/restart and to then have the mission fail with the briefing and whatnot.

 

A thing I would like to have happen would be to have it once the player dies and before the end briefing scene would happen would be for my credits to roll for my mission (this mission would be the last mission of my campaign)

 

I tried messing with the onPlayerKilled.sqf or onPlayerKilled.sqs but I don't seem to doing it correctly or don't know what I'm doing and when I die while in the editor it locks Arma 3 completely up and I have to task manager exit it.

Share this post


Link to post
Share on other sites

To avoid editing the death screen, you could try using the dammaged event handler to check if the damage would kill the player. If it were fatal then you'd player enableDamage false and roll the credits.

Share this post


Link to post
Share on other sites

To avoid editing the death screen, you could try using the dammaged event handler to check if the damage would kill the player. If it were fatal then you'd player enableDamage false and roll the credits.

It looks like using that will work, I will have to tweak with the number I use for the damage... since with testing it in the editor it works better if the player if pretty far from the enemy, if it is more close range then the player dies and then it goes to the regular death screen.

 

as of now I have it set, at .45, I will just have to tweak with the values...

 

Also if other people want to know how to do the syntax it is here below:

this addEventHandler ["Dammaged", {if ((_this select 2) >= .45) then {p1 allowdamage false; p1 setCaptive true; nul = [] execVM "credits.sqf";};}];

What this code would do is when the player as damaged greater than .45 it will then make it so he is set as a captive (so the enemy would stop shooting) then it will make it so the player can't be damaged anymore.

 

I placed this in my unit p1's init field.

Share this post


Link to post
Share on other sites

It looks like using that will work, I will have to tweak with the number I use for the damage... since with testing it in the editor it works better if the player if pretty far from the enemy, if it is more close range then the player dies and then it goes to the regular death screen.

 

as of now I have it set, at .45, I will just have to tweak with the values...

 

Also if other people want to know how to do the syntax it is here below:

this addEventHandler ["Dammaged", {if ((_this select 2) >= .45) then {p1 allowdamage false; p1 setCaptive true; nul = [] execVM "credits.sqf";};}];

What this code would do is when the player as damaged greater than .45 it will then make it so he is set as a captive (so the enemy would stop shooting) then it will make it so the player can't be damaged anymore.

 

I placed this in my unit p1's init field.

It should be _this select 2 >= 1 - damage player, imo. Still, it's a not good solution to your problem, just a workaround.

Share this post


Link to post
Share on other sites

It should be _this select 2 >= 1 - damage player, imo. Still, it's a not good solution to your problem, just a workaround.

After searching I found another way to do it, that seems to work a lot better.

 

I found a way to make it so that the player can be damaged, but he can't be killed.

 

Then with using my above script from above I have it set at _this select 2 >=.95 and with the added script from below it seems to work perfectly; whereas, the player can still be damaged but not damaged enough where he will die before the first code is called.

 

I have both of these placed in my players init.

this addEventHandler ["HandleDamage", 
  { 
  _dam = _this select 2; 
  if (_dam > 0.95) then {_dam = 0.9}; 
  _dam 
  }];
  • Like 1

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  

×