Jump to content

Recommended Posts

I'm a bit annoyed right now, because this stuff took me way more time already than I wanted to spend on it...

 

What I'm trying to do is a custom death screen for my singleplayer mission. So far so easy, right? Just that no matter what I do, I can't get it to work...

 

Here is what I've tried:

Empty onPlayerKilled.sqs in the mission folder. Has no effect. Empty onPlayerKilled.sqf has no effect either. It does register, however, as my hint "test"; gets triggered. It's just that the menu comes up right after.

 

Then I tried the BI approach from the vanilla campaign, which is basically this:

class CfgRespawnTemplates
{
    // Class used in respawnTemplates entry
    class None
    {
        // Function or script executed upon death. Parameters passed into it are the same as are passed into onPlayerKilled.sqf file
        onPlayerKilled = "rsc\playerKilled.sqf";
    };
};

 

This works *partly* ... The menu won't show up anymore, but instead my game will freeze (ui won't shows up no matter what).

 

Is there anything I'm missing? The forum search mostly gives me old threads which boil down to "use onPlayerKilled", which as I've written above, doesn't seem to work.

Share this post


Link to post
Share on other sites
(finddisplay 46) createdisplay "RscDisplayMissionEnd";
_display = finddisplay 58;
(_display displayctrl 1060) ctrlsetfade 1;
(_display displayctrl 1060) ctrlCommit 0;

At least, you can open up the death screen with these commands. This is interesting to do, I am still working on it but later. I have to sleep now...

Share this post


Link to post
Share on other sites

It's been a long time since I coded this same thing so I cant remember the details you need for this but here is my code I used, hope it helps:

 

in onPlayerKilled.sqf:

 

_group = createGroup civilian;
_newPlr = _group createUnit ["B_Soldier_F", getmarkerpos "rp", [], 0, "NONE"];
selectPlayer _newPlr;

 

The reason for this code is so that the mission doesn't end...

 

then you just add your respawn code.

Share this post


Link to post
Share on other sites

^ this kinda works, but it's all so quick. Dead -> Bam, new character. I've added some sleep, but because the main menu pops up after about 3 seconds, you can only have a sleep of ~2.x and I'm not sure how fail-proof that is (is it the same time on every computer?).

 

I've also found this in a 2014 thread:

 

Couldn't get this to work, though, as I have no idea how exactly to handle call. :D Still I guess the outcome would be similar.

 

Honestly, I guess the best and least hacky thing would be to get it done the BI-way, but I have no idea how they made it work.

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

×