Jump to content

Recommended Posts

Explanation of this script: I've dropped a map, radio and a GPS. These items will then to go into players inventory by executing this script: 

_stuff = nearestObjects[player,["GroundWeaponHolder"],5];  
{  player additem _x; } forEach _stuff; 

 

However, it doesn't work

I've checked that my character has enough space.

I've also tested the script by using deletevehicle _x, and the items get removed.

So why would using "player additem _x //(and assignitem)" work aswell?

Share this post


Link to post
Share on other sites
_stuff = nearestObjects[player,["GroundWeaponHolder"],5]; // Returns array of all groundWeaponHolders within 5m
{  player additem _x; } forEach _stuff;  // Tries to add groundWeaponHolders to player's inventory

As you can see from what I have shown above, this method isn't going to work :)

What you are trying to do is:

_holder = nearestObject [player,"groundWeaponHolder"]; // Returns nearest groundWeaponHolder to player
_items = items _holder; // Returns all items in groundWeaponHolder
{player addItem _x}forEach _items;// Adds each item to players inventory

Untested but should work in theory, have fun. Let me know if you have any problems.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×