Home   Help Search Login Register  

Author Topic: Field Guns - Loader.  (Read 1192 times)

0 Members and 1 Guest are viewing this topic.

Offline TheArgyll

  • Members
  • *
Field Guns - Loader.
« on: 16 Sep 2007, 16:28:42 »
I would like to make the back seat in the field guns actually practical. So I was wondering if it is possible to do the following, and have someone give me some code at least to get me started. I have posted this in the MP forums as I would like this to work in a MP game, and dont know what it involves in terms of coding.

1.0 - The gun is fired by the gunner.
2.0 - The passenger is presented with "Open Breach" action.
2.5 - After performing action wait X seconds.
3.0 - The passenger is presented with "Prime Shell" action.
3.5 - After performing action wait X seconds.
4.0 - The passenger is presented with "Load Shell" action.
4.5 - After performing action wait X seconds.
5.0 - The passenger is presented with "Close Breach" action
6.0 - The weapon is reloaded, and can fire again. Goto 1.0.

Basically, this would be dependant on the ability of the loader to click the commands, rather than the native reload speed.
Anyone help ?
Thanks.
« Last Edit: 16 Sep 2007, 17:08:54 by TheArgyll »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Field Guns - Loader.
« Reply #1 on: 20 Sep 2007, 22:10:26 »
I don't know anything about multiplayer scripting, so all the "local" and "public" things you'll have to ask someone else about. But basically what you're asking for would be easy enough, EXCEPT, it'd require you to remove and then re-add all the ammo "manually" with every reload. This also means that the ammo count displayed on the weapon probably couldn't be made to hold true, but rather the amount of shells left would be virtual.

Something like this:

1)Detect if gun fires (use "fired" eventhandler)
2)Remove all ammo from the gun (removeMagazines "magazine name for cannon")
3)Present the weapon with the appropriate action. In multiplayer you can probably make this appear locally for only the loader or whatever, but in SP at least it'd appear for everyone. Nonetheless, you can simply make it so that unless the person using the action is in the -cargo- position, it will quit.
4) Script the action script to just basically be a timer with a wait/sleep command (maybe play some sounds for effect), at the end of which the action is added again with a different name. Continue until all the phases are complete. Remove one ammo from the "global" ammo counter of the gun (suggest using i.e. setVariable and getVariable to make it local to that cannon).
5) As long as the virtual ammo counter of the gun is > 0, return ammo to the weapon and wait for it to fire again.

 :) This, of course, would also need the appropriate script. But it's not really that hard, and if you look into the commands mentioned above, you should be able to manage it yourself easily enough!  :good: Good luck!

Wolfrug out.
5)
"When 900 years YOU reach, look as good you will not!"