I don't know why but I can't seem to find any information on what should be one of the most simplest things to do in the editor. I have placed units on the map and they belong to an AI. I want the AI to not use these units like they normally would, (ie bunch them up together/defend/attack) I want the units to just stand in that area and wait for the player to come and engage them - just like you would have in the campaign or in co-op. Yet I can't seem to get the AI to decide against grabbing everything on the map and immediately attacking the player with it rendering my map unplayable.
I have gone to Object properties and unchecked "Available for attack waves" and I thought this would do the trick, but to no avail.
If anyone can help or link a tutorial I'd much appreciate it.
If you're using a create unit action, to reference those units as a unit group, use the function "Last created units".
It would look something like this:
Test spawn units
Events
Game -Map initialization
Local Variables
Conditions
Actions
Unit -Create 10 Marine for player 1 at Start Location 001 using default facing (No Options)
AI -Enable script control for (Last created units)
Interestingly enough, I have never encountered this problem even in micro missions I have made. Make sure you have deleted all AI-initializing triggers and actions and try as MaskedImposter suggested.
Ah, that's the problem - I don't want to delete the AI initializing triggers... I could I guess, by having a seperate AI and initialize the AI's individually, but I ideally want the AI to play a normal game of Starcraft but Also the game will spawn some units into an area of which I want the AI to ignore these units so they can defend that area.
I'll try MaskedImposter's method of disabling script control for the last created units tonight and let you know how successful I am.
Okay, so it worked...kind of. If I spawn 5 Zealots then use AISetUnitScriptControlled on UnitLastCreated the AI will use 4 of the Zealots and ignore 1. So, I could spawn each zealot one at a time and use this method, but it does seem inefficient. Any ideas?
You are using the unit version of script control. You need to use the unit group version. That way it'll be for all the units and not just the very last one.
and it appears to work for all the units, although interestingly not warp prisms in phasing mode... are they not considered units in the editor or something?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi there,
I don't know why but I can't seem to find any information on what should be one of the most simplest things to do in the editor. I have placed units on the map and they belong to an AI. I want the AI to not use these units like they normally would, (ie bunch them up together/defend/attack) I want the units to just stand in that area and wait for the player to come and engage them - just like you would have in the campaign or in co-op. Yet I can't seem to get the AI to decide against grabbing everything on the map and immediately attacking the player with it rendering my map unplayable.
I have gone to Object properties and unchecked "Available for attack waves" and I thought this would do the trick, but to no avail.
If anyone can help or link a tutorial I'd much appreciate it.
In triggers you could use the action "enable script control"
I still can't seem to do it. Trying to copy what someone else has done here: https://www.sc2mapster.com/forums/development/triggers/152771-pick-all-units-in-region if I spawn some units in a region, I can't seem to figure out how to make this apply only to them. I'm new to triggers but have spent about a week googling with no luck.
If you're using a create unit action, to reference those units as a unit group, use the function "Last created units".
It would look something like this:
Interestingly enough, I have never encountered this problem even in micro missions I have made. Make sure you have deleted all AI-initializing triggers and actions and try as MaskedImposter suggested.
KSNumedia's Assets: Custom Models for campaigns and mods!
Ah, that's the problem - I don't want to delete the AI initializing triggers... I could I guess, by having a seperate AI and initialize the AI's individually, but I ideally want the AI to play a normal game of Starcraft but Also the game will spawn some units into an area of which I want the AI to ignore these units so they can defend that area.
I'll try MaskedImposter's method of disabling script control for the last created units tonight and let you know how successful I am.
Okay, so it worked...kind of. If I spawn 5 Zealots then use AISetUnitScriptControlled on UnitLastCreated the AI will use 4 of the Zealots and ignore 1. So, I could spawn each zealot one at a time and use this method, but it does seem inefficient. Any ideas?
Attached is my attempt in case I'm doing it wrong
You are using the unit version of script control. You need to use the unit group version. That way it'll be for all the units and not just the very last one.
Thanks, it works. I'm using:
AISetGroupScriptControlled((UnitGroup(null,4,(RegionEntireMap()),Excluded: Worker, Missile, Dead, Hidden,0)),false)
and it appears to work for all the units, although interestingly not warp prisms in phasing mode... are they not considered units in the editor or something?