Jump to content
Sign in to follow this  
farside

script conditions - only available when dismounted.

Recommended Posts

I am making a life raft script, i was wondering how i would go about making the action "inflate life raft" only available after ejection, would be even better if it would be only available when swimming, save people from inflating it on land.

any ideas?

Share this post


Link to post
Share on other sites

many thanks, gave it a good search before i started, the swimming state was an after thought tbh.

cheers!

---------- Post added at 16:04 ---------- Previous post was at 15:00 ----------

ok so now i have this as PPE.sqf

private ["_isSwimmingFunction"];

_isSwimmingFunction =

{

private ["_pos", "_isSwimming"];

_pos = position _veh;

_isSwimming = false;

if ((surfaceIsWater _pos) && ((_pos select 2) < 0.5) && (!_isChar || ((animationState player) in ["aswmpercmwlksnonwnondf", "aswmpercmsprsnonwnondf", "aswmpercmrunsnonwnondf", "aswmpercmstpsnonwnondnon", "aswmpercmrunsnonwnondf_aswmpercmstpsnonwnondnon", "aswmpercmstpsnonwnondnon_aswmpercmrunsnonwnondf", "aswmpercmstpdnon", "aswmpercmstpdnon_aswmpercmstpdf", "aswmpercmstpdf_aswmpercmstpdnon", "aswmpercmstpsnonwnondf"]))) then

{

_isSwimming = true;

};

_isSwimming

};

_raft = if (_isSwimming = true) then [{player addAction ["Inflate Liferaft", "liferaft.sqf"]},{}];

but it doesnt create and action, ideas?

Share this post


Link to post
Share on other sites

That was just an example, for you to see how to use the animations for swimming check. You cannot use "as is" - there are local variables in it which you do not use.

Try something like this:

_pos = getpos player;
_SwimAnims = ["aswmpercmwlksnonwnondf", "aswmpercmsprsnonwnondf", "aswmpercmrunsnonwnondf", "aswmpercmstpsnonwnondnon", "aswmpercmrunsnonwnondf_aswmpercmstpsnonwnondnon", "aswmpercmstpsnonwnondnon_aswmpercmrunsnonwnondf", "aswmpercmstpdnon", "aswmpercmstpdnon_aswmpercmstpdf", "aswmpercmstpdf_aswmpercmstpdnon", "aswmpercmstpsnonwnondf"];
if ((surfaceIsWater _pos) && (animationState player) in _SwimAnims) then {
	player addAction ["Inflate Liferaft", "liferaft.sqf"];
};

Share this post


Link to post
Share on other sites

many thanks, working fine now, just gotta run the script on a continual loop and its sorted, thanks!

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  

×