Page MenuHomeFeedback Tracker

setUnitLoadout recreates backpack if nil is provided
New, NormalPublic

Description

When you provide nil in setUnitLoadout array for backpack slot, the engine still deletes and re-creates old backpack. This is an issue because assemble-able backpacks hold link to vehicles they assemble and this means the vehicle will be created anew and all its previous states like damage, ammo, variables will be lost.

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce
  1. Start playing
  2. Execute in debug console:
if(backpack player == "") then {player addBackpack "Bag_Base"};

oldBP = backpackContainer player;
systemChat str ["oldBP", oldBP];

l = getUnitLoadout player;
l set [5, nil];
player setUnitLoadout l;

newBP = backpackContainer player;
systemChat str ["newBP", newBP];
systemChat str ["newBP == oldBP", newBP == oldBP];
  1. Observer newBP == oldBP being false

Event Timeline

SaMatra created this task.Tue, May 7, 8:53 AM
dedmen set Ref Ticket to AIII-56418.Thu, May 16, 6:27 PM