[Trigger] SOLVED Regular Modles drops items on death without triggers(?)

Level 13
Joined
Feb 5, 2018
Messages
567
I recently ran into a problem with the regular Banshee model and some other models.

It seems to drop items on death even without any triggers and I also set the items in OE to be undroppable.

In addtion the unit seems to exist forever even when removed. So the trigger will constantly try to make new items
into the units position and since there is no unit availabe the new items are generated on the ground.

And to clarify the player units are given to AI so it is intented that pairs are:
1,4 Red, Purple
2,5 Blue, Yellow
3, 6 Teal, Orange

I only have 3 triggers with items

  • Player 1 Supply Lines
    • Events
      • Unit - A unit enters Player 1 Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
    • Actions
      • Set VariableSet SupplyUnit = (Triggering unit)
      • For each (Integer SupplyLoopIndex[1]) from 1 to SupplyLinesIndex[1], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SupplyUnit is alive) Equal to True
            • Then - Actions
              • Set VariableSet SupplyRoll[1] = (Random integer number between 1 and 10)
              • Unit - Add Inventory (Hero) to SupplyUnit
              • Hero - Create RandomItem[SupplyRoll[1]] and give it to SupplyUnit
            • Else - Actions
  • Player 2 Supply Lines
    • Events
      • Unit - A unit enters Player 2 Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
    • Actions
      • Set VariableSet SupplyUnit = (Triggering unit)
      • For each (Integer SupplyLoopIndex[2]) from 1 to SupplyLinesIndex[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SupplyUnit is alive) Equal to True
            • Then - Actions
              • Set VariableSet SupplyRoll[2] = (Random integer number between 1 and 10)
              • Unit - Add Inventory (Hero) to SupplyUnit
              • Hero - Create RandomItem[SupplyRoll[2]] and give it to SupplyUnit
            • Else - Actions
  • Player 3 Supply Lines
    • Events
      • Unit - A unit enters Player 3 Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
    • Actions
      • Set VariableSet SupplyUnit = (Triggering unit)
      • For each (Integer SupplyLoopIndex[3]) from 1 to SupplyLinesIndex[3], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SupplyUnit is alive) Equal to True
            • Then - Actions
              • Set VariableSet SupplyRoll[3] = (Random integer number between 1 and 10)
              • Unit - Add Inventory (Hero) to SupplyUnit
              • Hero - Create RandomItem[SupplyRoll[3]] and give it to SupplyUnit
            • Else - Actions



So the items are generated for each unit without any issues. The issue is when a units\undead\Banshee\Banshee or units\creeps\SkeletonOrc\SkeletonOrc dies they drop the items on the ground and somehow they're death location persists and this trigger will always try to create and give items to them even thought they are dead and gone. There are some other models too with the same issue.

I have tried:
1) Changed the OE value to Can Raise, Does not decay
2) Changed the OE value to Can Raise, Does decay
3) Made all items used in the map undroppable in the OE
4) Added "Unit is alive" condition check to the trigger
5) Removed an recreated all regions in the map to make sure there is no copypasted regions
6) Added a variable supplyunit instead of triggering unit, since it caused other issues trying to
create and give units that were already dead
The map has no imported files or models. Only basic wc3 reforged models and icons and so on.
7) No items use the Miscellanous base item class, since it has some very odd interactions.

Then I converted the trigger to locals to see if nullifying the unit would help but still there are random items created on the ground.
  • Player 1 Supply Lines
    • Events
      • Unit - A unit enters Player 1 Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
    • Actions
      • Custom script: local unit u = (GetTriggerUnit())
      • Custom script: local integer i
      • Custom script: call UnitAddAbilityBJ( 'AInv', u)
      • Custom script: set i = GetRandomInt(1, 10)
      • Custom script: call UnitAddItemByIdSwapped( udg_RandomItem[i], u )
      • Custom script: set u = null
      • Custom script: set i = 0

At least some of the issues were resolved by doing these steps. I guess 2) Changed the OE value to Can Raise, Does decay did help to some degree, the units no longer drop items on the ground when they die, but there are still random items created on the ground that are try to be given to dead units which blows my mind, cause it literally by passes all the conditions that I have set.

I added an constant item removal which clears the items, but doesn't really solve my original issue.
  • Clear Items
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked item) is owned) Equal to False
            • Then - Actions
              • Item - Remove (Picked item)
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Are you sure it has to do with models? That sounds like something that has never happened before, to anyone, ever. The real issue lies elsewhere.

Also, you should put the For Loop inside of the If Then Else, not the other way around (or just check if it's Alive in the initial Conditions block):
  • Player 1 Supply Lines
    • Events
      • Unit - A unit enters Player 1 Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
    • Actions
      • Set VariableSet SupplyUnit = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SupplyUnit is alive) Equal to True
        • Then - Actions
          • For each (Integer SupplyLoopIndex[1]) from 1 to SupplyLinesIndex[1], do (Actions)
            • Loop - Actions
              • Set VariableSet SupplyRoll[1] = (Random integer number between 1 and 10)
              • Unit - Add Inventory (Hero) to SupplyUnit
              • Hero - Create RandomItem[SupplyRoll[1]] and give it to SupplyUnit
        • Else - Actions
