OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: grey on 02 Jul 2004, 14:31:44

Title: Safe mode for weapons
Post by: grey on 02 Jul 2004, 14:31:44
it would be nice to have a safe mode action for the guns.

the guns would be put to safe mode at the start, the player would have to set it to semi to shoot.

i can't really script and would hope that someone could help me out with this.
 ;D
Title: Re:Safe mode for weapons
Post by: ponq on 02 Jul 2004, 15:03:56
you could prolly start with an empty gun by removing all ammo.

Then just add the ammo again. The player (and AI) now first has to reload before he can shoot.
Title: Re:Safe mode for weapons
Post by: grey on 04 Jul 2004, 03:46:07
but the problem is i would like to have it be able to set bet to safe later on...
Title: Re:Safe mode for weapons
Post by: macguba on 04 Jul 2004, 11:16:25
This is not a mission editing question.   What you want to do is alter the game itself, and in general that is not possible with mission editing tools like scripting.    When it is possible it usually requires heavy duty scripting.

If somebody comes up with a solution that's great, but I wouldn't hold your breath.
Title: Re:Safe mode for weapons
Post by: Roni on 04 Jul 2004, 13:55:55
How about an Addaction script, say - this addAction ["Safety On", "safety.sqs"]

All the script would have to do is record the players current weapons and magazines, delete them, then add them back again weapon first so that they are unloaded.

Since it is an addaction you could do it as many times as you liked.  You could even add a little sidechat or title cut like - "Weapon locked !".  If you really wanted to go overboard, you could add a custom sound of the safety going on.

Not too hard I think but so far my one script attempt at removing and restoring a players weapon hasn't worked.

Future query topic that !



Rags
Title: Re:Safe mode for weapons
Post by: Homefry31464 on 06 Jul 2004, 03:05:06
You can't delete a half empty magazine and add it back again...adding a new magazine will give them a full mag, so the player could have unlimited ammo.
Title: Re:Safe mode for weapons
Post by: Roni on 06 Jul 2004, 03:57:23
Okay, you got me.

Could you do it via an event handler ?  As in - if you put the safety on (via the Addaction script) then an eventhandler becomes active that stops you firing ?  I've never used event handlers so I have absolutely no idea what I'm talking about   :(   but I'm thinking along the lines of the "fired" event handler.

Probably not, but this is an interesting thread !

Title: Re:Safe mode for weapons
Post by: grey on 06 Jul 2004, 14:27:12
btw since roni has brought up the 'fired' eventhandlers...

can u do 2 different types of 'firing' eventhandlers?

example: i wana trigger a script for the mg n a diff script for the main round for a tank by using the 'fired' eventhandlers.  ???
Title: Re:Safe mode for weapons
Post by: macguba on 06 Jul 2004, 14:41:22
Err, I think so.    The fired eventhandler returns a number of parameters, one of which (I think) is the muzzle.    The first the script would do is figure out which muzzle fired and then take the appropriate action.

There's a good piece on eventhandlers somewhere, it might be in the FAQ but I'm not sure.

You can use the hint format trick to run tests to see what is what.
Title: Re:Safe mode for weapons
Post by: Homefry31464 on 06 Jul 2004, 22:04:13
Igor Drukov (or something similar), wrote a tute on Eventhandlers, its in the Ed. Depot.

EDIT: Search Results (http://www.ofpec.com/editors/browse.php?browseon=&browsewhat=-1&catselected=-1_-1&catagory=-1&subcategory=-1_-1&numreturn=25&displayformat=0&ofpv=1&searchwhat=1&searchlevel=0&searchwhat=1&searchopts=&searchstring=event)-Look for the author name.