I get some unit script error which I can't deceiver when trying to execute this action:
Unit - Order all units in (Any units in (Playable map area) owned by player 6 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) to ( Attack targeting (Position of (Closest unit to (Position of (Picked unit)) in (Units in (Playable map area) having alliance Enemy with player 6 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)))) (Replace Existing Orders)
Is it a problem with "picked unit"? However, I can't select anything more appropriate in the trigger editor to replace it, or do you see a logical error in this somewhere?
"Picked Unit" refers to the loop-action starting with "Pick each unit". That loop iterates over all units.
"Order all units" does not give you any reference to the unit, so you cannot fix your line by using something else as that parameter.
Use a loop over the unit group that you want to order ("Pick each unit in unit group") and use the order action for a single unit ("Issue order to unit").
Also, you wouldn't want to grab all units of player 6 for each unit you are going to order. You should grab them once before the loop and store them in a unit group variable.
"Picked Unit" refers to the loop-action starting with "Pick each unit". That loop iterates over all units.
"Order all units" does not give you any reference to the unit, so you cannot fix your line by using something else as that parameter.
Use a loop over the unit group that you want to order ("Pick each unit in unit group") and use the order action for a single unit ("Issue order to unit").
Also, you wouldn't want to grab all units of player 6 for each unit you are going to order. You should grab them once before the loop and store them in a unit group variable.
Thanks. Did exactly that while I was waiting for the response. It works now. I just tried to reduce the amount of lines of code. Nevermind. For reference, working code looks like this:
(What's wrong with the [quote] tags?)
Save that into a local variable with the unit type "unit group" before the loop is executed and use the variable within the loop.
Right now you are executing that for each ordered unit and it is a fairly costly operation. It can cause lags with many units on the map and many evil units.
<<quote>>(What's wrong with the [quote] tags?)<</quote>>
SC2 Mapster is not powered by vbulitin. It uses a different markup language probably more closely related to wikis and HTML.
Quote:
Save that into a local variable with the unit type "unit group" before the loop is executed and use the variable within the loop.
Right now you are executing that for each ordered unit and it is a fairly costly operation. It can cause lags with many units on the map and many evil units.
Yes one must avoid costly group search operations when possible.
If you are using AI to control the units you can order the units to suicide for a similar result. This will make them automatically seek out the nearest enemies and kill them with no regard for their own life. It requires the player be owned by a computer (not empty or human or neutral) and that it has an active AI started. It might be more efficient in that case as the AI will manage target acquisition.
Yes one must avoid costly group search operations when possible.
If you are using AI to control the units you can order the units to suicide for a similar result. This will make them automatically seek out the nearest enemies and kill them with no regard for their own life. It requires the player be owned by a computer (not empty or human or neutral) and that it has an active AI started. It might be more efficient in that case as the AI will manage target acquisition.
I tried AI suicide, but some units just weren't suiciding. This is how I even got started with the whole pick all unstuck attack move business. There are now more units moving, but it is still far from perfect. Also performance has decreased. My unstuck-triggers can be optimized, but I would really like to use the AI suicide.
I have tried lots of things with the suicide AI command. However, sometimes it just doesn't work. The units are standing there doing nothing. I will experiment further, but at the moment it has prooven to be somewhat unreliable. If anybody knows any details on when and how this suicide thing works, I would greatly appreciate it.
Where could be possible problems?
Is it a problem if a unit gets a suicide command twice?
Why isn't global suicide always working?
How can I order the AI to seek out structures more aggressively?
What are the exact requirements for the AI (Controller, what AI started, units present, etc)?
Example: As a brute force unstuck trigger on a map with lots of enemies and allies you could use something like:
every 30 secs ingame: global suicide player (attackers). However, this doesn't work, despite the player running Campaign AI and the likes. I don't understand where the hidden problem is.
The AI might not know where to suicide them to. Unless the AI also has scouts to find stuff the units might remain stationary until something enters vision.
Try disabling the normal vision flag. Note that there is a high chance this cannot be done with GUI alone meaning you will need a little (1 line, maybe even just an argument) custom script to do this.
// Flag deceleration. You could pass its name as custom script to the appropriate GUI action and it should work. Do not use value as that has been known to change with patches.constintc_diffNormalVision=5;// Use normal vision rules (campaign & cheating melee AIs turn this off).// Native used to change it.nativevoidAISetDifficulty(intplayer,intindex,boolstate);// Example of native being called.AISetDifficulty(lv_player,c_diffNormalVision,false);
This should hopefully allow the AI to know exactly where everything is all the time. As such it should always be able to suicide units.
If it still does not work it might be a good idea to post the map. That way I could debug the cause of the AI malfunction.
AIs can be difficult at times. A lot of things you think might work end up not working and require work arounds.
The AI might not know where to suicide them to. Unless the AI also has scouts to find stuff the units might remain stationary until something enters vision.
Try disabling the normal vision flag. Note that there is a high chance this cannot be done with GUI alone meaning you will need a little (1 line, maybe even just an argument) custom script to do this.
// Flag deceleration. You could pass its name as custom script to the appropriate GUI action and it should work. Do not use value as that has been known to change with patches.constintc_diffNormalVision=5;// Use normal vision rules (campaign cheating melee AIs turn this off).// Native used to change it.nativevoidAISetDifficulty(intplayer,intindex,boolstate);// Example of native being called.AISetDifficulty(lv_player,c_diffNormalVision,false);
This should hopefully allow the AI to know exactly where everything is all the time. As such it should always be able to suicide units.
If it still does not work it might be a good idea to post the map. That way I could debug the cause of the AI malfunction.
AIs can be difficult at times. A lot of things you think might work end up not working and require work arounds.
This is interesting. I don't want my AI to be cheating (because that would make the look up cliffs and stuff), so I could just make a couple of units visible and at least this problem would be done.
On the other hand, I am pretty sure, that there are times when there is nothing to see and some units get a suicide order and they will seek out enemy units and start to fight.
Anyhow, thanks for the tip, I will definitely look into that.
Update: Vision doesn't seem to be a factor. However, if the unit has currently orders running (aka is not idle) it seems to work less reliably. Freshly spawned units will gladly go suicide if you order the suicide _per unit_ and have them do nothing else.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I get some unit script error which I can't deceiver when trying to execute this action:
Unit - Order all units in (Any units in (Playable map area) owned by player 6 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) to ( Attack targeting (Position of (Closest unit to (Position of (Picked unit)) in (Units in (Playable map area) having alliance Enemy with player 6 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)))) (Replace Existing Orders)
Is it a problem with "picked unit"? However, I can't select anything more appropriate in the trigger editor to replace it, or do you see a logical error in this somewhere?
"Picked Unit" refers to the loop-action starting with "Pick each unit". That loop iterates over all units.
"Order all units" does not give you any reference to the unit, so you cannot fix your line by using something else as that parameter.
Use a loop over the unit group that you want to order ("Pick each unit in unit group") and use the order action for a single unit ("Issue order to unit").
Also, you wouldn't want to grab all units of player 6 for each unit you are going to order. You should grab them once before the loop and store them in a unit group variable.
Thanks. Did exactly that while I was waiting for the response. It works now. I just tried to reduce the amount of lines of code. Nevermind. For reference, working code looks like this:
<<quote>>(What's wrong with the [quote] tags?)<</quote>>
SC2 Mapster is not powered by vbulitin. It uses a different markup language probably more closely related to wikis and HTML.
Yes one must avoid costly group search operations when possible.
If you are using AI to control the units you can order the units to suicide for a similar result. This will make them automatically seek out the nearest enemies and kill them with no regard for their own life. It requires the player be owned by a computer (not empty or human or neutral) and that it has an active AI started. It might be more efficient in that case as the AI will manage target acquisition.
I tried AI suicide, but some units just weren't suiciding. This is how I even got started with the whole pick all unstuck attack move business. There are now more units moving, but it is still far from perfect. Also performance has decreased. My unstuck-triggers can be optimized, but I would really like to use the AI suicide.
I have tried lots of things with the suicide AI command. However, sometimes it just doesn't work. The units are standing there doing nothing. I will experiment further, but at the moment it has prooven to be somewhat unreliable. If anybody knows any details on when and how this suicide thing works, I would greatly appreciate it.
Where could be possible problems?
Is it a problem if a unit gets a suicide command twice?
Why isn't global suicide always working?
How can I order the AI to seek out structures more aggressively?
What are the exact requirements for the AI (Controller, what AI started, units present, etc)?
Example: As a brute force unstuck trigger on a map with lots of enemies and allies you could use something like: every 30 secs ingame: global suicide player (attackers). However, this doesn't work, despite the player running Campaign AI and the likes. I don't understand where the hidden problem is.
The AI might not know where to suicide them to. Unless the AI also has scouts to find stuff the units might remain stationary until something enters vision.
Try disabling the normal vision flag. Note that there is a high chance this cannot be done with GUI alone meaning you will need a little (1 line, maybe even just an argument) custom script to do this.
This should hopefully allow the AI to know exactly where everything is all the time. As such it should always be able to suicide units.
If it still does not work it might be a good idea to post the map. That way I could debug the cause of the AI malfunction.
AIs can be difficult at times. A lot of things you think might work end up not working and require work arounds.
This is interesting. I don't want my AI to be cheating (because that would make the look up cliffs and stuff), so I could just make a couple of units visible and at least this problem would be done.
On the other hand, I am pretty sure, that there are times when there is nothing to see and some units get a suicide order and they will seek out enemy units and start to fight.
Anyhow, thanks for the tip, I will definitely look into that.
Update: Vision doesn't seem to be a factor. However, if the unit has currently orders running (aka is not idle) it seems to work less reliably. Freshly spawned units will gladly go suicide if you order the suicide _per unit_ and have them do nothing else.