I need to be careful when using something like kill, because it's important that the score remains intact when using it. That shouldn't add to the score screen's Units Lost or Resources Lost or anything like that right?
Also this feels like a pretty hacky solution. Is there nothing else that can be done?
EDIT:
So after using the order analyzer script thing (I forgot where I got it from, but I didn't write it):
JASS:
function Trig_orders_Actions takes nothing returns nothing
local integer order = GetIssuedOrderId()
call BJDebugMsg(GetUnitName(GetOrderedUnit()) + " has been ordered " + OrderId2String(order)+ " ("+I2S(order)+")")
endfunction
function InitTrig_orders takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddAction(t, function Trig_orders_Actions)
endfunction
There does appear to be an order ID and way to emulate clicking on the icon in the cargo hold of the unit. By doing this:
-
Unit - Order DevourUnit to Unload DevourVictim
This is an Order Targeting a Unit, and the target is the unit that is loaded in the cargo hold. This makes them eject the unit perfectly fine.
It doesn't really make sense what's happening with UnloadAll order though. It's as though feeding an order point into Devour Cargo Hold is completely clearing where to dump the unit out.
EDIT2:
Okay so I managed to get the actual unloading process working how I want except one thing: If you spam an order enough, say Stop, the unit can't unload because the unloading process takes a long time, even with everything set to as low as it'll go. The only way I think I can fix this is by having some kind of transport system that can tell me what units are loaded into which transports and from there I know what I can do.
I'm going to add the Devour Cargo unit into a unit group when something loads into them, and remove them from the group when something is unloaded. When they're deindexed normally, if you're spamming stop they won't be removed from the group because they'll still have cargo. I'll set the unit's custom value to 1 when they're deindexed as well (I won't be using special value for anything else really) so they can be easily sorted into a system that will continue to order them to unload continuously if they have a special value of 1 and are inside of the group. This is not a perfect fix but unless I can directly remove a unit from their cargo space without having to issue them an order, I think this is all that can be done.
EDIT3: I ended up not needing any special system to do this, I can just use that custom value and use a Unit is in Transport condition.