Jump to content
  • 0

[HELP] Need help tweaking my deploy script a little bit.


DangerRuss

Question

Im using a version of right click deploy bike script, making use of maca's right click system. Anyways I'm trying to do 2 things.

1. Im trying to allow an interrupt which will cancel the build when the player moves. For example if the player is deploying the bike and gets shot at and needs to cancel the build.

2. Currently my deploy script nicely places the bike in front of you. But I have seen servers which attach the buildable to the player, and allows the player to move the buildable into position before placing it.

Obviously the 2 would have to work together, so that moving to place the buildable doesn't cancel the build until you've actually started to build it.

Here is my current deploy script.

_weapons = [currentWeapon player] + (weapons player) + (magazines player);
closeDialog 0;

_toolbox = "ItemToolbox" in _weapons;

if (!_toolbox) then {
    cutText [format["Missing Toolbox"], "PLAIN DOWN"];
} else {
    player removeAction s_player_deploybike;
    player playActionNow "Medic";
    r_interrupt = false;
	player removeWeapon "ItemToolbox";
    	_dis=10;
    	_sfx = "repair";
    	[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    	[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
   	 sleep 6;
	_Offset = [0,5,0]; //change how far from player vehicle spawns
	_worldPos = player modelToWorld _Offset; // spawn in front of player
    _object = "MMT_USMC" createVehicle (_worldPos);
   	_object setVariable ["ObjectID", "1", true];
   	_object setVariable ["ObjectUID", "1", true];
	_object setVariable ["Deployed", "1", true];
 	_degrees = getDir player;
	_object setDir _degrees;
   	 player reveal _object;
 
    	cutText [format["Here's your bike you lazy bum!"], "PLAIN DOWN"];
   	 r_interrupt = false;
   	 player switchMove "";
   	 player playActionNow "stop";
 
    	sleep 10;
 
   	 cutText [format["Warning: Spawned bikes DO NOT SAVE after server restart! If you wish to keep it - deconstruct it!"], "PLAIN DOWN"];
 
	
};

Here is an example of what Im talking about. Although I dont want to use the EVD script which he is using and has modified.

https://www.youtube.com/watch?v=oASs2_RUX88&feature=youtu.be

 

Thanks for any help!

Link to comment
Share on other sites

Recommended Posts

  • 0

the deploy anything script is the one that allows you to move the object  then place it.  you can incorporate any scripts from Macca's script in it as well (instructions included).  You can also do many,many deployables/buildables etc as well, with variables for plot pole requirement or not, re-packable or not,  save to DB or not, etc etc.  Personally it suits my needs/wants much better.  I would highly suggest trying it.

 

 

You could also possibly look through his code to see how the spawning/attaching works as well if it doesn't interest you.

 

Honestly once you use it its a much better package for right clickables and for deploying anything.  

Link to comment
Share on other sites

  • 0

I guess I can't knock it until Ive tried it, but it seems like an overcomplicated abundance of code for my simple needs. I have 4 deployable options and its much less code in my mission file. I'll have a peak through this and see if I can figure it out, but really Im only interested in the ability to cancel and move the object before deployment. Removing ammo, saving to the database, etc. is just extra stuff I dont need.

 

Also I have another script that uses the scroll wheel and utilizes the _vehicle attachTo

but Im really interested in just modifying my existing script.

If anyone could help me that'd be fantastic

Link to comment
Share on other sites

  • 0
_weapons = [currentWeapon player] + (weapons player) + (magazines player);

closeDialog 0;

		cutText ["\n\nDeploying vehicle started... Move from current position to cancel", "PLAIN DOWN"];


		[1,1] call dayz_HungerThirst;
		player playActionNow "Medic";

		[player,"repair",0,false] call dayz_zombieSpeak;
		[player,50,true,(getPosATL player)] spawn player_alertZombies;

		r_interrupt = false;
		_animState = animationState player;
		r_doLoop = true;
		_started = false;
		_finished = false;

		while {r_doLoop} do {
			_animState = animationState player;
			_isMedic = ["medic",_animState] call fnc_inString;
			if (_isMedic) then {
				_started = true;
			};
			if (_started and !_isMedic) then {
				r_doLoop = false;
				_finished = true;
			};
			if (r_interrupt) then {
				r_doLoop = false;
			};
			sleep 0.1;
		};
		r_doLoop = false;

		if (_finished) then {
_toolbox = "ItemToolbox" in _weapons;

if (!_toolbox) then {
    cutText [format["Missing Toolbox"], "PLAIN DOWN"];
} else {
    player removeAction s_player_deploybike;
    player playActionNow "Medic";
    r_interrupt = false;
	player removeWeapon "ItemToolbox";
    	_dis=10;
    	_sfx = "repair";
    	[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    	[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
   	 sleep 6;
	_Offset = [0,5,0]; //change how far from player vehicle spawns
	_worldPos = player modelToWorld _Offset; // spawn in front of player
    _object = "MMT_USMC" createVehicle (_worldPos);
   	_object setVariable ["ObjectID", "1", true];
   	_object setVariable ["ObjectUID", "1", true];
	_object setVariable ["Deployed", "1", true];
 	_degrees = getDir player;
	_object setDir _degrees;
   	 player reveal _object;
 
    	cutText [format["Here's your bike you lazy bum!"], "PLAIN DOWN"];
   	 r_interrupt = false;
   	 player switchMove "";
   	 player playActionNow "stop";
 
    	sleep 10;
 
   	 cutText [format["Warning: Spawned bikes DO NOT SAVE after server restart! If you wish to keep it - deconstruct it!"], "PLAIN DOWN"];
 
	
};
} else {
	cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
};

Here is an interupt code taken from Trading script

 

For Attaching, just use

_object attachTo player;
Link to comment
Share on other sites

  • 0

I do like the control the deploy anything script gives you, being able to move it like you're base building, however it breaks the extra_rc.hpp for some reason and I have the set view distance option in that which isn't an actual script so I can't call it in the deploy anything script. I'll play around with both and see what happens. Thanks.

Link to comment
Share on other sites

  • 0
_weapons = [currentWeapon player] + (weapons player) + (magazines player);

closeDialog 0;

		cutText ["\n\nDeploying vehicle started... Move from current position to cancel", "PLAIN DOWN"];


		[1,1] call dayz_HungerThirst;
		player playActionNow "Medic";

		[player,"repair",0,false] call dayz_zombieSpeak;
		[player,50,true,(getPosATL player)] spawn player_alertZombies;

		r_interrupt = false;
		_animState = animationState player;
		r_doLoop = true;
		_started = false;
		_finished = false;

		while {r_doLoop} do {
			_animState = animationState player;
			_isMedic = ["medic",_animState] call fnc_inString;
			if (_isMedic) then {
				_started = true;
			};
			if (_started and !_isMedic) then {
				r_doLoop = false;
				_finished = true;
			};
			if (r_interrupt) then {
				r_doLoop = false;
			};
			sleep 0.1;
		};
		r_doLoop = false;

		if (_finished) then {
_toolbox = "ItemToolbox" in _weapons;

if (!_toolbox) then {
    cutText [format["Missing Toolbox"], "PLAIN DOWN"];
} else {
    player removeAction s_player_deploybike;
    player playActionNow "Medic";
    r_interrupt = false;
	player removeWeapon "ItemToolbox";
    	_dis=10;
    	_sfx = "repair";
    	[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    	[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
   	 sleep 6;
	_Offset = [0,5,0]; //change how far from player vehicle spawns
	_worldPos = player modelToWorld _Offset; // spawn in front of player
    _object = "MMT_USMC" createVehicle (_worldPos);
   	_object setVariable ["ObjectID", "1", true];
   	_object setVariable ["ObjectUID", "1", true];
	_object setVariable ["Deployed", "1", true];
 	_degrees = getDir player;
	_object setDir _degrees;
   	 player reveal _object;
 
    	cutText [format["Here's your bike you lazy bum!"], "PLAIN DOWN"];
   	 r_interrupt = false;
   	 player switchMove "";
   	 player playActionNow "stop";
 
    	sleep 10;
 
   	 cutText [format["Warning: Spawned bikes DO NOT SAVE after server restart! If you wish to keep it - deconstruct it!"], "PLAIN DOWN"];
 
	
};
} else {
	cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
};

Here is an interupt code taken from Trading script

 

For Attaching, just use

_object attachTo player;

This cancels the build but doesn't stop the animation which is what I was really going for.

Perhaps I added the attachTo incorrectly but there is no visual of the bike until after it has been deployed, so you can't see where you're placing it.

Link to comment
Share on other sites

  • 0

It is just doing what you have scripted ;)

 

there is no command for the script to wait till the player got everything done before deploying:

 

Try somehting like this:

_weapons = [currentWeapon player] + (weapons player) + (magazines player);

closeDialog 0;


_toolbox = "ItemToolbox" in _weapons;

if (!_toolbox) then {
    cutText [format["Missing Toolbox"], "PLAIN DOWN"];
} else {
	_Offset = [0,5,0]; //change how far from player vehicle spawns
	_worldPos = player modelToWorld _Offset; // spawn in front of player
    _object = "MMT_USMC" createVehicle (_worldPos);
   	_object setVariable ["ObjectID", "1", true];
   	_object setVariable ["ObjectUID", "1", true];
	_object setVariable ["Deployed", "1", true];
	_object attachTo player;
 	_degrees = getDir player;
	_object setDir _degrees;
	player removeAction s_player_deploybike;
    
    r_interrupt = false;
	//press space to proceed
	waitUntil {DZE_5};
	
	player playActionNow "Medic";
	cutText ["\n\nDeploying vehicle started... Move from current position to cancel", "PLAIN DOWN"];


		[1,1] call dayz_HungerThirst;
		player playActionNow "Medic";

		[player,"repair",0,false] call dayz_zombieSpeak;
		[player,50,true,(getPosATL player)] spawn player_alertZombies;

		r_interrupt = false;
		_animState = animationState player;
		r_doLoop = true;
		_started = false;
		_finished = false;

		while {r_doLoop} do {
			_animState = animationState player;
			_isMedic = ["medic",_animState] call fnc_inString;
			if (_isMedic) then {
				_started = true;
			};
			if (_started and !_isMedic) then {
				r_doLoop = false;
				_finished = true;
			};
			if (r_interrupt) then {
				r_doLoop = false;
			};
			sleep 0.1;
		};
		r_doLoop = false;
		
	if (_finished) then {
    
	player removeWeapon "ItemToolbox";
    	_dis=10;
    	_sfx = "repair";
    	[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    	[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
   	 sleep 6;
	
   	 player reveal _object;
 
    	cutText [format["Here's your bike you lazy bum!"], "PLAIN DOWN"];
   	 r_interrupt = false;
   	 player switchMove "";
   	 player playActionNow "stop";
 
    sleep 10;
	//this way every player will get the message from a deployed bike
	_object addEventHandler ["GetIn",{
			_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: Spawned bikes DO NOT SAVE after server restart! If you wish to keep it - deconstruct it!","PLAIN DOWN",5] call RE;
		}];
   	
 
	
};
} else {
	cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
};

Not teste, but you should get the idea :)

Link to comment
Share on other sites

  • 0

It is just doing what you have scripted ;)

 

there is no command for the script to wait till the player got everything done before deploying:

 

Try somehting like this:

_weapons = [currentWeapon player] + (weapons player) + (magazines player);

closeDialog 0;


_toolbox = "ItemToolbox" in _weapons;

if (!_toolbox) then {
    cutText [format["Missing Toolbox"], "PLAIN DOWN"];
} else {
	_Offset = [0,5,0]; //change how far from player vehicle spawns
	_worldPos = player modelToWorld _Offset; // spawn in front of player
    _object = "MMT_USMC" createVehicle (_worldPos);
   	_object setVariable ["ObjectID", "1", true];
   	_object setVariable ["ObjectUID", "1", true];
	_object setVariable ["Deployed", "1", true];
	_object attachTo player;
 	_degrees = getDir player;
	_object setDir _degrees;
	player removeAction s_player_deploybike;
    
    r_interrupt = false;
	//press space to proceed
	waitUntil {DZE_5};
	
	player playActionNow "Medic";
	cutText ["\n\nDeploying vehicle started... Move from current position to cancel", "PLAIN DOWN"];


		[1,1] call dayz_HungerThirst;
		player playActionNow "Medic";

		[player,"repair",0,false] call dayz_zombieSpeak;
		[player,50,true,(getPosATL player)] spawn player_alertZombies;

		r_interrupt = false;
		_animState = animationState player;
		r_doLoop = true;
		_started = false;
		_finished = false;

		while {r_doLoop} do {
			_animState = animationState player;
			_isMedic = ["medic",_animState] call fnc_inString;
			if (_isMedic) then {
				_started = true;
			};
			if (_started and !_isMedic) then {
				r_doLoop = false;
				_finished = true;
			};
			if (r_interrupt) then {
				r_doLoop = false;
			};
			sleep 0.1;
		};
		r_doLoop = false;
		
	if (_finished) then {
    
	player removeWeapon "ItemToolbox";
    	_dis=10;
    	_sfx = "repair";
    	[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    	[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
   	 sleep 6;
	
   	 player reveal _object;
 
    	cutText [format["Here's your bike you lazy bum!"], "PLAIN DOWN"];
   	 r_interrupt = false;
   	 player switchMove "";
   	 player playActionNow "stop";
 
    sleep 10;
	//this way every player will get the message from a deployed bike
	_object addEventHandler ["GetIn",{
			_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: Spawned bikes DO NOT SAVE after server restart! If you wish to keep it - deconstruct it!","PLAIN DOWN",5] call RE;
		}];
   	
 
	
};
} else {
	cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
};

Not teste, but you should get the idea :)

 

Without trying this right away I see this

//press space to proceed
waitUntil {DZE_5};

what about if Im not running this on epoch/overpoch?

Link to comment
Share on other sites

  • 0

well then you need to use use a custom dayz_spaceinterrupt.sqf (located in dayZ_code/actions)

and define your own key to deploy the bike: https://community.bistudio.com/wiki/DIK_KeyCodes

 

 

then you can add something like this in it:

if (_dikCode == 0x39) then {
	deploybike = true;
};

and replace the DZE_5 variable with the deploybike variable.

 

also you should add at the top of your deploybike script every variable on the default value, like deploybike on false, just to keep the RPT nice and clean

Link to comment
Share on other sites

  • 0

well then you need to use use a custom dayz_spaceinterrupt.sqf (located in dayZ_code/actions)

and define your own key to deploy the bike: https://community.bistudio.com/wiki/DIK_KeyCodes

 

 

then you can add something like this in it:

if (_dikCode == 0x39) then {
	deploybike = true;
};

and replace the DZE_5 variable with the deploybike variable.

 

also you should add at the top of your deploybike script every variable on the default value, like deploybike on false, just to keep the RPT nice and clean

I think my compiles.sqf handles the dik codes I'll have to check. I'll play with this some more later.

Not sure what you mean about the variables at the top, although I dont think I get any rpt errors from these

Link to comment
Share on other sites

  • 0

this should do the trick: (line 1)

DZE_5 = false; //or whatever you would like to call this variable ;)

_weapons = [currentWeapon player] + (weapons player) + (magazines player);

closeDialog 0;


_toolbox = "ItemToolbox" in _weapons;

if (!_toolbox) then {
    cutText [format["Missing Toolbox"], "PLAIN DOWN"];
} else {
	_Offset = [0,5,0]; //change how far from player vehicle spawns
	_worldPos = player modelToWorld _Offset; // spawn in front of player
    _object = "MMT_USMC" createVehicle (_worldPos);
   	_object setVariable ["ObjectID", "1", true];
   	_object setVariable ["ObjectUID", "1", true];
	_object setVariable ["Deployed", "1", true];
	_object attachTo player;
 	_degrees = getDir player;
	_object setDir _degrees;
	player removeAction s_player_deploybike;
    
    r_interrupt = false;
	//press space to proceed
	waitUntil {DZE_5};
	
	player playActionNow "Medic";
	cutText ["\n\nDeploying vehicle started... Move from current position to cancel", "PLAIN DOWN"];


		[1,1] call dayz_HungerThirst;
		player playActionNow "Medic";

		[player,"repair",0,false] call dayz_zombieSpeak;
		[player,50,true,(getPosATL player)] spawn player_alertZombies;

		r_interrupt = false;
		_animState = animationState player;
		r_doLoop = true;
		_started = false;
		_finished = false;

		while {r_doLoop} do {
			_animState = animationState player;
			_isMedic = ["medic",_animState] call fnc_inString;
			if (_isMedic) then {
				_started = true;
			};
			if (_started and !_isMedic) then {
				r_doLoop = false;
				_finished = true;
			};
			if (r_interrupt) then {
				r_doLoop = false;
			};
			sleep 0.1;
		};
		r_doLoop = false;
		
	if (_finished) then {
    
	player removeWeapon "ItemToolbox";
    	_dis=10;
    	_sfx = "repair";
    	[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    	[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
   	 sleep 6;
	
   	 player reveal _object;
 
    	cutText [format["Here's your bike you lazy bum!"], "PLAIN DOWN"];
   	 r_interrupt = false;
   	 player switchMove "";
   	 player playActionNow "stop";
 
    sleep 10;
	//this way every player will get the message from a deployed bike
	_object addEventHandler ["GetIn",{
			_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: Spawned bikes DO NOT SAVE after server restart! If you wish to keep it - deconstruct it!","PLAIN DOWN",5] call RE;
		}];
   	
 
	
};
} else {
	cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
};
Link to comment
Share on other sites

  • 0

Im just not sure/unable to tie in all of this information you're giving me because I dont understand how to code :-\

 

for example where in the script do I define the dik code and do I somehow attach it to that DZE_5 variable or w/e I choose to name it?

 

For example in my compiles.sqf this is the dik code for DZGM

		if (_dikCode == 0xDB) then {
		if (tagName) then {tagName = false;titleText ["Group name tags OFF","PLAIN DOWN"];titleFadeOut 4;} else {tagName = true;titleText ["Group name tags ON","PLAIN DOWN"];titleFadeOut 4;};
		_handled = true;
		};

  I just dont know how to put it all together.

Link to comment
Share on other sites

  • 0

ok i will try to explain this with my broken english as good as i can ^^

 

on this page:

https://community.bistudio.com/wiki/DIK_KeyCodes

 

you've got every key defined with a dikcode:

e.g.

0x39 = Space

0xDB = Left Win_key

 

so you just need to choose a key which will then needs to be pressed to deploy the bike.

 

then in your dayz_spaceinterrupt.sqf you simply add some code which look something like this:

if (_dikCode == 0x39) then {
    deploybike = true;
};

see you need to press space to set the variable deploybike to true.

you can call this vairable whatever you want! deploybike, DZE_5, dangerbike, oldbikeruss, etc

 

only thing you need to keep in mind is to name the same variable in the deploybike.sqf which it should be waiting for, till the key was pressed.

 

so the code should be working like this:

 

  • start code
  • define variable to false which should be waiting for
  • check for toolbox
  • spawn the bike
  • attach to player
  • wait till the variable (deploybike, DZE_5 or whatever) will be set to true, through pressing the key you have defined
  • do the animations
  • send some text
  • deploy bike
  • done

Also i think you need to add a delete vehicle option if the animation process is not finished or else players could just start the process, but if they interrupt it, they would still got the bike attached to them ^^

Link to comment
Share on other sites

  • 0

ok i will try to explain this with my broken english as good as i can ^^

 

on this page:

https://community.bistudio.com/wiki/DIK_KeyCodes

 

you've got every key defined with a dikcode:

e.g.

0x39 = Space

0xDB = Left Win_key

 

so you just need to choose a key which will then needs to be pressed to deploy the bike.

 

then in your dayz_spaceinterrupt.sqf you simply add some code which look something like this:

if (_dikCode == 0x39) then {
    deploybike = true;
};

see you need to press space to set the variable deploybike to true.

you can call this vairable whatever you want! deploybike, DZE_5, dangerbike, oldbikeruss, etc

 

only thing you need to keep in mind is to name the same variable in the deploybike.sqf which it should be waiting for, till the key was pressed.

 

so the code should be working like this:

 

  • start code
  • define variable to false which should be waiting for
  • check for toolbox
  • spawn the bike
  • attach to player
  • wait till the variable (deploybike, DZE_5 or whatever) will be set to true, through pressing the key you have defined
  • do the animations
  • send some text
  • deploy bike
  • done

Also i think you need to add a delete vehicle option if the animation process is not finished or else players could just start the process, but if they interrupt it, they would still got the bike attached to them ^^

Ok this makes some more sense but what Im confused about, is defining that variable DZE_5 or whatever I name it. How will the script know what DZE_5 is?  The script says wait for DZE_5, but the spaceinterrupt doesn't mention DZE_5 whatsoever. So how does the script know that waiting for DZE_5 to set to true = spawn the bike. 

Or are you saying that in the space interrupt

if (_dikCode == 0x39) then {
    deploybike = true;
};

deploybike  is the variable and needs to be the same in the deploy bike script?

Link to comment
Share on other sites

  • 0

No joy

DZE_5 = false; //or whatever you would like to call this variable ;)

_weapons = [currentWeapon player] + (weapons player) + (magazines player);

closeDialog 0;


_toolbox = "ItemToolbox" in _weapons;

if (!_toolbox) then {
cutText [format["Missing Toolbox"], "PLAIN DOWN"];
} else {
    _Offset = [0,5,0]; //change how far from player vehicle spawns
    _worldPos = player modelToWorld _Offset; // spawn in front of player
_object = "Old_bike_TK_INS_EP1" createVehicle (_worldPos);
    _object setVariable ["ObjectID", "1", true];
    _object setVariable ["ObjectUID", "1", true];
    _object setVariable ["Deployed", "1", true];
    _object attachTo player;
    _degrees = getDir player;
    _object setDir _degrees;
    player removeAction s_player_deploybike;

r_interrupt = false;
    //press space to proceed
    waitUntil {DZE_5};
    
    player playActionNow "Medic";
    cutText ["\n\nDeploying vehicle started... Move from current position to cancel", "PLAIN DOWN"];


        [1,1] call dayz_HungerThirst;
        player playActionNow "Medic";

        [player,"repair",0,false] call dayz_zombieSpeak;
        [player,50,true,(getPosATL player)] spawn player_alertZombies;

        r_interrupt = false;
        _animState = animationState player;
        r_doLoop = true;
        _started = false;
        _finished = false;

        while {r_doLoop} do {
            _animState = animationState player;
            _isMedic = ["medic",_animState] call fnc_inString;
            if (_isMedic) then {
                _started = true;
            };
            if (_started and !_isMedic) then {
                r_doLoop = false;
                _finished = true;
            };
            if (r_interrupt) then {
                r_doLoop = false;
            };
            sleep 0.1;
        };
        r_doLoop = false;
        
    if (_finished) then {

    player removeWeapon "ItemToolbox";
    _dis=10;
    _sfx = "repair";
    [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    [player,_dis,true,(getPosATL player)] spawn player_alertZombies;

     sleep 6;
    
     player reveal _object;

    cutText [format["Here's your bike you lazy bum!"], "PLAIN DOWN"];
     r_interrupt = false;
     player switchMove "";
     player playActionNow "stop";

sleep 10;
    //this way every player will get the message from a deployed bike
    _object addEventHandler ["GetIn",{
            _nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: Spawned bikes DO NOT SAVE after server restart! If you wish to keep it - deconstruct it!","PLAIN DOWN",5] call RE;
        }];
    

    
};
} else {
    cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
};

 

Added the dik code to the compiles.sqf

dayz_spaceInterrupt = {
		private "_handled";
		_dikCode = _this select 1;
		_shiftState = _this select 2;
		_ctrlState = _this select 3;
		_altState = _this select 4;
		_handled = false;

		// Disable ESC after death (not sure if needed but it's here to make sure)
		if (_dikCode == 0x01 && r_player_dead) then {
			_handled = true;
		};

		switch (_dikCode) do {
			case 0x02: {
				["rifle"] spawn player_switchWeapon;
				_handled = true;
			};
			case 0x03: {
				["pistol"] spawn player_switchWeapon;
				_handled = true;
			};
			case 0x04: {
				["melee"] spawn player_switchWeapon;
				_handled = true;
			};
			default {
				if (_dikCode in [0x58,0x57,0x44,0x43,0x42,0x41,0x40,0x3F,0x3E,0x3D,0x3C,0x3B,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05]) then {
					_handled = true;
				};
			};
		};
		if (_dikCode == 0xDB) then {
		if (tagName) then {tagName = false;titleText ["Group name tags OFF","PLAIN DOWN"];titleFadeOut 4;} else {tagName = true;titleText ["Group name tags ON","PLAIN DOWN"];titleFadeOut 4;};
		_handled = true;
		};
		
		if (_dikCode == 0x39) then {
		deploybike = true;
		};

 

Scroll wheel option appears, nothing happens when you press deploy.

 

No server RPT errors, gonna check client RPT.

Client RPT has this error but its intermixed with an autorefuel error so idk if its related


};
} else {
cutText ["\n\nCanceled deploying >
  Error position: <else {
cutText ["\n\nCanceled deploying >
  Error else: Type Array, expected code
File mpmissions\__CUR_MP.Chernarus\deploys\bike\deploy.sqf, line 85
Link to comment
Share on other sites

  • 0

almost!

 

you define a variable in the spaceinterrupt, then you let the deploy bike wait for this variable to become true.

 

so if you have this:

if (_dikCode == 0x39) then {
		deploybike = true;
		};

then you need to have the variable "deploybike" in your deploy bike script and not DZE_5 ;)

Link to comment
Share on other sites

  • 0

I apologize for copy pasting the wrong code earlier.

I do indeed have that variable in the script and the script does not work.

No bike deploys when you press the option.

deploybike = false; //or whatever you would like to call this variable ;)

_weapons = [currentWeapon player] + (weapons player) + (magazines player);

closeDialog 0;


_toolbox = "ItemToolbox" in _weapons;

if (!_toolbox) then {
    cutText [format["Missing Toolbox"], "PLAIN DOWN"];
} else {
	_Offset = [0,5,0]; //change how far from player vehicle spawns
	_worldPos = player modelToWorld _Offset; // spawn in front of player
    _object = "Old_bike_TK_INS_EP1" createVehicle (_worldPos);
   	_object setVariable ["ObjectID", "1", true];
   	_object setVariable ["ObjectUID", "1", true];
	_object setVariable ["Deployed", "1", true];
	_object attachTo player;
 	_degrees = getDir player;
	_object setDir _degrees;
	player removeAction s_player_deploybike;
    
    r_interrupt = false;
	//press space to proceed
	waitUntil {deploybike};
	
	player playActionNow "Medic";
	cutText ["\n\nDeploying vehicle started... Move from current position to cancel", "PLAIN DOWN"];


		[1,1] call dayz_HungerThirst;
		player playActionNow "Medic";

		[player,"repair",0,false] call dayz_zombieSpeak;
		[player,50,true,(getPosATL player)] spawn player_alertZombies;

		r_interrupt = false;
		_animState = animationState player;
		r_doLoop = true;
		_started = false;
		_finished = false;

		while {r_doLoop} do {
			_animState = animationState player;
			_isMedic = ["medic",_animState] call fnc_inString;
			if (_isMedic) then {
				_started = true;
			};
			if (_started and !_isMedic) then {
				r_doLoop = false;
				_finished = true;
			};
			if (r_interrupt) then {
				r_doLoop = false;
			};
			sleep 0.1;
		};
		r_doLoop = false;
		
	if (_finished) then {
    
	player removeWeapon "ItemToolbox";
    	_dis=10;
    	_sfx = "repair";
    	[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    	[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
   	 sleep 6;
	
   	 player reveal _object;
 
    	cutText [format["Here's your bike you lazy bum!"], "PLAIN DOWN"];
   	 r_interrupt = false;
   	 player switchMove "";
   	 player playActionNow "stop";
 
    sleep 10;
	//this way every player will get the message from a deployed bike
	_object addEventHandler ["GetIn",{
			_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: Spawned bikes DO NOT SAVE after server restart! If you wish to keep it - deconstruct it!","PLAIN DOWN",5] call RE;
		}];
   	
 
	
};
} else {
	cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
};

Link to comment
Share on other sites

  • 0

here you go:

DZE_5 = false; //or whatever you would like to call this variable ;)

_weapons = [currentWeapon player] + (weapons player) + (magazines player);

closeDialog 0;


_toolbox = "ItemToolbox" in _weapons;

if (!_toolbox) then {
		cutText [format["Missing Toolbox"], "PLAIN DOWN"];
	} else {
		_Offset = [0,5,0]; //change how far from player vehicle spawns
		_worldPos = player modelToWorld _Offset; // spawn in front of player
		_object = "Old_bike_TK_INS_EP1" createVehicle (_worldPos);
		_object setVariable ["ObjectID", "1", true];
		_object setVariable ["ObjectUID", "1", true];
		_object setVariable ["Deployed", "1", true];
		_object attachTo [player,[-0.2, 5, 1]];		

		waitUntil {DZE_5};
		
		player playActionNow "Medic";
		cutText ["\n\nDeploying vehicle started... Move from current position to cancel", "PLAIN DOWN"];


			[1,1] call dayz_HungerThirst;
			player playActionNow "Medic";

			[player,"repair",0,false] call dayz_zombieSpeak;
			[player,50,true,(getPosATL player)] spawn player_alertZombies;

			r_interrupt = false;
			_animState = animationState player;
			r_doLoop = true;
			_started = false;
			_finished = false;

			while {r_doLoop} do {
				_animState = animationState player;
				_isMedic = ["medic",_animState] call fnc_inString;
				if (_isMedic) then {
					_started = true;
				};
				if (_started and !_isMedic) then {
					r_doLoop = false;
					_finished = true;
				};
				if (r_interrupt) then {
					r_doLoop = false;
				};
				sleep 0.1;
			};
			r_doLoop = false;
			
		if (_finished) then {
		
		player removeWeapon "ItemToolbox";
			_dis=10;
			_sfx = "repair";
			[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
			[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
	 
			detach _object;
		 
	 
			cutText [format["Here's your bike you lazy bum!"], "PLAIN DOWN"];
		 r_interrupt = false;
		 player switchMove "";
		 player playActionNow "stop";
	 
		sleep 10;
		//this way every player will get the message from a deployed bike
		_object addEventHandler ["GetIn",{
				_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: Spawned bikes DO NOT SAVE after server restart! If you wish to keep it - deconstruct it!","PLAIN DOWN",5] call RE;
			}];
		
	 
		
		}
		else {
		cutText ["\n\nCanceled deploying vehicle", "PLAIN DOWN"];
		};
};

test it and customize it to your likings

Link to comment
Share on other sites

  • 0

Works, you're the man Schwede!

 

I do have some slight concerns because the script doesn't appear to be designed for the scroll wheel, which is how Im using it. It doesn't seem to have anywhere that removes the action from the scroll wheel. I'll have to test further to see if this is an issue. In my original script

if (false) then {
    cutText [format["You are in combat and cannot build a 350z."], "PLAIN DOWN"];
} else {
    player removeAction s_player_350z;
    closeDialog 602;
    player removeWeapon "ItemToolbox";
	player removeMagazine "PartEngine";
    player removeMagazine "PartGeneric";
    player playActionNow "Medic";

Also, if you move to cancel, it doesn't remove the bike from your player lol :P

you can however repack it, which gives you a toolbox. So if you place your toolbox in your backpack, you can get infinite toolboxes :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...