Looking for help from anyone who would be able to tell me how to write a trigger that would transfer inventory items from one unit to another unit, however the kickers is; In order to train a hero in my map you need to be in the cargo of a building (barracks).
I have had several attempts at this trigger and cannot seem to figure out how to make it work! If there are any workarounds, or a way to simply replace the inventory unit with the trained unit type (while keeping the inventory intact), the help would be much appreciated. I would like it to be along the lines of
Event: Unit - Any Unit training progress is Completed
Conditions: (Triggering progress unit type) == Marine
This seems very possible. However I don't want to write all the code for it. Can you be more specific about what you can't get to work and how it fails? How do you order the unit to the upgraded?
There are three unit involved in this trigger. The barracks (unit doing the training), the SCV (unit inside the cargo of the barracks), and the unit being trained (Marine). As previously stated the SCV needs to be inside the barrack in order to train the marine. This is pretty much accomplished with requirements and do not need to help with this.
So I have my 3 units, unit in triggering units cargo (SCV), triggering unit (Barracks) and Triggering Progress Unit (Marine). I want all the items from the Unit in Triggering Units Cargo (SCV) to be transfered to Triggering Progress Unit (Marine) before I remove the "SCV" from the game. This would pretty much give the illusion that the SCV has been trained to a marine and retains all the items during the transition.
- The two transferring unit's inventories are identical
- There is only 1 cargo space in the barracks
With this said I am not having any luck transferring or moving any items from one unit to the next. The only working part that my trigger has managed is to replace or remove the SCV inside the Barracks with the "Unit - Remove (cargo unit in (triggering unit) at slot 1) from the game"
Thanks for any input
So you can create an array of unit types that is the size of the max number of inventory slots. Then pick each item carried by the SCV and store it at an index in your array of unit types. Then remove the scv and create the marine in the barracks. Then step through the array adding each unit type it finds to the inventory of the marine. If this is done more than once per game you will need to clear the array of unit types each time. Here is a screenshot of the code I wrote to test this. Though I did not recreate all the things your trigger will be doing. It should work fine.
Looking for help from anyone who would be able to tell me how to write a trigger that would transfer inventory items from one unit to another unit, however the kickers is; In order to train a hero in my map you need to be in the cargo of a building (barracks).
I have had several attempts at this trigger and cannot seem to figure out how to make it work! If there are any workarounds, or a way to simply replace the inventory unit with the trained unit type (while keeping the inventory intact), the help would be much appreciated. I would like it to be along the lines of
Event: Unit - Any Unit training progress is Completed
Conditions: (Triggering progress unit type) == Marine
Action: ...
@HappyGoLucky3: Go
This seems very possible. However I don't want to write all the code for it. Can you be more specific about what you can't get to work and how it fails? How do you order the unit to the upgraded?
There are three unit involved in this trigger. The barracks (unit doing the training), the SCV (unit inside the cargo of the barracks), and the unit being trained (Marine). As previously stated the SCV needs to be inside the barrack in order to train the marine. This is pretty much accomplished with requirements and do not need to help with this. So I have my 3 units, unit in triggering units cargo (SCV), triggering unit (Barracks) and Triggering Progress Unit (Marine). I want all the items from the Unit in Triggering Units Cargo (SCV) to be transfered to Triggering Progress Unit (Marine) before I remove the "SCV" from the game. This would pretty much give the illusion that the SCV has been trained to a marine and retains all the items during the transition. - The two transferring unit's inventories are identical - There is only 1 cargo space in the barracks With this said I am not having any luck transferring or moving any items from one unit to the next. The only working part that my trigger has managed is to replace or remove the SCV inside the Barracks with the "Unit - Remove (cargo unit in (triggering unit) at slot 1) from the game" Thanks for any input
So you can create an array of unit types that is the size of the max number of inventory slots. Then pick each item carried by the SCV and store it at an index in your array of unit types. Then remove the scv and create the marine in the barracks. Then step through the array adding each unit type it finds to the inventory of the marine. If this is done more than once per game you will need to clear the array of unit types each time. Here is a screenshot of the code I wrote to test this. Though I did not recreate all the things your trigger will be doing. It should work fine.
Thanks man, it works perfectly