Home   Help Search Login Register  

Author Topic: Jamming script  (Read 3559 times)

0 Members and 1 Guest are viewing this topic.

Sophion

  • Guest
Jamming script
« on: 15 Nov 2004, 15:59:26 »
I searched the forums and found no link to get this. I was spoken on the forums before but i can't find the actual scipt.

1shottokill

  • Guest
Re:Jamming script
« Reply #1 on: 15 Nov 2004, 22:39:40 »
Yes mate, it was discussed but it just died, like threads do ;D. I'm sure someone would help you if you wanted to start it up in the recruitment depot. (just not me, i'm useless at scripting  :P)

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Jamming script
« Reply #2 on: 15 Nov 2004, 23:55:03 »
i can probably help out with scripting (i'm rying to do as much of this as i can so i learn it really well) but it depends on what you want... could you give details on what the script should do?

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Jamming script
« Reply #3 on: 16 Nov 2004, 07:58:45 »
I remember looking into this a while back, and I decided the best way to simulate a weapons jam was to remove the player's magazine, then add it back in again right away. This basically has the effect of "emptying" the weapon, forcing the player to "clear it" by reloading. Of course you would detect when the player shoots his weapon via an EH.

The upside to this method is that it lets the player decide when to clear the jam, instead of forcing him to do it right away via switchmove. The player doesn't see anything "funny" (like his weapon disapearing); his ammo count just drops to 0 all the sudden (of course, you can script in a message or sound indicating what happened). The mainside though, is that when you add a mag back into the player's inventory, you add a FULL mag. So if he had 1 round left in an m16 mag, when his weapon jams, he will get 29 free bullets.

This downside could be very nicely avoided if you were making an addon; you would just need to make 30 different magazines (one with 30 rounds, one with 29 rounds, one with 28, etc).

But even without that (pure script form, no addons), it still is a good compromise, IMO.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Sophion

  • Guest
Re:Jamming script
« Reply #4 on: 16 Nov 2004, 15:47:14 »
Yeah... The big problem of not able to add rounds in OFP. That looks like it might work. I was looking for something a whole lot advanced.

-Jam if a unit passes by the player < 5m while the player is prone on sand
-Jam randomly if it is raining
-Jam if a unit passes by the player < 5m while the player is prone on snow

As you can see it will be very dificult.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Jamming script
« Reply #5 on: 16 Nov 2004, 21:40:55 »
not sure you can even do the prone thing, because they are just textures, and i don't think the game engine recognizes them to be grass, sand etc

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Jamming script
« Reply #6 on: 16 Nov 2004, 22:41:08 »
Triggerhappy  is right; there isn't really a way to tell if the player is prone, and there isn't really a way to tell what type of surface someone is walking on. Actually, I'm not sure WHY those things would even cause a jam though. I mean, a why would a guy walking 10 feet away from you do anything to your weapon? If you are going to add in some "conditions" for jamming, I'd say these things should make a jam more likely to occur:

-Firing lots of rounds rapidly, one after the other
-Crawling around prone a bunch (i.e. dragging your weapon through the mud)
-Generic "environmental" modifier set by the mission editor (i.e. in dusty environments he could up it)

The first one might be easy to do, but the second might not be possible at all.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Sophion

  • Guest
Re:Jamming script
« Reply #7 on: 17 Nov 2004, 14:14:29 »
You can just put a trigger or an object to simulate the sand and snow. Then you can put an object at 2m (? don't know how high a man is standing) and make it to be a set hight like "Crouch Hight" and another can be "Prone Hight" So if the player goes lower than them it would activate. Name the AI players and make it so if they get close to him it will execute.

I don't know but i think that the above can be used for crawing a lot.


You have to remember, the M16 has an open chaft. It is easy for sand and snow to get into it and jam the weapon.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Jamming script
« Reply #8 on: 17 Nov 2004, 22:07:09 »
Unfortunately, you can't really detect if the player is prone or standing by checking his "altitude" like that; because the same number is returned no matter what position he is in.

Not sure what a "chaft" is, but I assume you mean the ejection port (Where the cartridge casings come out of after being fired)? Well, first off there is a cover you can close there, and second, I don't see how dirt would get in there just because someone is running past you like 15 feet away, and third, I don't see how a little snow would jam the weapon.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Sophion

  • Guest
Re:Jamming script
« Reply #9 on: 18 Nov 2004, 14:41:39 »
Ok. ok... I'll let you have it.

I'm not sure how you can detect if a unit is fireing rapidly. But then again i'm not used to event handlers.

Homefry31464

  • Guest
Re:Jamming script
« Reply #10 on: 19 Nov 2004, 03:01:32 »
I remember looking into this a while back, and I decided the best way to simulate a weapons jam was to remove the player's magazine, then add it back in again right away. This basically has the effect of "emptying" the weapon, forcing the player to "clear it" by reloading. Of course you would detect when the player shoots his weapon via an EH.

The upside to this method is that it lets the player decide when to clear the jam, instead of forcing him to do it right away via switchmove. The player doesn't see anything "funny" (like his weapon disapearing); his ammo count just drops to 0 all the sudden (of course, you can script in a message or sound indicating what happened). The mainside though, is that when you add a mag back into the player's inventory, you add a FULL mag. So if he had 1 round left in an m16 mag, when his weapon jams, he will get 29 free bullets.

This downside could be very nicely avoided if you were making an addon; you would just need to make 30 different magazines (one with 30 rounds, one with 29 rounds, one with 28, etc).

But even without that (pure script form, no addons), it still is a good compromise, IMO.

So, if you were making a weapon addon... this could work?  When you return the amount of ammo left, does this give you a number of bullets or just magazines?

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Jamming script
« Reply #11 on: 19 Nov 2004, 04:07:58 »
i'm not sure there is any way of knowing how many rounds are left in a mag, unless there is a way of telling if they reloaded.
if you can do that, then you can use a "fired" EH and count how many times the gun was fired and use that to findout what to give the person, resetting the count when the player reloads

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Jamming script
« Reply #12 on: 19 Nov 2004, 04:09:50 »
This could work if you were making an addon. You can check how many rounds are in a unit's current magazine with the "ammo" command. Then you remove his magazine, and add back in a magazine that is configured to have that many bullets in it.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Sophion

  • Guest
Re:Jamming script
« Reply #13 on: 19 Nov 2004, 12:39:53 »
I was thinking about that to. But i don't have any exp with cpp files (?). Some one else would have to do that.

Kammak

  • Guest
Re:Jamming script
« Reply #14 on: 19 Nov 2004, 16:04:06 »
That's beautifully simple, Gen. Barron.  I love it.  Only problem I see is with addons...I never use default BIS mags at all.  Do you care if I make this for the Marine Assault Pack magazines?  Give you equal billing as the creator?