[Help/Discussion] Spectre's Knockout/Revive

V 1.0 has a few bugs that I'm working on. In the meantime, to revive someone correctly use a bloodbag and THEN epi-pen. As is the epi-pen doesn't give blood so you'll be knocked back out if your blood doesn't go above 1k right away. I'll have a fix for the epi-pen soon.
 
Alright sorry about that, modified medEpi.sqf added to Revive folder in github. The new medEpi sets blood at 1050 to avoid being knocked out after epi-pen is used. Make sure to change your compiles.sqf to point to the new medEpi.

V 1.1 is now 100% functional, may be some more bugs to work out as we test more. Please let me know if you have any comments/complaints and I'll get to work right away.

Side note, this is my first script ever so please be gentle with any feedback, and I hope you enjoy my work!
 
V 1.5
If you have either of the older versions please be sure to get rid of all your old files and download all of the new ones from github. See original instructions for how to add execute.

Changes:
Added execute option. A player approaching another player in a coma has to option to execute them if they have a knife.
Humanity change for executing is as follows;
Hero -1000
Survivor -500
Bandit +250
These number are easily changed as well as the output text upon execution.

Bugs Fixed:
Can no longer load an unconscious player into a vehicle(upon exiting they would be invulnerable)
Crashing a vehicle and dropping below 95 health will now kill you(upon exiting they would be invulnerable)
players will no longer randomly recover from unconsciousness and be able to shoot while remaining invisible and invulnerable (yeah terrible bug, hard to replicate FIXED NOW HOORAY!)

If you encounter any of the above bugs or any other bugs PLEASE let me know the exact circumstances right away so I can fix it!!!
 
Hey, I'm using DZAI mod that adds AI players to fight as well. Sometimes when you gun them down, they'll still be alive but incapacitated (or in shock - I'm not sure.) Is there a way I can adapt this script (the player_execute only) to be able to execute the AI players (or any players as well) while they're incapacitated or in shock? Also, do you need all the other files just to use the execute function (just paste the code snippet in the player actions and just have the player_execute.sqf in the /Revive/ folder?) or does that code rely on other files too?
 
You most certainly do not need the other files to use execute, it relies solely on the player being below 100 health and also unconscious. You could modify these conditions to meet any purpose, for example player being unconscious, prone, infected, really anything you might think of. As far as using it on AI I don't know, I suppose you could take out the _isMan section of the conditions for it in fn_selfactions.sqf and it might work for AI. I'd suggest adding the player_execute section of the selfactions file and also Player_execute.sqf and giving it a try, removing any conditions that might exclude AI. If you want it to work for sure leave only the part about blood being under 100 (maybe change to below 2500 or so for testing) and them being unconscious and scour any AI related files for something relating to AI and add that into the condition. I'd like to be more helpful for your instance but I don't use DZAI so there's not much I can do but speculate. Also I am currently drunk so I'm sorry if somethign I just said makes little to no sense :) I'll review this in the sober light of tomorrow. :)
 
Alright, I took out the "_isMan &&" section out, and removed the blood condition entirely (I have no idea what the blood level is set to on the AI, so the way I see it, if they're downed, they're vulnerable to being finished off anyway). I was looking to use this since the AI seems invincible when they're incapacitated from gunfire so I have to sit and wait for them to start to get up before I finish them off. Does the "_uncon" refer to the character being incapacitated, in shock, or both? I ask because I have no idea what's happening to the AI when they're on the ground like that, so I'd like or cover all the bases here.

I'll give it a shot with what I did though and let you know. I looked through a couple of the AI files and I don't see anything I can use in the conditional, but I don't know much about it to begin with I suppose. Thanks for the help, though, I'll see how this works out.

EDIT: Nope, still nothing. I have them on the ground unconscious and I don't get the action to Execute even if I'm right on top of them with a hunting knife in the tool belt. Here's how I edited it:

