Jump to content
Sign in to follow this  
-ami- mofo

Help with stay in revive script line

Recommended Posts

Hi guys I'll just point out that know basically nothing about scripting so I'm just trying to piece this together from bits n pieces and I don't even know if it's possible.

 

I'm using the apex BIS revive in the editor for a MultiPlayer co-op mission and would like it if once players went into revive mode that they'd stay there ie- can't be killed (setting menu options to basic doesn't prevent death).

 

I'm trying to use an event handler, so far I have this in my mission init.sqf file..

{
_x addEventHandler ["HandleDamage", {null = [] execVM "revive.sqf";}]
}foreach allunits;

which I think is correct.

 

 

Then I have a script file called revive.sqf with this...

if (lifeState (_this select 0) == "INCAPACITATED") then {
		0
	};
}];

Which I think may be the problem why it doesn't work but not being a scripter I don't know what I need to change to (hopefully) get it to work.

 

 

If anyone can do some adjusting or whatever to get it functioning I'd be really greatful.

 

Thanks

Share this post


Link to post
Share on other sites


{

    _x addEventHandler ["Dammaged", {

    

        params ["_unit", objNull, [objNull]];

        

            if (lifeState _unit == "INCAPACITATED") then {

                

                _unit allowDamage false;

                

                null = [_unit] spawn {

                

                    params ["_guy"];

                    waitUntil {sleep 5; lifeState _guy != "INCAPACITATED"};

                    _guy allowDamage true;

                

                };

            };

    }];

} forEach (if (isMultiplayer) then {playableUnits} else {switchableUnits});

Share this post


Link to post
Share on other sites

Thanks David,

 

I've not had a chance to see whether this works or not because for some reason nothing at all in my mission init.sqf seems to be working. Odd because the same init.sqf (minus your script) worked a few months ago when I last hosted a coop game on my machine for me and a few friends.

Does it look ok?

 

if (!isServer && (player != player)) then
{
 waitUntil {player == player};
 waitUntil {time > 10};
 };
 
 
 
{
    _x addEventHandler ["Dammaged", {
    
        params ["_unit", objNull, [objNull]];
 
        
            if (lifeState _unit == "INCAPACITATED") then {
                
                _unit allowDamage false;
                
                null = [_unit] spawn {
                
                    params ["_guy"];
                    waitUntil {sleep 5; lifeState _guy != "INCAPACITATED"};
                    _guy allowDamage true;
                
                };
 
            };
 
    }];
} forEach (if (isMultiplayer) then {playableUnits} else {switchableUnits});
 
 
 
 
enableRadio false;
enableSentences false;
 
 
 
setViewDistance 2000;
 
 

 

Share this post


Link to post
Share on other sites

oh this will be definitely wrong.

 

try this instead

enableRadio false;
enableSentences false;
setViewDistance 2000;

 if (hasInterface) then {

	player addEventHandler ["Dammaged", {
    
        params ["_unit"];
 
        
            if (lifeState _unit == "INCAPACITATED") then {
                
                _unit allowDamage false;
                
                null = [_unit] spawn {
                
                    params ["_guy"];
					
			waitUntil {sleep 1; lifeState _guy != "INCAPACITATED" || isNull _guy || !alive _guy};
						
			if (!isNull _guy && alive _guy) then {
				_guy allowDamage true;
			};
                };
 
            };
 
	}];
};

Share this post


Link to post
Share on other sites

Thanks David.

 

I still can't even try this because my init.sqf file won't work on multiplayer (only singleplayer). But I had several other missions that worked a few months ago that won't work now either. I haven't changed a thing on them, they've just stopped working. Besides reinstalling arma I don't know what else to do. BIS haven't changed the way init.sqf files work have they?

Share this post


Link to post
Share on other sites

why do you try so complicated ?

 

use the new revive system from Bohemia !

 

here you will find a template using the new revive: https://forums.bistudio.com/topic/195106-bohemia-interactive-revive-template/

 

kind regards

 

maquez [Q-Net]

 

note:

using

ReviveUnconsciousStateMode = 0;         //0: basic, 1: advanced, 2: realistic

they can't die until they bleed out

 

from wiki:

Basic is the least-harsh preset. Damage received is calculated in the same way as is in vanilla, non-modded Arma 3. The defining difference is that the player will always enter the incapacitated state when they would otherwise be killed.

Share this post


Link to post
Share on other sites

read my note :)

and set:

ReviveBleedOutDelay = 180;              //unconscious state duration (in secs)

to a very high value... like = 999; ?

 

problem solved :rolleyes:

Share this post


Link to post
Share on other sites

Thanks Maquez, I downloaded it but it wouldn't extract without errors and I ended up with nothing in all the files. Have you got anywhere else I can download it from please?

 

Also even if this works I still have the problem of my mission init.sqf file only working in single player.

Can someone please do me a small favour.. below is a link to a mission I made about a year back which worked perfectly in co op multiplayer. But now the init.sqf file isn't working and in fact none of the triggered .sqf files seem to be working either.

This is driving me crazy as I don't know why nothing .sqf will work in MP.

Can someone please d/l it, stick it in ur missions file, open it in ur editor, save it to MP missions and then try it? If it's working you should get some text come up on ur screen within a few seconds of the mission start. 

If it works for you then it may suggest I need to reinstall arma. If it doesn't work for you then I have no idea lol.

http://www.freespace.com.au/filehosting/620008

Share this post


Link to post
Share on other sites

Everythings working fine guys. Really stupid mistake I was saving as MP rather than exporting to MP. That's why none of the .sqf stuff was working  :rolleyes:  :rolleyes:

 

Marquez I've used some of your script for weapon sway / recoil (with a slight tweak) & stamina off / walk off. But not the revive bit as adjusting the revive bleed out delay still doesn't stop players from being killed.

 

For that I've used David's script to keep players in revive mode and not dying until their bleed out time runs out in which case they're out anyway. Didn't want to use any respawn. So I've got exactly what I want now, thanks guys :) .

 

init.sqf now looks like this and works perfectly in multiplayer...

enableRadio false;
enableSentences false;
setViewDistance 3000;


//player stamina and sway disable script
player enableFatigue false;
player enableStamina false;
player forceWalk false;
player allowSprint true;

//Turn off stupid stamina
if (hasinterface) then {
	waitUntil {!isnull player};
	player enableStamina false;
	player addEventHandler ["Respawn", {player enableStamina false}];
};

//Turn off stupid forcewalk
if (hasinterface) then {
	waitUntil {!isnull player};
	player forceWalk false;
	player addEventHandler ["Respawn", {player forceWalk false}];
};

// Custom Weapon Sway & Recoil
player setCustomAimCoef 0.1;
player setUnitRecoilCoefficient 0.3;

 if (hasInterface) then {

	player addEventHandler ["Dammaged", {
    
        params ["_unit"];
 
        
            if (lifeState _unit == "INCAPACITATED") then {
                
                _unit allowDamage false;
                
                null = [_unit] spawn {
                
                    params ["_guy"];
					
			waitUntil {sleep 1; lifeState _guy != "INCAPACITATED" || isNull _guy || !alive _guy};
						
			if (!isNull _guy && alive _guy) then {
				_guy allowDamage true;
			};
                };
 
            };
 
	}];
};

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  

×