Home   Help Search Login Register  

Author Topic: Weapon Jamming. Refining the script.  (Read 1136 times)

0 Members and 2 Guests are viewing this topic.

Baphomet

  • Guest
Weapon Jamming. Refining the script.
« on: 07 May 2004, 10:49:47 »
I asked if someone could make a simple gun jamming script on the FP 1985 message boards. It turned out pretty good as far as my response.

I wanted something simple to add a bit more intensity to deathmatch or co-op play. Weapon jamming seemed like the right way to go.

The original thread is here http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=dbe977104718286db4c9524db06ef418;act=ST;f=7;t=37321;st=0

The code looks like this:

init_events.sqs is called from a trigger with
Code: [Select]
thislist exec"init_event.sqs" in it's activation string

init_events.sqs
Code: [Select]
_list = _this
_count = count _list
_i=0
#loop

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

_i = _i + 1
?(_i < _count ):goto"loop"

The main code:
Code: [Select]
;;-----------------------------------------------------
;;{_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


This was made originally by Harkonin and Mr.Zig was nice enough to improve it to the final result as seen here.

I was just wondering however. Since this script isn't by any means perfect although fun to use. It uses the rifle grenade loading animation to simulate the appearance of clearing a jam. So because the script does not differentiate between pistols and rifles. It still tries to play that animation when a pistol activates the script.

Is there any way around that? So that pistols perhaps at best don't activate the script at all if there's no workaround animation wise?Ideally making different jam frequencies for different weapons would be even better but I've heard that it would turn the script into a large unworkable mess of sorts.

I just wondered if anyone more script savvy had anything insightful to contribute in regard to this interesting script.
« Last Edit: 07 May 2004, 23:12:01 by Baphomet »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Weapon Jamming. Refining the script.
« Reply #1 on: 07 May 2004, 17:25:34 »
i was thinking of doing something on these lines for the players in a coop

however my idea was to unload the weapon, so that the player had to manually reload the gun himself, cuts out the animation stuff and you get the nice sounds too

Its still an idea in my head thats about 3 weeks away from being started, however since you bring the topic up, i have a question, that i havent yet looked into

Is it possible to count the number of rounds in a magazine that is on the weapon, save this as a variable so that the magazine can be emptied and then readded when the gun is once again reloaded

I know i can save the magazines player array, but dont as yet know if its possible to save the load in the current mag
« Last Edit: 07 May 2004, 17:28:39 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline SilentHunter

  • Members
  • *
  • frozen leg'o'lamb (every gamers most loved weapon)
Re:Weapon Jamming. Refining the script.
« Reply #2 on: 07 May 2004, 17:58:46 »
@Terox

Quote
unit ammo magazine

Operand types:
unit: Object
magazine: String
Type of returned value:
Number
Description:
Count how many shots are left for given magazine type.

Example:
player ammo "M16"


SILENTHUNTER
[size=4.5]NERDS HAVE FEELINGS TOO! [/size] [size=2.5]*adjusts glasses*[/size]

Offline SilentHunter

  • Members
  • *
  • frozen leg'o'lamb (every gamers most loved weapon)
Re:Weapon Jamming. Refining the script.
« Reply #3 on: 07 May 2004, 18:03:50 »
@Baphomet

Quote
;;-----------------------------------------------------
;;{_x addeventhandler ["fired", {_this exec "jam.sqs"}]} Foreach Units groupname
;;or
;;this addeventhandler ["fired", {_this exec "jam.sqs"}]
;;Gunjam.sqs
;;-----------------------------------------------------

_unit = _this select 0
?(primaryWeapon _unit)!=(_this select 1):exit

?(_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


That should do it

SILENTHUNTER
[size=4.5]NERDS HAVE FEELINGS TOO! [/size] [size=2.5]*adjusts glasses*[/size]

Baphomet

  • Guest
Re:Weapon Jamming. Refining the script.
« Reply #4 on: 07 May 2004, 23:08:06 »
All right. I'll have to give that a go.

Thanks for the replies and the help. Sorry I can't really help you out much Terox. I was fiddling with the script only I'm not as well versed in scripting as others.

Cheers.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Weapon Jamming. Refining the script.
« Reply #5 on: 09 May 2004, 10:10:35 »
All right. I'll have to give that a go.

Thanks for the replies and the help. Sorry I can't really help you out much Terox. I was fiddling with the script only I'm not as well versed in scripting as others.

Cheers.


No problems m8, its something i am capable of doing, just havent gotten round to it yet

thx anyway
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Baphomet

  • Guest
Re:Weapon Jamming. Refining the script.
« Reply #6 on: 10 May 2004, 00:39:45 »
Well post your results if you happen to. I'd be interested to see them.