OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Canukausiuka on 18 Oct 2005, 05:43:31

Title: Transferring Magazines
Post by: Canukausiuka on 18 Oct 2005, 05:43:31
I'm having trouble with a script I'm trying to get working.  It is supposed to give an empty vehicle all the weapons and ammunition that a soldier has, so that when the soldier gets in, he can still fire his weapons (as opposed to a pre-existing weapon).  However, so far all I can come up with is reading the magazines the guy holds (magazines _unit), and then using addMagazine to give the vehicles the right amount.  But if the guy has fired some, he gets a full magazine back!

I know that there is an "action" command for dropping and taking magazines.  Does anyone have any more information about that command and how to use it?
Title: Re:Transferring Magazines
Post by: Planck on 18 Oct 2005, 15:58:14
Try here (http://www.ofpec.com/editors/resource_view.php?id=862) for a list of working action commands.


Planck
Title: Re:Transferring Magazines
Post by: macguba on 19 Oct 2005, 20:22:08
I have a horrible feeling there is not much you can do about part-used mags.
Title: Re:Transferring Magazines
Post by: Canukausiuka on 20 Oct 2005, 00:13:03
Well, I know you can force a unit to drop a magazine, using an action.  What I want is to force them to drop their magazines, then force something else to pick them up.  Seems to me that if that works, we should be able to transfer all the ammunition intact.  The trick is, how exactly to do it.  Of course, it may not be possible (which would explain why I'm having trouble with it)  ::)
Title: Re:Transferring Magazines
Post by: Tyger on 20 Oct 2005, 00:34:16
bedges was having the same problem IIRC, and it was decieded there really wasn't any solution...
Title: Re:Transferring Magazines
Post by: macguba on 20 Oct 2005, 09:55:45
Quote
Seems to me that if that works, we should be able to transfer all the ammunition intact.  
Yes that's the problem:  transferring a magazine is no problem, but the information as to how many rounds have been fired is lost.  When its picked up its always full.    At least that is my suspicion.
Title: Re:Transferring Magazines
Post by: Kyle Sarnik on 29 Nov 2005, 00:34:16
Force a unit to drop weapons into vehicles:

Code: [Select]
{unit action ["DROP WEAPON",vehicle,0,0,_X]} foreach (weapons unit)
{unit action ["DROP MAGAZINE",vehicle,0,0,_X]} foreach (magazines unit)

It will work at any distance from the vehicle, but it will also cause the unit to play the "Put" animation.