• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

HELP REMOVING LAG on PICK UNIT ATTACK ORDER

Status
Not open for further replies.
Level 7
Joined
Nov 22, 2004
Messages
192
Hi! I have looked up that issue and it has been experienced before, yet I have found no solution googling it on forums.

So here is my trigger in text copy. The PROBLEm is I cannot delay the order on ppicked unit as it does nothing. I tried about every combination I could think of and the only way the order is recognized is as so. If I put my attack to lower the lag after a wait time, there is no response and nothing happens, the units just stay there. But by ordering the attack move order just after picking a unit gourp is extremely demanding and there is a small lag like a hick up that slows down the play and is annoying, So here is what the trigger looks like now.

Set UnitGroup01 = (Units owned by Player 8 (Pink))

Unit Group - Pick every unit in UnitGroup01 and do (Actions)

Loop - Actions

Set PickedUnit01 = (Picked unit)

Unit - Order PickedUnit01 to Attack (Random unit from (Units in (Playable map area)(((Race of (Matching unit)) Not equal to Human) and ((((Owner of (Matching unit)) controller) Not equal to Passive) and (((Matching unit) is A structure) Equal to False)))))

Wait 5.00 seconds

Custom script: call DestroyGroup(udg_UnitGroup01)
 
Level 11
Joined
Jun 2, 2004
Messages
849
You shouldn't use waits in loops. To make it actually work properly requires a local variable which is a JASS thing.

As for why it's laggy, it's probably because of the "Random unit from Units in Playable Map Area" part. Every iteration of the loop, you're making a new unit group out of every unit in the map. Why don't you make this unit group at the start (call it UnitGroup02 or something)? Then you can pick a random unit from it inside the loop.
 
Level 7
Joined
Nov 22, 2004
Messages
192
You shouldn't use waits in loops. To make it actually work properly requires a local variable which is a JASS thing.

As for why it's laggy, it's probably because of the "Random unit from Units in Playable Map Area" part. Every iteration of the loop, you're making a new unit group out of every unit in the map. Why don't you make this unit group at the start (call it UnitGroup02 or something)? Then you can pick a random unit from it inside the loop.
OK wait ignore my previous post (I deleted it LOL). I will retry... I think it will work I had forgotten a copy past run trigger... I will retry. It might just work.
 
Level 7
Joined
Nov 22, 2004
Messages
192
You shouldn't use waits in loops. To make it actually work properly requires a local variable which is a JASS thing.

As for why it's laggy, it's probably because of the "Random unit from Units in Playable Map Area" part. Every iteration of the loop, you're making a new unit group out of every unit in the map. Why don't you make this unit group at the start (call it UnitGroup02 or something)? Then you can pick a random unit from it inside the loop.
OK it works. Thanks twice for your help!
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
you could cast a spell on the unit like fire fly, which makes them want to attack naturally

using a trigger you can add the buff and point out a culprit for the victim to target
 
Status
Not open for further replies.
Top