Jump to content
yonose

How to make custom "Inventory" action?

Recommended Posts

How can i custome the inventory action on a ammobox?

I got several ammoboxes close together, to easily seperate them, i want to make custom inventory actions, to change name, color and distance.

 

Example

Change "inventory" action to something like "Medical Supplies" (red color).

Share this post


Link to post
Share on other sites

1. Hide your ammobox with

https://community.bistudio.com/wiki/hideObject

 

2. Place a different object (one without an inventory, or a simpleObject version of the ammobox) and an action to it via:

https://community.bistudio.com/wiki/addAction (actions there can be named and colored however you wish)

 

3. In that addaction use setPos to position the ammobox where the player is and then force him to open the box, like this:

yourhiddenammobox setPos getPos player;
player action ["Gear", yourhiddenammobox];

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for reply.

 

I think i did what you wanted me to do, but result didnt work out properly.

 

When my character spawned, it opened the hidden ammobox and showed the supplies immediately.

When i go to the ammobox, it dosent show the supplies from the hidden ammobox, it didnt show the option "Gear" either on the scroll-menu

 

 

Hidden simpleobject that contains supplies:

Variable Name:
med_liq

Init:
hideObject med_liq;

 

Empty Ammobox that should contain supplies from the hidden ammobox:

Init:
med_liq setPos getPos player; 
player action ["Gear", med_liq];
bis_fnc_createSimpleObject;

 

Share this post


Link to post
Share on other sites

The snippet I posted is just to move and open the box, you still have to place that into an addAction code to make it accessible via the scroll-menu.

  • Like 1

Share this post


Link to post
Share on other sites

Take a look at the scripting commands wiki, lots of useful stuff there:

https://community.bistudio.com/wiki/addAction

player addAction ["<t color='#FF0000'>Medical Supplies</t>", {

	params ["_actionHolder","_actionCaller"];
	yourhiddenammobox setPos getPos _actionCaller;
	_actionCaller action ["Gear", yourhiddenammobox];

}];

Would be a barebones example.

 

Cheers
 

Share this post


Link to post
Share on other sites

Ok, you both been to great help so far.

Tajin: didnt know what getPos and setPos was doing, but its clear for me now.

 

So i removed the hidden ammobox and getPos and setPos, since it wont be needed.

My problem now, is to set a distance limit to "Medical Supplies" option, as it is now, you can see the option where ever you are. Looking for a distance of 5-10m

player addAction ["<t color='#FF0000'>Medical Supplies</t>", { 
 
 params ["_actionHolder","_actionCaller"]; 
 _actionCaller action ["Gear", boxbag]; 
 
}];

Also looked at the addAction radius, but i dont know how to define the radius, as i understand it has to be in order(?). I tried to set a distance with the syntax "distance" and "nearestObjects", but they havent worked out.

 

 

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

×