In player_execute.sqf
Code:
if (_uncon && _hasKnife) then {

In fn_selfActions.sqf
Code:
 if (_isAlive and !_isZombie and !_isAnimal and _unconscious and _hasKnife and _canDo and (player distance cursorTarget < 3)) then {

So I figure I have one more way to do it. I guess I can take out the "_uncon" part and just have a low blood conditional. I guess since I'm just playing LAN with a couple friends and AI, I don't have to execute anything but AI. I'm thinking the AI isn't actually meeting the _uncon condition, since the only conditions for the menu option to come up is being unconscious and having a knife. If I take that condition out and replace it with a blood one instead (it looks like it takes the script 8 seconds to kill the target, so they'd have to be unconscious anyway to be so close for that long) then it should work, in theory. I guess it should serve its purpose at least, unless there's another state besides _uncon to have in the conditional that would work.

Assuming I go that route, that would also mean I can use it on another player by accident if they're alive and below that health limit... If I added !_isMan as a condition, then I would not be able to use it on players, correct? (Then my concern is, if the AI counts as a player... but that would take testing.) Or is there a better check I can have instead that means I can't use it on human players? Otherwise, maybe we can try something else besides _uncon that the AI might be using. I'll have to look around in the DZAI files some more.

EDIT 2: Might have found something in dayz_server\dzai\init\dzai_functions.sqf:

Code:
//Knocks an AI unit unconscious for 10 seconds - determines the correct animation to use, and returns unit to standing state after waking.
DZAI_unconscious = {
private ["_unit","_anim"];
_unit = _this select 0;
 
if ((animationState _unit) in ["amovppnemrunsnonwnondf","amovppnemstpsnonwnondnon","amovppnemstpsraswrfldnon","amovppnemsprslowwrfldf","aidlppnemstpsnonwnondnon0s","aidlppnemstpsnonwnondnon01"]) then {
_anim = "adthppnemstpsraswpstdnon_2";
} else {
_anim = "adthpercmstpslowwrfldnon_4";
};
_unit switchMove _anim;
_nul = [objNull, _unit, rSWITCHMOVE, _anim] call RE;
//diag_log "DEBUG :: AI unit is unconscious.";
 
sleep 10;
 
_nul = [objNull, _unit, rSWITCHMOVE, "amovppnemrunsnonwnondf"] call RE;
_unit switchMove "amovppnemrunsnonwnondf";
//diag_log "DEBUG :: AI unit is conscious.";
_unit setVariable ["unconscious",false];
};

Maybe that'll help, especially the "DZAI_unconscious" and "_unit". Or maybe not, I just saw this and it stuck out, haha.

EDIT 3: Okay, removing the "_uncon" let me "execute" things. ...Everything, even loot piles, vehicles, and entire buildings. So just having a low blood level is not enough, there has to be some check that it's a person. Maybe I'll put back the "_isMan" condition with this and see what it does.

EDIT 4: (Last one for now) So it does let me execute the AI players whether they're unconscious or up fighting if I use the _isMan and _Blood checks. I guess I can either lower the blood level requirement, or if there's a check for the AI being unconscious we can use, it's good enough then.
 
What _uncon does is checks for the state of unconsciousness, which I think (without looking at the scripts) is Nornn_unconscious or somesuch. However, the script that makes the AI "unconscious" doesn't actually give them that state, it just changes their animation so they appear unconscious and can't move. You can try adding a check for the animation state into the condition in selfactions. If that doesn't work you could try adding the unconscious state to the ai, or possibly just a random variable but I think you might have to declare a public variable for that.

if ((animationState cursorTarget) in ["adthppnemstpsraswpstdnon_2","adthpercmstpslowwrfldnon_4]) then {
AI_unc = true}else{
AI_unc = false};

if (AI_unc and _isAlive and !_isZombie and !_isAnimal and _hasKnife and _canDo and (player distance cursorTarget < 3)) then {


Since you only want to use it for AI you can leave out the blood check and can try removing all the other checks as well if you'd like, the animation state most likely only happens to the AI and nothing else so execute wont show up for anything else I think.

Oh, I should also mention, make sure to take out the blood and _uncon checks from execute as well, leave in only _hasKnife.
 
Okay, I think that did it. When they're knocked down on the ground (the script says it lasts 10 seconds), I can sprint up and the Execute command does show up.

Well, it takes 5 seconds to execute and they're downed for 10. I'm gonna drop the time to execute to about 2, and boost the time they're unconscious to about 20 which should be enough time to do it. I didn't get to do a complete execution without them waking up yet, but I can confirm that the action does show only when they're downed. So far so good, so I imagine it works. Thanks!
 
Actually, I have one last question (more of a general thing). So I've added several scripts to my Cherno Epoch server. I added the DayZChernarusMissions script (runs well so far), the Self Bloodbag, your Execute script, and a Take Clothes script. I fiddled around and got the missions script working well on the server, but now it seems like Self Bloodbag, Take Clothes, and Execute no longer function. Is there a way to check for incompatibilities? Also, does it really matter where in the fn_playerActions.sqf the codes go? I always put them where the authors state to, but is exact placement really necessary?
 
From my experience those things stop working when something gets messed up in selfactions, double check everything to make sure all your brackets {are closed} also (close these) [these] "and these" and that every line ends with ;
As always backup your file by making a copy first.

As for the placement it's hard to say, I haven't been doing this for very long so I'm no where near an expert. I think the main differences in placement are timing and which variables they access, as I said I'm not sure though.

The 8 second wait is simply so the animation finishes around the same time they are actually executed, for aesthetic purposes only. Remove the sleep to make it instant, I'd suggest removing the animation as well so it doesn't look funky.
 
I'm having some problems using this script with the latest version of Epoch.

I've merged these files with my "custom" folder, and pointed the files to that folder instead of "Revive", including the self action scripts, and it just doesn't work. Either A: you die. or B: get incapacitated and have no option to suicide or Epi. After resetting myself to "Alive" in the database I am then invulnerable, and the screen is greyed out.

I had this working in default DayZ and Overwatch, and I can't for the life of me figure out how why this isn't really working all of a sudden now in Epoch.

I've been able to init, SAR AI, self bloodbags, and repair refuel scripts without any issues.

Should I just point everything to the "Revive" folder instead of "custom" and move those modified files to "Revive" instead?

Any advice would be appreciated.
 
I'd suggest using a program like notepad ++ opening all the relevant files and doing a search for "revive" it's entirely possible you missed a line somewhere. If you can't find any then try to add it again without changing any directories. Unfortunately I have no experience with Epoch so it is possible that it isn't compatible, I'm sorry if that's the case. If anyone else has experience with it and could help out that'd be great.
 
Alright, well to start off I do use N++, and I HAD thought that I made all the relevant edits, however I'll admit it is entirely possible that I missed something somewhere, I'll have another go at it this weekend perhaps when I should have more time.

Another thought I just had was if there is some kind of anti-cheat that could be blocking parts of the script from running. So I guess I'll have to look into that also.

And second, well, I guess I'll try not changing any directories if I can help it. I however do use a custom self interactions, and compiles file(s) already, so I'll have to do some merging or re-directing. Not necessarily an issue however. I hope.

I really like this script since my group is primarily a coop oriented group so this adds a dynamic to dayZ that we all really enjoy instead of having to necessarily respawn.

I'll try again using the default directories for your scripts and see what I can come up with.

Also, if it is possible, provided that I can't seem to get this to quite work, that you would be willing to double check my mission file?

Thank you for your response.
 
Yes I would be happy to take a look at it, if you would please double check your files first. Usually when I can't get something to work I take a break and come back to it only to find a simple typo somewhere or some small mistake. As for the anti-hack, I use the free version of Blur's anti-hack and had no issues with it, I can't think of any parts that would case issue but it's possible I suppose. Go ahead and post a link to your mission.pbo and I'll take a look. I'm glad you enjoy it, I worked very hard on it and have gotten basically no feed back from anyone.
 
Alright, I've had no luck. I lose a bunch of blood and perma-incap, and do not get the option for suicide.

Would you please take a look at my mission file for me? I tried doing a merge with the existing/epoch files that I already have edited that correspond with the ones that you've modified, and otherwise kept your revive folder structure the same.

Here's the DB link for the current version of my mission file with your files added: https://www.dropbox.com/s/uvqcbyclqx5da6d/DayZ_Epoch_11.Chernarus.rar

And the one prior to adding your files:
https://www.dropbox.com/s/cqrm4f7sp84jbls/DayZ_Epoch_11.Chernarus -15th.rar

Note that I extracted the Epoch specific compiles, variables, and fn_selfaction files, and used those as the base for merging in additional code like the SAR-AI, self bloodbagging, zombie nuker for green zones.

I'm sure that I have to be missing something simple, but I'm hitting burnout lately and I really could use a second set of eyes on this one. :(

Thanks!
 
I'm sorry it took so long for me to reply, I hardly ever have any free time. I looked through all your files and You've done a great job of changing the directories and putting everything where it needs to be. I can find no mistakes or errors in any of the files, I'm sorry :( I don't know enough about Epoch to troubleshoot this so I'm afraid there's not much more I can do. The one thing I did notice is that you are using the V1.0 files with execute which was introduced in V1.5. I don't think this should matter but I did update quite a bit between the two versions. I can give no guarantee that it would work but you can try downloading all the files again, changing the directories as needed and all that you did before and trying it again with the V1.5 files. V1.5 has a lot of benefits as well, much less buggy, execute was added and you go down at 100 blood instead of 1000.
 
Hmm.. I could have sworn that I had the latest 1.5 version. Maybe I installed the old version on accident instead.

I guess when I get a chance also I'll have another go at it.

You know, the weird thing is that there's no obvious reason that epoch isn't compatible, or where the issue is with the failure to initialize the scroll menu when incap'd. That's the only thing that doesn't seem to work, which is odd since other mods that modify the scroll menu seem to be working fine without breaking either Epoch, or just not working in and of themselves.

Thanks for looking into things for me!
 
This script actually uses a lot of different variables from a variety of sources so I'm not too surprised. It took me almost a week of non stop work to make it work as it does, I just don't have the ability to test it as thoroughly as I did when I first made it otherwise I could probably fix this for you. I'm sorry friend, as I said try undoing your work and re-doing it with 1.5.
 

First, many thanks to the author for this modification !

If I understand correctly... Now Revive 1.5 Mod. for DayZ Mod. 1.7.7.1
I tried to adapt to the version 1.8.0.3 is working, but hard fell FPS.
I would like to know ...
1 - Will there be an update to 1.8.0.3
2 - How can I add to a state of coma ... a timer for 10-15 minutes after which the player dies...

Thank you
 
Back
Top