Jump to content

Recommended Posts

Hey all, is there any way to place down a specific sniper in game on the ground and have it laying on the ground with the bi-pods being used to hold it up and have it immovable from the ground... I want to be able to use it but I don't want the player to be able to pick it up... And if at all possible have it to where the person must look around before being able to fire it or only able to fire it after a certain amount of time? Kind of like a call of duty type mission if you're familiar like the one shown below... Any and all help is much appreciated, thanks!

 

 

 

sniper%20games%20call%20of%20duty%20mode

  • Like 1

Share this post


Link to post
Share on other sites

only thing i can think of is place the rifle on the ground, set its damage to 1 and disable its simulation so it should stay how you placed it, as for the bipod you may be able to call an animation to deploy it but im not sure. then double click the weapon and in the init of it, make an addaction saying something like use weapon and when its clicked have it execute a .sqf file

this addAction ["use weapon",
{
	usingWepH = [_this select 0, _this select 1] execVM "useWeapon.sqf";
}];

and inside useWeapon.sqf you need to run a loop to continually check for the players stance and force the stance back to prone if the player tries to change it kind of like this. this isnt tested but just a off the head idea so may not work as intended

_weapon = (_this select 0);
_unit = (_this select 1);
_unit addWeapon "class name of weapon to use";

_weapon addAction ["get off weapon",
{
	terminate usingWepH;
	(_this select 1) addWeapon "class name of old weapon";
}];

_unit playActionNow "PlayerProne";

while {alive _unit} do
{
	_stance = stance _unit;
	if (_stance != "PRONE") then
	{
		_unit playActionNow "PlayerProne";
	};
	sleep 0.1;
};

 

  • Like 3

Share this post


Link to post
Share on other sites

^^^ Pretty much where I was going to go with it. I'm stuck on animating the bipod when it's on the ground in groundWeaponHolder, not sure if weaponHolderSimulated would be any different.

Share this post


Link to post
Share on other sites
12 minutes ago, Harzach said:

^^^ Pretty much where I was going to go with it. I'm stuck on animating the bipod when it's on the ground in groundWeaponHolder, not sure if weaponHolderSimulated would be any different.

do you think the animation would be on the item itself or the weapon holder?

Share this post


Link to post
Share on other sites

It would have to be on the item somehow.

Share this post


Link to post
Share on other sites

Also, enableSimulation false on a weaponHolder doesn't seem to make a difference - you can still pick up the weapon.

 

This is an interesting one, I can't imagine it's not possible, but BI is not making it easy!

Share this post


Link to post
Share on other sites
4 minutes ago, Harzach said:

Also, enableSimulation false on a weaponHolder doesn't seem to make a difference - you can still pick up the weapon.

 

This is an interesting one, I can't imagine it's not possible, but BI is not making it easy!

thats not to remove the action to pick it up its just to keep it in place/upright so its not just laying flat on its side. its setting the damage of it to 1 so the weapon is *destroyed* that removes the action but still leaves the weapon there to be seen visually.

Share this post


Link to post
Share on other sites
Just now, gokitty1199 said:

thats not to remove the action to pick it up its just to keep it in place/upright so its not just laying flat on its side. its setting the damage of it to 1 so the weapon is *destroyed* that removes the action but still leaves the weapon there to be seen visually.

 

Ah, I'm in the habit of always attaching "scenery" objects to a common "anchor" object so they can't be moved/knocked over, so I totally overlooked that part of it.

  • Haha 1

Share this post


Link to post
Share on other sites

If you want weaapon to not be on its side, then use setVectorDirandUp to orient the weaponHolder the way you want.

 

I don't think its possible to deploy the bipod if its not in a unit's hands, but it would be nice to be proven wrong.

Share this post


Link to post
Share on other sites

Yeah, placement is easy, it's deploying the bipod (if possible) and handling the player's primary weapon that will take some doing.

Share this post


Link to post
Share on other sites

Yup. I've been playing around with it for some time now, not having any luck. I suppose one could spawn a bipod and attach it to the weapon, but that's some high-grade fiddlyness. And it would look bad with weapon with integral bipod, like the GM6.

Share this post


Link to post
Share on other sites
1 hour ago, Harzach said:

Yup. I've been playing around with it for some time now, not having any luck. I suppose one could spawn a bipod and attach it to the weapon, but that's some high-grade fiddlyness. And it would look bad with weapon with integral bipod, like the GM6.

 

1 hour ago, gokitty1199 said:

starting to think its not possible from googling, this is the only thing that comes up and i dont think anything useful can be done with it

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

Thanks for the replies and suggestions guys! Instead of having the bipods deployed, would it be possible to attach it to a low tripod like some of the 50 cal turrets use? This way its usable without being able to be picked up? I don't know, I've fiddled with the idea for like 2 days now but my thoughts and options are just diminishing at this point... 

Share this post


Link to post
Share on other sites
36 minutes ago, socs said:

 

Thanks for the replies and suggestions guys! Instead of having the bipods deployed, would it be possible to attach it to a low tripod like some of the 50 cal turrets use? This way its usable without being able to be picked up? I don't know, I've fiddled with the idea for like 2 days now but my thoughts and options are just diminishing at this point... 

i dont believe that is possible either. for simplicity, your best bet is probably to set the damage to 1 on the weapon that is laid on the ground and add a addAction to it so when the user presses it it runs the script and forces the weapon into the players hand and makes it so the player is forced into the prone position and the only way to get out of the prone position is to click the other addaction that was created when the script was called which removes the weapon from the players hands and adds his old weapon back and then terminates the script.

Share this post


Link to post
Share on other sites

OK, using gokitty's example code above, along with some code by Killzone Kid I use often, I have hacked together a pretty basic/feature-limited version of what you want. 

 

The rifle is set up on a shooting mat (no bipod), with an addaction that appears when you get within 2 meters. When you initiate the action, several things happen:

  • The static gun is hidden
  • The player is moved to the center of the mat
  • The player's loadout is saved
  • The player's primary weapon is removed
  • The player is moved to the prone position
  • The player is pointed straight forward
  • The player is given a rifle with five magazines and a scope

Here is where more might be needed. I can't find a good way to keep the player from moving but still be able to aim their rifle. I also have it set up so that the player leaves the gun position by simply standing up (gokitty's code doesn't quite work as written, but it could be fixed). When the player stands (or crouches), they leave the gun and their loadout is restored to its previous state. The static gun is also unhidden.  Again, this isn't perfect as one could throw grenades/use a sidearm/heal then refill their inventory by leaving the gun position.

 

Anyway, here it is, a non-perfect, sort-of-functional rough draft of an idea:

https://www.dropbox.com/s/xbur90tmcbxoer7/SOCS_sniper.Stratis.7z?dl=0

 

Function and call are found in the shooting mat's init. 

 

  • Like 2

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

×