Jump to content
  • 0

Static guns help


Bambit

Question

Hey.

So I put together a script that allows deploying a static gun (it's a mix of 3 deploy bike scripts). But I wanted to make it a bit more realistic, so I chose "BAF_GPMG_Minitripod_W" as a model, for it is the same as m240 scope. Same ammo, same looks.
But there is one problem with this model.
Along our "pack a gun" option, there's also system "disassemble" option, which turns the gun into 2 backpacks.

If someone is using the gun and I click "pack a gun" it simply spits the user out (I'm a beginer with coding in arma and don't know how to make a check if the vehicle is occupied).
But using "disassemble" option traps the user inside and there's nothing to be done when it happens.

Is there any way to turn this system "disassemble" option off (aside from probably messing with Arma files)?

Thanks for the help :)
 

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

right ;D

didn't think it would be neccesarry as it's (i think) more of Arma kind of feature, not script based.

But here it goes

deploy_gun.sqf
 

_maxGuns = 1;
	
	if (isNil "guns_DEPLOYED") then {guns_DEPLOYED = 0;};
	
	if (guns_DEPLOYED > _maxGuns) exitWith {
		_txt = format ["You have built %1 out of a maximum of %2 Static Guns.",guns_DEPLOYED,_maxGuns];
		cutText [_txt,"PLAIN DOWN"];
	};
	
	if (dayz_combat == 1) exitWith {
		_txt = "You can't deploy a static gun while in combat.";
		cutText [_txt, "PLAIN DOWN"];
	};	
	
		_sgaQTY = {_x == "100Rnd_762x51_M240"} count magazines player;
		_sgQTY = {_x == "M240_scoped_EP1_DZE"} count weapons player;
		_smQTY = {_x == "PartGeneric"} count magazines player;
		_mpQTY = {_x == "ItemPole"} count magazines player;
	
	if ((_sgaQTY >= 3) && (_sgQTY >= 1) && (_smQTY >= 1) && (_mpQTY >= 3)) then {
		r_interrupt = false;
		[1,1] call dayz_HungerThirst;
		player playActionNow "Medic";
		player removeMagazine "100Rnd_762x51_M240";
		player removeMagazine "100Rnd_762x51_M240";
		player removeMagazine "100Rnd_762x51_M240";
		player removeMagazine "100Rnd_762x51_M240";
		player removeMagazine "PartGeneric";
		player removeMagazine "ItemPole";
		player removeMagazine "ItemPole";
		player removeMagazine "ItemPole";
		player removeWeapon "M240_scoped_EP1_DZE";
		
		[player,"repair",0,false,10] call dayz_zombieSpeak;
		[player,10,true,(getPosATL player)] spawn player_alertZombies;
		
			sleep 2;
		
		_pos = getPosATL player;
		_object = "BAF_GPMG_Minitripod_W" createVehicle _pos;		
	
			sleep 1;
	
		_object setVariable ["ObjectID", "1", true];
		_object setVariable ["ObjectUID", "1", true];
		_object setVariable ["Deployed", true, true];
		_object setVariable ["DZAI","1",true];
	
			sleep 1;
	
		_object setVariable ["Deployed",true,true];
		_object attachTo [player,[0,2,0]];
	
			sleep 0.01;
		
		detach _object;
		player reveal _object;
	
			sleep 3;
	
		cutText ["You have constructed a static gun", "PLAIN DOWN"];
	
				if (isNil "guns_DEPLOYED") then {guns_DEPLOYED = 1;} else {guns_DEPLOYED = guns_DEPLOYED + 1;};
	
		r_interrupt = false;
		
			sleep 4;
	
		cutText ["WARNING: Deployed static guns DO NOT save after the restart!", "PLAIN DOWN"];
		
	} else {
		_txt = "You need 1x M240 scope, 4x M240 mags, 1x Scrap Metal and 3x Metal Pole to build this.";
		cutText [_txt, "PLAIN DOWN"];
	};

And here's the pack.sqf
 

	if (dayz_combat == 1) exitWith {
			_txt = "You can't pack vehicles while in combat.";
			cutText [_txt, "PLAIN DOWN"];
	};

	if(DZE_ActionInProgress) exitWith { cutText ["Packing already in progress." , "PLAIN DOWN"]; };
	DZE_ActionInProgress = true;
	
	_obj = _this select 3;

	if (((damage _obj) > 0.8) || !(canMove _obj)) exitWith {
			cutText ["This "+typeOf _obj+" is too damaged to pack.","PLAIN DOWN"];
	};

	_objPos = getPosATL _obj;

	player removeAction s_player_packOBJ;
		_sfx = "repair";
	[player,_sfx,0,false,5] call dayz_zombieSpeak;
	
			cutText ["Packing started", "PLAIN DOWN"];
	
	[1,1] call dayz_HungerThirst;
	player playActionNow "Medic";
	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 {
	_iPos = getPosATL _obj;
	_radius = 1;
	_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
	deleteVehicle _obj;	
	_item addMagazineCargo ["ItemPole", 3]; 
	_item addWeaponCargo ["M240_scoped_EP1_DZE", 1];
	_object setPos _pos;

			cutText [format["You have packed your static gun. Some parts have been refunded. Ammo has scattered about on the ground and you can't pick it up."], "PLAIN DOWN"];
	
	r_interrupt = false;
} else {
	r_interrupt = false;
	player switchMove "";
	player playActionNow "stop";
	cutText ["Canceled packing vehicle", "PLAIN DOWN"];
};

