Jump to content
Sign in to follow this  
Baphomet

Gun jamming script

Recommended Posts

I know there was one gulf war mod that was going to attempt this.. I'm not sure if it was OPGWC or not. Still. Has any scripter made an attempt at making a rudimentary standalone gun jam simulation?

I'm just curious. I'd really like adding something like that to a mission.

Share this post


Link to post
Share on other sites

you might give JAM a try tounge_o.gif

j/k, i don´t think it´s being done yet.

btw: wrong forum ghostface.gif

Share this post


Link to post
Share on other sites

Hm. Well that thread has some bloke asking the same question as me. Along with a lot of talk of the perils of left-handed SA-80 use, and a bunch of quotes. =P

Anyhow. This is general discussion. If I read the description of the mission and scripting forum title... it's: "for discussion of the technical aspects of mission editing and scripting"

... well. I don't know how to script really, I do some modifications here and there but nothing entirely on my own. So I'm not really discussing the technical aspects, I'm just asking if anyone's made one.

Secondly. I'm not posting it in addon discussion because to be quite honest. I don't want an addon that has gun jamming. I'd preferably just have a set of scripts that let me define which weapons jam.

Unfortunately the last thing I'd want to do is download an entire mod to reap the benefits of one little script. I don't want no stinkin' mods. I don't need no stinkin' mods. I pick and choose as I wish.  mad_o.gif

Share this post


Link to post
Share on other sites

Call with

{_x addEventHandler ["fired",{_this exec "unitscripts\loadouts\gunjam.sqs"}]} Foreach Units groupname;

or

this addEventHandler ["fired",{_this exec "unitscripts\loadouts\gunjam.sqs;

Gunjam.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

?(_this select 0)!= player:exit

?(_this select 3=="FullAuto")||(_this select 3 == "Burst")||(_this select 3 == "Single"):goto "Jam"

exit

#Jam

_x = random 200

? (_x <= 4):goto "Jam2"

Exit

#Jam2

player playmove "CombatReloadMortarEnd"

?(LOCAL PLAYER):hint "Gun Jammed.\nCleaning......."

exit

Share this post


Link to post
Share on other sites

Harkonin

Very nice and simple script indeed! smile_o.gif

did you think about other animations?

Share this post


Link to post
Share on other sites

Very cool.

A small clean script. It looks dead easy to implement. That's about perfect I'd say. I personally -like- the fact that this script makes use of stock ofp resources. I'm certain it could be further refined to be used with some better anims, but this is just great for me. I don't need it to be fancy. It works. It gets the point across that you're clearing a jam well enough for my liking.

I might try to add some of my own stuff to it to make it play a random sound of a guy cursing while he clears the jam. Just for the heck of it. This'll be fun to test. biggrin_o.gif

Much thanks Harkonin.

Share this post


Link to post
Share on other sites

If you look at the script it basically gets the soldier to play the rifle mortar attaching animation to represent clearing a jam. So if you've attached a rifle mortar to your m16, that's pretty much what you're looking at for the jam.

Share this post


Link to post
Share on other sites

Also so sound should be included. It will be fun if solder swears while cleaning the gun wink_o.gifbiggrin_o.gif

Share this post


Link to post
Share on other sites

i've heard that the way soldiers do it when they jam a gun, take the mag out, get a few rounds out of it, and load it manually and take the dumb ass one out and put it back in betters biggrin_o.gif

Share this post


Link to post
Share on other sites

I'd be doing a lot of swearing if my gun jammed in the middle of a firefight.  biggrin_o.gif

It'd just be funny to hear some guy over a hill shooting down on you and then hear distant cussing as he clears his jam. Ah, time for a hand grenade.

When I get around to fiddling with this I'll post what I've done maybe. I've been busy with work however.

Share this post


Link to post
Share on other sites

Hi Folks

Might it not be better to set the ammo to zero then the player does reload of the mag?

This would mean the player has that wonderful click click "bo**ocks!" experience rather than an automated one and the player has to do the reload.

I wonder if this could be incorporated into the JAM as CPP as a function and take Jamming as a variable from the specific gun thus alowing still more accurate representation of the weapons as per there Jamming rate in tests.

Also if handgun swap was hot keyed. Your normal option of switching to handgun in this situation could apply.

On a side note an SA 80 with caseless ammo and top bolt would be an obvious possible improvement. With no cartridge case there is no worry as to ejecting them.

Kind Regards Walker

Share this post


Link to post
Share on other sites

Updated the script!

It works for anyone, AI, players ect smile_o.gif

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;;-----------------------------------------------------

;;{_x addeventhandler ["fired", {_this exec "jam.sqs"}]} Foreach Units groupname

;;or

;;this addeventhandler ["fired", {_this exec "jam.sqs"}]

;;Gunjam.sqs

;;-----------------------------------------------------

_unit = _this select 0

?(_this select 3=="FullAuto")||(_this select 3 == "Burst")||(_this select 3 == "Single"):goto "Jam"

exit

#Jam

_x = random 320

? (_x <= 1):goto "Jam2"

Exit

#Jam2

_unit playmove "CombatReloadMagazine"

_unit groupchat "Gah, my gun is jammed!"

exit

Share this post


Link to post
Share on other sites

Would that mean you'd lose a magazine entirely?  sad_o.gif

Hm. It'd be cool to have the stoppage simulated even more by attempting to fire your gun only to have it reply with a "click". However losing an entire magazine in certain circumstances might mean the difference between life and death.

Nice Mr. Zig. It's great to see such a range of interest and contributions on this topic.

Anyhow. How would you go about implementing this as an addon specific eventhandler?

Share this post


Link to post
Share on other sites

well, U use the weapon command. But then the script would be miles long cuz it would have to check for almost every gun in the game sad_o.gifcrazy_o.gif

Share this post


Link to post
Share on other sites

Or even better, create a trigger and have it as big as you want anyone to have a jam, and in it's activation put

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">thislist exec"init_event.sqs"

then init_event.sqs should look like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_list = _this

_count = count _list

_i=0

#loop

(_list select _i) addEventHandler ["fired",{_this exec "Jam.sqs"}]

_i = _i + 1

?(_i < _count ):goto"loop"

Share this post


Link to post
Share on other sites

Ok. I've tried to add a method that bremmer's geiger counter uses for randomizing little click sounds, so that I have random cursing when the gun jams.

I placed: _cussing = ["cuss1","cuss1","cuss2","cuss2","cuss3"

,"cuss3","cuss4","cuss4","cuss5","cuss5"

,"cuss6","cuss6"]

at the top of Jam.sqs just below: _unit = _this select 0

Then during the #Jam2 routine I put this: _unit say (_clicks select _random)

However it gives me some odd error when I start up ofp and it doesn't work. Is there something wrong with the syntax or am I placing something in the wrong area?

Any help would be appreciated.

BTW: Yes. I did declare all the sounds in the description.ext. I'm not sure if I did it right but I'm pretty sure. Since another sound I used to play for the clearing of the jam works just fine.

Share this post


Link to post
Share on other sites

#Jam2

player say "soundname"

player playmove "CombatReloadMortarEnd"

?(LOCAL PLAYER):hint "Gun Jammed.\nCleaning......."

exit

Share this post


Link to post
Share on other sites

Harkonin, that only works with PLAYERS, not AI, and it's really great to see AI have a jam :P

Use ma edited version, it works with AI and players.

Share this post


Link to post
Share on other sites

Not completley, and you have to have them play the animation, and if they are in your group, sidechat.

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  

×