Jump to content
Moon_chilD

Open Box Inventory via Script

Recommended Posts

Hey guys,

 

I want to have a AI unit stand in my base that can provide you with ammunition. When scrolling on that unit you should be able to open the inventory of an ammobox (thats in the best case somewhere different so that the player cant find it!)

 

I don't want to use the Arsenal for that, because I want to have Limited supplies on that unit!

Is something like that possible? If yes, how?
Many Greetings
Moony

Share this post


Link to post
Share on other sites

Open 3D editor >> place an ammo box >> double click said ammo box >> scroll down to and open "Object: Equipment Storage" >> under "Type" select "Virtual" >> define which equipment you want the ammo box to have under "Content".

Share this post


Link to post
Share on other sites

This is not what I want. Not at all.

 

I want to open the inventory of an ammobox by adding an action to an object in the world (e.g. an AI unit). Also I said I DON'T want to use the Arsenal, and the virtual storage IS the arsenal

Share this post


Link to post
Share on other sites

Damn, I was looking for such a thread T^T 

Thanks, that looks decent. Will test it later :3

  • Like 1

Share this post


Link to post
Share on other sites

Okay, finally I found time to work on the mission again. 

I tested that now. Overall the code works but only if you are in range of the Ammobox (basically the same range where you could just open the inventory of the Ammobox on your own xD) 
Is there any way to increase the range?

Share this post


Link to post
Share on other sites

Change the 300 to your desired distance.

player addaction ["Open " ,{player action ["GEAR",BOX_1]},[], 0, true, false, "", "(_this distance box_1)<3000"]

Share this post


Link to post
Share on other sites

Ahh damn, I knew I forget to add something important to my post. 

The box is about 2 Meter away from the object that has the interaction to open the ammobox. If I stand in front of that object, everything works fine. If I'm like 5 meters away from it, I still get the option and an inventory opens but its empty this time. (In fact I can see the objects in the inventory of the ammobox for a split second befor the inventory becomes all empty)
I don't use the distance code at all, since I will use this script  on an static object instead of on the player itself!

Share this post


Link to post
Share on other sites

The basic idea was for it to be used with an invisible ammo box, so you can add the action to other items such as a  plastic water barrel or suitcase ect .

For it to work the invisible ammo box has to moved close to the player performing the action or as mentioned  the gear window will not remain open.

 

BOX_1 hideobject true;

 

player addaction ["Open " ,{BOX_1 setpos getpos player;player action ["GEAR",BOX_1]},[], 0, true, false, "", ""];

 

 

I don't think it's possible to open a box of longer distances.

 

 

You can always move it back to the original position after you've finished.

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

×