Page MenuHomeFeedback Tracker

GameInventory function FindFreeLocationsFor dosent work
Closed, ResolvedPublic

Description

FindFreeLocationsFor function of GameInventory class in all cases returns 0.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10
Category
Engine
Steps To Reproduce
EntityAI a =  GetGame().CreateObject("Apple","0 0 0",true,false,false);
array<ref InventoryLocation> b = new array<ref InventoryLocation>;
for(int i = 0; i < 10 + 1;i++)
{
	b.Insert(new InventoryLocation);
};

Print(GetGame().GetPlayer().GetInventory().FindFreeLocationsFor(a,FindInventoryLocationType.ANY,b));

This will always return 0. With any combination of Flags / Items used

Additional Information

I have a slight suspicion its not even calling the right engine function.
Somebody might want to look into that.

Event Timeline

Grim created this task.Feb 2 2019, 7:55 AM

I'm sorry I didn't report 6 months ago when I was aware of it :(

Grim edited Additional Information. (Show Details)Feb 2 2019, 8:51 PM
Geez changed the task status from New to Assigned.Feb 4 2019, 1:12 PM
rVn changed the task status from Assigned to Need More Info.Apr 4 2019, 4:29 PM
rVn claimed this task.
rVn added a subscriber: rVn.

Looks like this works for me now, can you retest?

Grim added a comment.Apr 5 2019, 1:20 AM

Function is now there but, function returns only first match for inventory not all of them.

Meaning if you have Vest and Backpack with nothing in it, call that function on Players inventory with an "Apple"(1x1) object it will return 2.
If you call it again for Vest that is empty it will return 1, even tough that vest has X spaces.

rVn closed this task as Resolved.Apr 5 2019, 11:01 AM

Indeed, that's what it does. It's basically FindFreeLocationFor ran on individual cargos - It informs you which cargo's got free space.