Jump to content
Sign in to follow this  
TheDog

prevent movement

Recommended Posts

hey guys,

ive been going up and down forums and websites and cant figure it out, i want to script it to where the player CAN NOT move but still can use his mouse. disableinput or what it is does not work since it takes out the mouse.

i want to disable a players movement for 30 seconds but still let him use his action menu/ mouse controls. before the mission starts the player spawns and stands still for 30 seconds, he can use his mouse to scroll into his action menu where he will find load out classes for example, rifleman, automatic rifleman etc. once he selects it he receives the loadout after 30 seconds the mission starts.

any ideas around my problem or any pin point solutions?

thanks guys

Dog

Share this post


Link to post
Share on other sites

Hello.

I made a special script. Run for each player you want to freeze. Maintains position, direction and animation before the use of the script .

You can use the Actions menu and the mouse, which always displays a dialog box before activating this script.

Greetings.

*******************************************************************************
// ** * * * Funcion: Freeze.sqf
// ** * Descripcion: Immobilises unit temporarily
// *******************************************************************************
// ** * * * * Autor: RAVEN
// ** * * * * * Use: nil = [name_unit/this, seconds/freeze] execVM "freeze.sqf"
// ** * * * Example: nil = [this, 10] execVM "freeze.sqf"
// *******************************************************************************

private ["_man", "_retro", "_tempo","_pos","_dir","_mov"];

_man = _this select 0;
_retro = _this select 1;

_pos = position _man;
_dir = direction _man;
_mov = animationState _man;

_tempo = (time + _retro);
while {time < _tempo} do
{
   _man setpos _pos;
   _man setdir _dir;
   _man switchmove _mov;
   sleep 0.01;
};

Edited by W0lle

Share this post


Link to post
Share on other sites

wow can you cook? cuz if you can will you marry me? ill try this out first thing tomorrow and let you know how it goes thanks man

EDIT: THIS WORKS PERFECT, thank you so much man :smile_o:

Edited by W0lle

Share this post


Link to post
Share on other sites

Using Nil like this is bad, as Worldeater already mentioned on the wiki:

// ** * * * * * Use: nil = [name_unit/this, seconds/freeze] execVM "freeze.sqf"
// ** * * * Example: nil = [this, 10] execVM "freeze.sqf"

Not sure who first suggested it, but it just causes problems for anyone who wants to use Nil to remove variables.

It's easy enough to create a variable that does not screw up other peoples scripts.

sP=[this, 10] execVM "freeze.sqf"

Edited by UNN

Share this post


Link to post
Share on other sites

I checked this script out, and it worked, except for the fact that if the unit dies, he is still standing up completely still.

Is there a simple way to change that?

I made this "detain" civilian script in sqs, and now that i ported it over to sqf, specificly for this script to work with it, I would like for this script to work well with it.

So please help me out. Thanks.

Good script.

Share this post


Link to post
Share on other sites

Simply check, if the unit is alive.

*******************************************************************************
// ** * * * Funcion: Freeze.sqf
// ** * Descripcion: Immobilises unit temporarily
// *******************************************************************************
// ** * * * * Autor: RAVEN
// ** * * * * * Use: nil = [name_unit/this, seconds/freeze] execVM "freeze.sqf"
// ** * * * Example: nil = [this, 10] execVM "freeze.sqf"
// *******************************************************************************

private ["_man", "_retro", "_tempo","_pos","_dir","_mov"];

_man = _this select 0;
_retro = _this select 1;

_pos = position _man;
_dir = direction _man;
_mov = animationState _man;

_tempo = (time + _retro);
while {alive _man && time < _tempo} do
{
   _man setpos _pos;
   _man setdir _dir;
   _man switchmove _mov;
   sleep 0.01;
};

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  

×