DZE_ActionInProgress = false;
s_player_packVehicle = -1;

Maybe someone could also show me how to make the script check if the player is using a deployed vehicle

The script is based on Maca's right click option, btw.
But I'm not gonna copypaste all of it :D cause the rest of the setup is the same.

Link to comment
Share on other sites

  • 0

Why you are fucking liar? 

 

 

 

(I'm a beginer with coding in arma and don't know how to make a check if the vehicle is occupied).

Oh yeah? You are awesome liar. I know these variables in deploy_gun.sqf.

You stole scripts from www.grof.gr server and you think you are fucking fine guy? They changed all variables because so noobs as you steal their files from mission.pbo on your servers.


Special for you, entered on grof.gr server, downloaded mission.pbo, unpacked, found deploy_gun.sqf and made screenshot as proof on your lies:
jJpBelC.png

Link to comment
Share on other sites

  • 0

ToshioSM be you okays with your brains?
Find a sentence where I wrote that this is MY script, and I wrote it and it's all MINE.

I'll make it easy for you.
I didn't claim I wrote it myself. In fact I clearly stated that:

So I put together a script that allows deploying a static gun (it's a mix of 3 deploy bike scripts)

 

You fucking dumb troll, understand what you read before you post.

Even more, it's still work in progress and I don't intend to show it to anyone. Even more-er I know it's from the live editor, because I used it to learn what's what in Arma coding. Even more-erer, you dumb fuck, that's exactly what I intended to put in here, bacause I did not want to show my work as I'm learning. I simply wanted someone to explain me a few things as it is a 'scripting help' thread.
I could have chosen any other deploy script, but the one from Sandbird's editor was the only one with static guns and was the first that I worked on. 
Weirdly, you didn't mention the pack.sqf, which I also took form Sandbird's editor, but added bits from other scripts that I mentioned below.

Besides I also didn't mention about puting it on any server. I'm learning on Sandbird's editor.

So, if you have something that's valuable and helpful to write in here, please do so, otherwise, bugger off.

But, to make you look even deeper, I'm gonna give you a couple of links that I used to fucking PUT TOGETHER this MIX (and to learn what's what), so you could search and compare it to what I pasted in this topic:


And the third one I don't even know where I found by it was written by a guy called "Player2" on opendayz.net

So yeah, I have one big thank you for Sandbird for releasing his editor, because the deploy addon he put there helped me a lot to understand how it works,

If you plan on calling someone a liar. check you facts first. You did half of your homework, and now apologize, you dirty monkey's butt. For calling me a liar and a thief.

And after you've apologized, explain how do I make the script check if the vehicle is occupied and how (if possible) do I turn the system disassemble option off.

Link to comment
Share on other sites

  • 0

yeah, :P well i added that deploy pack in the editor as an example of how easy it is to load scripts with it...its my fault really that i didnt give credits to the guy who made that deploy script.

But to tell you the truth i have no idea who made it...I've been using that since 1.0.2.5 epoch version and since then i've mixed scripts to the point were i cant tell whats mine or not anymore.lol

 

But about your problem...the gun you select to be packed has 'that' action default in it.Its probably inside the config.bin that it says that i 'has 2 backpacks' etc....i got no idea how to do disable that.

I think i've seen something similar to what you are asking here in the forum....but it was about removing 'addActions' you see when you look at a vehicle...but i am pretty sure the same method would apply here as well.

 

Sorry i cant help with this...and i got no idea how to 'overwrite' this option. :/

Btw i am about to release an update to the 3d.live.mission that include database interaction...so make sure you get that one instead :)

Link to comment
Share on other sites

  • 0

Thanks, Sandbird! :)
Now I know what to look for :)

Sorry, for all the trouble, I didn't expect this to happen. Thanks to your work I started to learn how to code. With normal local server method it would take ages.

I'll make sure to get the new version

You're the best! :D

Link to comment
Share on other sites

  • 0

just a thought, do not give the option to players to repack it, (add a warning saying that it cannot be repacked once deployed) then somehow do it like wasteland and make it so people can pick it up and move it (have to walk)

 

you have already stated that is does not save past a restart, so why would they need to repack it anyway, it would also make people a little more wary to not just place a static gun all over the place and actually think about their actions

Link to comment
Share on other sites

  • 0

Repack is vital, because it gives back some parts.
I have an option in another script to deploy an M2 Machine Gun using:
1x M107
1x UZI
3X Metal Pole
2x Scrap Metal
6x M107 mags

And if I repack it it gives bacK:
1x M107
3x metal pole
3x m107 mags

Since M107 isn't that common and can be set as a loot weapon only, it makes it a rare item, so i would like to give ppl an option to get it back without losing it upon restart.
So I kind of prefer this to be packable.

But the option to drag it wasteland style is a great idea! :)
It makes it a decent addition to defend a base.
I think I might be able to see how it's done in R3F logistics and add their code to the deploy script.

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
  • Advertisement
  • Discord

×
×
  • Create New...