Jump to content
Sign in to follow this  
semedar

Backpack Dispenser

Recommended Posts

Anyway someone can help me out by having a Backpack Heap dispense backpacks with the addAction command?

Example: Walk up to a backpack heap and a bunch of Add Actions pop up with either "Get US Assault Pack" which in turns removes your current backpack (if any) and gives you a "US_Assault_Pack_EP1". With an option to get any backpack you want.

I've searched and found someone did something similar but I couldn't figure it out since it was heavily embedded in his mission and couldn't port it into mine.

Share this post


Link to post
Share on other sites

Here's what we use at TAW.net (the Art of Warfare). Feel free to use it.

We put a backpack heap object on the ground and put this in its INIT box:

handle = this execVM "scripts\bagHeap.sqf";

Then we have a script called bagHeap.sqf in a folder called "scripts" that looks like this:

_heap = _this;

_heap addAction ["Take ACU Pack", "scripts\addBackpack.sqf", ["US_Assault_Pack_EP1"]];
_heap addAction ["Take Large Coyote Pack", "scripts\addBackpack.sqf", ["US_Backpack_EP1"]];
_heap addAction ["Take Patrol Pack", "scripts\addBackpack.sqf", ["US_Patrol_Pack_EP1"]];
_heap addAction ["Take ALICE Pack", "scripts\addBackpack.sqf", ["TK_ALICE_Pack_EP1"]];
_heap addAction ["Take Taki Assault Pack", "scripts\addBackpack.sqf", ["TK_Assault_Pack_EP1"]];
_heap addAction ["Take Czech Rucksack", "scripts\addBackpack.sqf", ["CZ_Backpack_EP1"]];
_heap addAction ["Remove Backpack", "scripts\addBackpack.sqf", [""]];

Then we have another script in that folder, called addBackpack.sqf that looks like this:

_player = (_this select 1);
_type = (_this select 3) select 0;

removeBackpack _player;
sleep 0.5;
if (!(_type == "")) then 
{
_player addBackpack _type;
hintSilent "You picked up the backpack. Any previous backpacks were discarded.";
} else 
{
hintSilent "Backpack dropped.";
};

Works very well! I think TAW_Paveway put that together for us originally.

You can see it in use on TAW.net servers ;)

Share this post


Link to post
Share on other sites

Aye awesome this is exactly what I was looking for, thanks! :D

Is there any way you can have the addAction command in-game text be grey? (The part where it says "Take ACU Pack")

I've seen it done in someones Domination mission before, but never figured it out.

Share this post


Link to post
Share on other sites
_heap addAction [("<t color=""#8A8A8A"">" + ("Take ACU Pack") +"</t>"), "scripts\addBackpack.sqf", ["US_Assault_Pack_EP1"]];

Edited by cobra4v320

Share this post


Link to post
Share on other sites
_heap addAction [("<t color=""#8A8A8A"">" + ("Take ACU Pack") +"</t>"), "scripts\addBackpack.sqf", ["US_Assault_Pack_EP1"]];

Aye, thanks for the help! :D

Picture:

2akqd0.jpg

http://tinyurl.com/4yj25dy

Share this post


Link to post
Share on other sites

sry for bumping old thread but this is exactly what i'm looking for but can't seem to get it to work!

am i supposed to name the backpack heap? put it into the init.sqs?

Share this post


Link to post
Share on other sites

read post # 2, if confused, re-read post # 2. If still confused, call for medevac...

Share this post


Link to post
Share on other sites

yes i did read post #2 and then went back to read #2 again when it didn't work

i have everything copied exactly like in post #2 still doesn't work

---------- Post added at 18:54 ---------- Previous post was at 17:07 ----------

or even better can someone link me a working mission with this at least i can take it from there

Share this post


Link to post
Share on other sites
or even better can someone link me a working mission with this at least i can take it from there

Here ya go. Working mission which is nothing more than what's in post #2. :)

Share this post


Link to post
Share on other sites

thx! works now - playing spot the difference in what you do did and still no idea why it didn't work the first time. no matter

Share this post


Link to post
Share on other sites

Check your RPT file for errors maybe? Calling your folder script instead of scripts, or missing that last } or a missing ; somewhere maybe? Not sure. Glad it's working now though for you!

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  

×