My map (Paczerg, see profile) has tons of powerup style items all over the map. (The pellets.) They all have an autocast ability with a very short range that causes the pellet to remove itself when used: so if a character gets close enough, it vanishes. (This is the technique that Blizzard uses for its pickupable resources.)
My problem is, as the character moves across the map and over the pellets, not all of them are "eaten". Sometimes the pellets will be consumed when the character moves over it again, and a few of them will stay no matter how many times the unit tries.
I believe I have isolated the problem to the speed in which the character moves over the pellet. By increasing the ability range (to 1.9) and slowing the movement speed (to 7), more of the pellets tend to be consumed. However, if I increase the range the character will pick up pellets its not supposed to, and if I decrease the speed the game will be too slow/boring.
Misc data: I've set the autocast/follow/extra range on the ability to 5, which I'm pretty sure is plenty.
How can I make the ability cast so 100% of the pellets are picked up when moved over?
I made a trigger solution that could work. Because of a lack of pellets, I made it so when you walk over a lowered supply depot, it blows up.
It consists of two triggers, first a trigger that runs when a unit comes in range of a supply depot:
Pellet Pickup
Events
Local Variables
Conditions
Actions
Unit - Kill (Random Living unit from (Supply Depot (Lowered) units in (Region((Position of (Triggering unit)), 1.0)) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most 1))
I couldn't see an easier way to get the supply depot you walked over, but I didn't look that hard.
Notice ther is no events. Since I can emagine you got a lot of pellets, it would be tedious to add an event for each pellet, so I made another trigger to do that.
Add Pellets To Trigger
Events
Game - Map initialization
Local Variables
unit = No Unit <Unit>
Conditions
Actions
Unit Group - For each unit unit in (Supply Depot (Lowered) units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) do (Actions)
Actions
General - Custom Script: TriggerAddEventUnitRange(gt_PelletPickup, null, lv_unit, 1.0, true);
Yeah, having to add every single pellet as an event was one of the roadblocks that made me switch back to using abilities. I'm still holding out on an ability fix (mainly because of all the time I already spent on it) but if it doesn't work out I will try that. Thanks
You don't have to scrap everything you done in the data editor. I assume you are using an Effect - Target ability. Then you could just apply your effect from the trigger. Should only be necessary to do some minor changes to the triggers. (I assume - dont know everything about your implementation ofc)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
My map (Paczerg, see profile) has tons of powerup style items all over the map. (The pellets.) They all have an autocast ability with a very short range that causes the pellet to remove itself when used: so if a character gets close enough, it vanishes. (This is the technique that Blizzard uses for its pickupable resources.)
My problem is, as the character moves across the map and over the pellets, not all of them are "eaten". Sometimes the pellets will be consumed when the character moves over it again, and a few of them will stay no matter how many times the unit tries.
I believe I have isolated the problem to the speed in which the character moves over the pellet. By increasing the ability range (to 1.9) and slowing the movement speed (to 7), more of the pellets tend to be consumed. However, if I increase the range the character will pick up pellets its not supposed to, and if I decrease the speed the game will be too slow/boring.
Misc data: I've set the autocast/follow/extra range on the ability to 5, which I'm pretty sure is plenty.
How can I make the ability cast so 100% of the pellets are picked up when moved over?
Thanks a lot for any help.
i would make it with triggers. just pick all units of pelets type in range of you paczerg and remove them (and may set the score to score+1)
I tried that originally, but it turned into a quagmire of variables and actions, and I gave up. Thnx for the tip though.
I made a trigger solution that could work. Because of a lack of pellets, I made it so when you walk over a lowered supply depot, it blows up.
It consists of two triggers, first a trigger that runs when a unit comes in range of a supply depot:
Pellet Pickup
Events
Local Variables
Conditions
Actions
Unit - Kill (Random Living unit from (Supply Depot (Lowered) units in (Region((Position of (Triggering unit)), 1.0)) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most 1))
I couldn't see an easier way to get the supply depot you walked over, but I didn't look that hard.
Notice ther is no events. Since I can emagine you got a lot of pellets, it would be tedious to add an event for each pellet, so I made another trigger to do that.
Add Pellets To Trigger
Events
Game - Map initialization
Local Variables
unit = No Unit <Unit>
Conditions
Actions
Unit Group - For each unit unit in (Supply Depot (Lowered) units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) do (Actions)
Actions
General - Custom Script: TriggerAddEventUnitRange(gt_PelletPickup, null, lv_unit, 1.0, true);
Hope it helps
Yeah, having to add every single pellet as an event was one of the roadblocks that made me switch back to using abilities. I'm still holding out on an ability fix (mainly because of all the time I already spent on it) but if it doesn't work out I will try that. Thanks
You don't have to scrap everything you done in the data editor. I assume you are using an Effect - Target ability. Then you could just apply your effect from the trigger. Should only be necessary to do some minor changes to the triggers. (I assume - dont know everything about your implementation ofc)