It can't possibly die during this process unless the "random item" you create for it has a chance of killing it.
 
Last edited:
Level 13
Joined
Feb 5, 2018
Messages
567
Are you sure it has to do with models? That sounds like something that has never happened before, to anyone, ever. It's likely a false positive and the real issue lies elsewhere.
Also yes, just tested this in an empty map

The footman does not drop items on ground but the banshee does.

I created the units 2 times just to be sure, thats why there are items on the ground.

  • Create
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Unit - Create 1 Banshee for Player 1 (Red) at (Center of Test Region <gen>) facing Default building facing degrees
      • Hero - Create Claws of Attack +15 and give it to (Last created unit)
      • -------- --------
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of Test Region <gen>) facing Default building facing degrees
      • Hero - Create Claws of Attack +15 and give it to (Last created unit)

  • Kill
    • Events
      • Player - Player 1 (Red) types a chat message containing k as An exact match
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Test Region <gen>) and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
EDIT: Added 2 more models which I knew behave in the same way. Added testmap and replay to attachments.

EDIT 2: Ok removing the units completely from the game seems to do the trick. No items spawn I guess the items are removed
from the game with unit?
 

Attachments

  • WC3ScrnShot_031425_224414_000.png
    WC3ScrnShot_031425_224414_000.png
    3.5 MB · Views: 3
  • BuggedModelsHive.w3m
    18.2 KB · Views: 1
  • LastReplay.w3g
    2.7 KB · Views: 1
Last edited:
Level 29
Joined
Sep 26, 2009
Messages
2,594
This has nothing to do with models - they are just visualization. The root cause is whether unit decays after death or not.
In case of your skeleton units and banshee, their death types is "Can't raise, does not decay", while Footman is "can raise, does decay".
Since those three units do not decay, they drop their items nearly immediately after death.

It seems that units will drop items no matter what - you just affect whether it is dropped immediately after death or after unit completely decays away.
So to sum it up, Footman will also drop items, it will just take about 1.5min for him to do :)
 
Level 13
Joined
Feb 5, 2018
Messages
567
It seems that units will drop items no matter what - you just affect whether it is dropped immediately after death or after unit completely decays away.
So to sum it up, Footman will also drop items, it will just take about 1.5min for him to do
Ok thank you :) I think I will just add the units provided with an item to a group and remove them from the game then.

I was literally going insane with the items being created all around, turned out to just be the dead units decay time then :D
 
Last edited:
Level 29
Joined
Sep 26, 2009
Messages
2,594
What is the point of giving units any items, anyway?
At least in the triggers you've posted you are giving those non-hero units a hero inventory, which means those units benefit from those items, i.e. claws of attack increase their attack damage.
Since you don't want those items to drop on ground, why not just directly add to those units the underlying item ability, instead of what you are doing now?
 
Level 13
Joined
Feb 5, 2018
Messages
567
What is the point of giving units any items, anyway?
Ahh it's a survival map and the upgrade is called "Supply Lines" which gives items to the units and I personally think it's more fun to see
what the units get. That's why they have hero inventory so players can see what they got.
At least in the triggers you've posted you are giving those non-hero units a hero inventory, which means those units benefit from those items, i.e. claws of attack increase their attack damage
Yes, thats the point why I am giving it :D

I just added a condition to the end of this trigger since I had to track dying units anyway to reset their damage count,
since the Custom values are recycled and I would definetly break the array limit if I were to lock custom values.

Trough some mystic power the trigger prio seems to work with all the other on death events even thought the
units are removed. I reckon this is better approach than the constant loop to remove items from the ground.

  • Reset Unit Damage Dealt
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
      • Unit - A unit owned by Player 2 (Blue) Dies
      • Unit - A unit owned by Player 3 (Teal) Dies
      • Unit - A unit owned by Player 4 (Purple) Dies
      • Unit - A unit owned by Player 5 (Yellow) Dies
      • Unit - A unit owned by Player 6 (Orange) Dies
      • Unit - A unit owned by Player 21 (Coal) Dies
      • Unit - A unit owned by Player 22 (Snow) Dies
      • Unit - A unit owned by Player 23 (Emerald) Dies
      • Unit - A unit owned by Player 24 (Peanut) Dies
    • Conditions
    • Actions
      • -------- Reset damage due to cycled unit indexes --------
      • Set VariableSet XDamageUnitCV = (Custom value of (Triggering unit))
      • Set VariableSet XUnitDamageDealt[XDamageUnitCV] = 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in SupplyGroup.) Equal to True
        • Then - Actions
          • Unit - Remove (Triggering unit) from the game
        • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I wouldn't use Unit Groups for such a common Event. Better to rely on the Unit Indexer and mark the unit with a Boolean.
  • Conditions
    • (In_Supply_Group[XDamageUnitCV]) Equal to True
  • Then
    • Set Variable In_Supply_Group[XDamageUnitCV] = False
Also, you could edit the Unit Indexer to reserve say Indexes [1] -> [200] to be for Heroes and prevent those from being recycled, if that's a thing you care about. That'll prevent the custom value of a hero from being recycled while non-Heroes still recycle properly. It shouldn't be too difficult, the system is basically just incrementing Integers.
 
Top