I would give the item a collision, say set all the items in your games Movement - Collision to Unused Land 16, one that no other unit you use in your game has, that way no one collides with the items but they colide with themselves
Then set their movement radius to what you want the sepration to be, basically making it more like a normal unit in those regards. If you need a more detailed explanation lemme know, but I am assuming you follow what I mean until you say otherwise 8-)
well i sorta figured something out, but I ran into another problem...if I use a move item trigger, sometimes the items might be moved to a unpathable area if the hero is standing next to unpathable area when he dies...
itemregion is a small circle region
Events
Unit - Any Unit dies
Actions
Region - Move itemregion to (Position of (Triggering unit))
Unit Group - Pick each unit in (Any units in itemregion owned by player Any Player matching Required: Item; Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Move (Picked unit) instantly to (Random point in itemregion) (No Blend)
dunno why SC2 editor makes us jump through hoops to do easy stuff that was default in warcraft3 lol
EDIT: just saw the collosion method posted, just tried that and it didnt work, if my hero was carrying 3 items at death, only 1 item would be left in that spot, and the other 2 items would never drop
There is a problem with my trigger move region and item method, the items might be moved to a unpathable area if the hero is standing near unpathable ground when he dies...then since the items are moved into the unpathable area then noone else can pick it up...
There are a couple of things you can try. First, if the unpathable area is a wall you can test the height of the item's move position to determine whether it's an acceptable move spot or not. If it's NOT a wall then you'll have to use regions to cover your unpathable areas, then check if the drop position is within the region. If either check determines that the move position is unpathable, pick a different move area at random. With a loop, a random move position will be selected until a suitable one is found. Once a good position is found, move the item.
There are no walls so I would have to use regions on the unpathable areas. How do you do the part to check if random point is within the unpathable region?
If, then, else
Condition - Random point in item region != and then what here?
I can't find how to compare if random point in the itemregion is not in the unpathable region
You need to use a local point variable. So create a local point variable in your trigger called "Test Point." Then you create a Repeat Forever loop. The actions of the loop should move Test Point to a random point around where the items were dropped. After Test Point is moved, create an If/Then/Else check. Under conditions, create a check for each region. If the point isn't in any of your No Pathing Zone regions, then move the item to Test Point and break the loop.
Just make the trigger spread radius really, really small?
I mean, "Pick each unit" -> "Move unit to random point in region -> convert circle to region" where the circle is centered on your hero, with a size of 1 or something.
Sure they won't spread very far, but the chance of them spawning in an unpathable area is slim.
Ok so when a hero dies, they drop all 6 items in the same spot...making it hard for other players to pick and choose what items they want to pick up
So how to spread out the items like in warcraft3?
I was thinking maybe of a trigger that when a hero dies, selects all "items" within 3 ramge and move them instantly offset by 2-3 and a random angle
But I cant find in triggers how to do this?
Anyone know how?
Thanks
@HatsuneMikuMegurine: Go
I would give the item a collision, say set all the items in your games Movement - Collision to Unused Land 16, one that no other unit you use in your game has, that way no one collides with the items but they colide with themselves
Then set their movement radius to what you want the sepration to be, basically making it more like a normal unit in those regards. If you need a more detailed explanation lemme know, but I am assuming you follow what I mean until you say otherwise 8-)
well i sorta figured something out, but I ran into another problem...if I use a move item trigger, sometimes the items might be moved to a unpathable area if the hero is standing next to unpathable area when he dies...
itemregion is a small circle region
Events Unit - Any Unit dies
Actions Region - Move itemregion to (Position of (Triggering unit))
Unit Group - Pick each unit in (Any units in itemregion owned by player Any Player matching Required: Item; Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions Unit - Move (Picked unit) instantly to (Random point in itemregion) (No Blend)
dunno why SC2 editor makes us jump through hoops to do easy stuff that was default in warcraft3 lol
EDIT: just saw the collosion method posted, just tried that and it didnt work, if my hero was carrying 3 items at death, only 1 item would be left in that spot, and the other 2 items would never drop
There is a problem with my trigger move region and item method, the items might be moved to a unpathable area if the hero is standing near unpathable ground when he dies...then since the items are moved into the unpathable area then noone else can pick it up...
There are a couple of things you can try. First, if the unpathable area is a wall you can test the height of the item's move position to determine whether it's an acceptable move spot or not. If it's NOT a wall then you'll have to use regions to cover your unpathable areas, then check if the drop position is within the region. If either check determines that the move position is unpathable, pick a different move area at random. With a loop, a random move position will be selected until a suitable one is found. Once a good position is found, move the item.
@BasharTeg: Go
There are no walls so I would have to use regions on the unpathable areas. How do you do the part to check if random point is within the unpathable region?
If, then, else
Condition - Random point in item region != and then what here?
I can't find how to compare if random point in the itemregion is not in the unpathable region
You need to use a local point variable. So create a local point variable in your trigger called "Test Point." Then you create a Repeat Forever loop. The actions of the loop should move Test Point to a random point around where the items were dropped. After Test Point is moved, create an If/Then/Else check. Under conditions, create a check for each region. If the point isn't in any of your No Pathing Zone regions, then move the item to Test Point and break the loop.
It would look something like this:
Just make the trigger spread radius really, really small?
I mean, "Pick each unit" -> "Move unit to random point in region -> convert circle to region" where the circle is centered on your hero, with a size of 1 or something.
Sure they won't spread very far, but the chance of them spawning in an unpathable area is slim.