Jump to content
Sign in to follow this  
lawman_actual

Stop "Death Menu" appearing when player is killed

Recommended Posts

Hi all

I'm developing a mission where it doesn't matter who the player is.

When the player is killed I want them to be switched to another unit, which I figure I can achieve having spotted the Select Player function

However, I don't want the player to be switched instantaneously.

Ideally I'm thinking a brief pause of maybe 4 or 5 seconds to take in what's happened, then something like "Patching you through to....[unit]" comes over the radio and you switch.

So how do I achieve that 4-5 second pause without the menu being displayed.

You know...that one that pops up when you die that says who killed you and lets you load/switch etc.

How do I stop that?

Many thanks,

Lawman

PS. this is currently being developed for single player only

---------- Post added at 20:35 ---------- Previous post was at 19:19 ----------

I sort of figured it out;


if (isPlayer deceased) then {

_casualty = deceased;
deceased = nil;

selectPlayer hqunit;
_cam = "Land_HandyCam_F" createVehicleLocal [0,0,0];
_cam hideObject true;
_cam attachTo [_casualty, [0,0,4]];
_cam setVectorUp [0,0.99,0.01];
_cam switchCamera "Internal";


sleep 2.5;

base = [west, "HQ"];
base sideChat "Patching you through to Alpha";

sleep 2.5;

selectPlayer dag1a1;
player switchCamera "INTERNAL";
deleteVehicle _cam;


execVM "respawni.sqf";



} else {

deceased = nil;


execVM "respawni.sqf";

};

The above script relies on switching to a random officer I have placed on the other side of the map (to stop him being killed) called hqnit when the player is killed.

This stops the screen being displayed.

As soon as this happens I switch the camera back to the unit that has just been killed (with the camera height at 4m, looking down over the unit - it's a nice touch!)

This happens so fast the player never even sees the random officer

After the timer the new unit is switched and the camera returned to normal.

The only problem with this seems to be that sideChat isn't showing up when the camera is focused on the deceased unit

Edited by Lawman_Actual

Share this post


Link to post
Share on other sites

Seems like you need to get a killed eventhandler and then switch them to a camera or straight ahead to the unit, while the transition goes on in the foreground.

Share this post


Link to post
Share on other sites

Yes, the above code is actuated by a killed event handler

I've been struggling to set variables using the event handler though

Ideally I need to do two things when the unit is killed;

1) Remove the unit killed from an array of 'playable units'

2) execute script

i've tried various formats but I just can't get the two happening at once

One example I was toying with looked something like this:

this addEventHandler ["killed", [{deceased = this}, {null = [] execVM "unitkia.sqf";}]];

It rejected this though, telling me the event handler wouldn't take an array.

I tried adding two separate event handlers but doing this the first one, which set the variable deceased = this; didn't seem to have an effect.

Share this post


Link to post
Share on other sites

The second argument can only be code, so you'd have to make it into a single piece of code. Just separate the lines with ;, as such:

this addEventHandler ["killed", {deceased = this; null = [] execVM "unitkia.sqf";}];

As for the problem with "this". "this" is a reserved variable, but it's null anywhere not in the init field. When you add an event handler, it runs some code, but it's separate from the init field. Luckily you can get the object the event handler is assigned to, in most cases with "_this select 0". "_this" being an array with some arguments to the event handler.

There's a long list of descriptions of the event handlers here https://community.bistudio.com/wiki/Arma_3:_Event_Handlers

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  

×