OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Baphomet 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 (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 thislist exec"init_event.sqs" in it's activation string
init_events.sqs
_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:
;;-----------------------------------------------------
;;{_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.
-
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
-
@Terox
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
-
@Baphomet
;;-----------------------------------------------------
;;{_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
-
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.
-
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
-
Well post your results if you happen to. I'd be interested to see them.