- Joined
- May 10, 2019
- Messages
- 18
Hi everyone,
What I'm trying to do is replace a unit with another unit using the GUI's Unit - Replace function, and I'd like to preserve the original unit's inventory. Here's the code I have so far to preserve the inventory.
The issue I'm running into is that I'm not quite sure how to manage items with charges. This trigger above only creates a single item. Does anyone have any advice for a trigger that handles item charges?
What I'm trying to do is replace a unit with another unit using the GUI's Unit - Replace function, and I'd like to preserve the original unit's inventory. Here's the code I have so far to preserve the inventory.
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Set VariableSet transferitems[(Integer A)] = (Item-type of (Item carried by Unit_Advance in slot (Integer A)))
-
-
-
Set VariableSet Unit_Replaced = (Last replaced unit)
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Set VariableSet transferitempos = (Position of Unit_Replaced)
-
Item - Create transferitems[(Integer A)] at transferitempos
-
Hero - Give (Last created item) to Unit_Replaced
-
Custom script: call RemoveLocation(udg_transferitempos)
-
-
The issue I'm running into is that I'm not quite sure how to manage items with charges. This trigger above only creates a single item. Does anyone have any advice for a trigger that handles item charges?