Jump to content
Sign in to follow this  
A.Cyprus

DropBag not ... doing so

Recommended Posts

Hello all

I'm attempting to force the player to drop his backpack using the code below.


_gwh = "GroundWeaponHolder" createVehicle getPosATL player; 
player action ["DropBag", _gwh, typeOf unitBackpack player];
_gwh setPos getPosATL player;
player reveal _gwh;

This code is wrapped in a function that had other code interspersed among it, but having faced issues I ended up stripping it down to pure basics above to eliminate other factors. In fact, this is more or less identical to the example on the BIKI reference page. I'm using getPosATL instead of getPos so that it works whilst on building roofs etc, instead of dropping the back through the ceiling onto the ground floor.

The issue I need help with is that the code does not work 100% of the time. The drop bag animation will play, but the backpack will remain on the player. This usually happens if:

- I am running, walking, or moving

- I am prone

- I am standing still, some of the time

I tried using the alternative syntax for createVehicle and the GroundWeaponHolder - same result. I have tried the _gwh setPos line before the DropBag action.

I'm not sure what the problem is. I can't seem to get it to work consistently, something I need for a project I am working on.

I've checked the feedback tracker, there are two issues logged wrt to DropBag but don't seem relevant. I couldn't find much by forum searching either.

Am I doing something wrong here?

Any help is much appreciated.

Many thanks.

Share this post


Link to post
Share on other sites

Pretty sure the weaponholder is getting automatically deleted because it is empty before action puts the bag in it. Why don't you use:

[color="#FF8040"][color="#000000"]player[/color] [color="#191970"][b]action[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"PutBag"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color][/color]

Made with KK's SQF to BBCode Converter

Also, if it is just scripting you might get a better response here: http://forums.bistudio.com/forumdisplay.php?162-ARMA-3-MISSION-EDITING-amp-SCRIPTING

Share this post


Link to post
Share on other sites

Thanks, I'll try both options.

Don't remember why I didn't try PutBag, it was a while ago but I may have read it was an alias for DropBag, although the Actions BIKI page doesn't actually say that now.

Thanks for reply.

Share this post


Link to post
Share on other sites

Thank you, this seems to have worked.

Face palm for not having tried that to start with, really don't remember what my line of thought was on that.

Share this post


Link to post
Share on other sites

Incidentally, how are you supposed to use GroundWeaponHolders if they are deleted milliseconds after you create them if still empty?

I'm probably going to face the same issue trying to use DropWeapon...

Share this post


Link to post
Share on other sites
Incidentally, how are you supposed to use GroundWeaponHolders if they are deleted milliseconds after you create them if still empty?

I'm probably going to face the same issue trying to use DropWeapon...

You can put something in it like a magazine immediately after you created it then remove it later, but this is a "hack". It is just with action it doesn't put backpack in weaponholder until action is completed so occasionally it may take longer than the existence of empty weaponholder.

Share this post


Link to post
Share on other sites

That would explain why I'm having the same issue with DropWeapon too, inspite of the commands being one after the other; the animations can take a second or so, and perhaps a tiny moment longer if I am running at the time and need to stop first. Guess I'll have to get hacky.

Thanks again, and also for your tutorials. You're in the credits of my Push-to-Hear addon.

Share this post


Link to post
Share on other sites

Just wanted to update this with a conclusion, in case anybody has similar issues and ends up here.

Adding an item to the GroundWeaponHolder to keep it from being deleted worked as expected, and allowed me to DropWeapon into it properly.

The down side was that the code to remove said item from the GroundWeaponHolder would execute so fast that the holder got deleted anyway, even if this was done after the DropWeapon action.

Instead of messing with waitUntil checks or similar, I decided to create a quick config of my own that inherited from class GroundWeaponHolder but used forceSupply = false instead of the default. This enables the GroundWeaponHolder to remain even after all items have been removed from it.

Overkill? Perhaps, but it felt cleaner.

Of course, I then needed a little more clean up code to make sure my GroundWeaponHolder was deleted when finally empty, but everything works now and I'm happy with the outcome.

Will be releasing the addon soon.

Share this post


Link to post
Share on other sites

Perhaps we can ask Pettka to add another weaponholder class with forceSupply = false; and call it GroundWeaponHolder_Scripted like he did with demo charge. This would be very useful to have. Will try to tweet him.

Share this post


Link to post
Share on other sites

Cool, nice one.

Am I right in assuming there's no real way to modify those config tokens/properties like forceSupply directly in scripting unless a BI method exists to do it? (eg setting colours for controls)

Tbh, it would have been nice to be able to set the timeout for an empty holder to be deleted rather than to have to remove it manually. Perhaps that's another useful option worth considering.

Share this post


Link to post
Share on other sites

Allowing weaponholders to be added to Remains Collector would do the trick, not sure how far this request has progressed. Remains Collector can already remove vehicles and units after specified in mission config params.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×