When the map is covered in grey fog of war you can see where structures are that you previously saw. For example when you start a game you can see the location of all the mineral patches and XelNaga towers on the map. When you scout an opponents building you can see where it was through the fog of war.
You can also give orders to your units, for example sending a worker to mine from a mineral field which is not in your current vision.
I need a way to know what unit is the target of an order. with the worker and mineral example, I need to know which mineral patch the worker is being ordered to mine from. If the mineral patch is within my vision you can use the trigger "target of order" to retrieve the target, "target location of order" gives the units position. But when that target is outside of vision "target of order" returns null and "target location of order" returns null as well.
It only changed in a patch earlier this year. It used to work as expected where you could get the target unit even if you didn't have vision of it, so Blizzard has changed things since that patch.
My initial reaction was to just give players vision of all the mineral patches which solves that problem... But I have lots of players bitching to me about how I need to fix it! For whatever strange reason people are upset that they share vision with the mineral patches. So if it's important to them then I must find a way to fix it.
tldr; Does anyone on SC2mapster have any ideas about how I can figure out what unit is the target of an order?
EDIT: getting the ability command for the above case is still "harvest" ability, so the unit knows that it is going to use the harvest ability on it's target. But I can't figure out a way to get the target.
function - get unit in unit group closest to point. Specify the unit group to be minerals, and the point to be the player's mouse cursor world position.
The problem is that the "ghost" units you target are not real.
This has always been a massive "pain in the (you know)" for RTS developers. You want to keep a snap shot of what they know while also not divulging its current state in any way. As such the "unit" you target through the fog of war is not the actual unit, but a "ghost" of that unit. The ghost will be there until the unit is revealed in sight again, or is discovered to be dead.
Old RTS games like Age of Empires and Empire Earth used special ghost units for this, which were declared like normal units but were separate data entries. Newer ones are designed specifically to support this in an easy to use way.
The problem still remains that when you target such a "ghost" you are not targeting a unit or a point. The order generated must be a special order with a special ghost target which then resolves into an actual order at the time the ghost is revealed (a unit if still alive, otherwise a point). Ghost orders are not supported by the triggers as far as I know (how would one interpret them in a meaningful way?).
My recommendation is that instead of running the triggers in response to the order, you run them in response to an action. When the action occurs the ghost would have been resolved so there is no ambiguity as to what the target is.
thing is I need to erase the unit and then replace it with another. This replacement unit needs to be given the same orders as the killed unit.
It's not just for minerals, say if it was a marine given a move instruction to a Xel'Naga tower. I need to be able to kill that marine and create a new unit which has the same order. If I can resolve the target unit then all I have to do is extract the ability and the target from the first unit and issue that command to the second unit.
One thing I've tried is granting vision temporarily. So for the marine moving to the xelnaga tower which is not in vision. I grant vision of the whole map, wait 0.5 seconds (in case the vision isn't automatic or it takes the game a while to resolve the ghost units), then try and extract the target, then proceed as normal.
However the ghost unit is not resolved when the player gets vision of the unit (the player gets vision of the whole map in this example), the ghost unit gets resolved when the unit reaches the destination.
Using mouse positions would be disasterous as every time a unit was issued a command I would have to run multiple checks and get the mouse coordinates and figure out what units are nearby. That's not just player issued orders either, that's every time a unit comes out of a structure and has a waypoint, every time a swarm host spawns units, or every time a worker mines minerals it is assigned new orders to return them and come back for more.
For the record, I'd be happy if I could just get it to work with neutral units (minerals, towers, gas guysers, rocks and destructable things in the environment). Getting it to work with enemy structures would be nice but I think it would be a rare occurance so I'm OK with it failing in this rare event.
thing is I need to erase the unit and then replace it with another. This replacement unit needs to be given the same orders as the killed unit.
It's not just for minerals, say if it was a marine given a move instruction to a Xel'Naga tower. I need to be able to kill that marine and create a new unit which has the same order. If I can resolve the target unit then all I have to do is extract the ability and the target from the first unit and issue that command to the second unit.
Sounds like you need to revise your map mechanics. Why remove the ordered unit in the first place?
I need to create an exact snap shot of the game at a given time with enough data to completely recreate the game state so that it would be completely indistinguishable. That is down to every behaviour, cooldown, unit stat, rally point, control group, training slot, upgrade level, player camera position, saved camera location, hotkeys, etcetcetc and an important part of that is that I need to know every detail about every order issued so that it can be 100% recreated. And I need to do this whenever and however many times the player wants to.
When I have a specific question I limit the scope to what is relevant information otherwise I am just wasting everyones time and obscuring what the actual problem is. Then discussion gets side tracked away from what the origional question was about.
Hopefuly, if anyone has any ideas on how I could get at the data I need they can offer a suggestion.
Have you tried using the event Unit uses ability? I'm thinking of the move ability and checking the triggering ability target unit might work.
The unit won't use the ability until it reaches its target. Maybe I could try using the "unit is issued order" event and try to see if "triggering ability target unit" can give me the information needed, but I doubt that will be a lead. It's worth trying though, thanks :)
I can imagine how scary it would be seeing beautiful terrain through fog (when planning my next scout/attack location) with the occasional spiky minerals out of nowhere :P .
There's a particular action that lets you reveal a certain sized circular area around a point. You set the reveal area high enough so that the target unit appears through fog (the grey one) and can be targeted by any unit but also keep the reveal area low enough so that part of the map isn't actually revealed to the player.
yeah, that's what I do with XelNaga towers. But for all other neutral units like minerals and destructable rocks I set their vision range to zero and then share vision between the player and those units. It has the same effect but it's much quicker and easier than creating 200 revealers.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi,
When the map is covered in grey fog of war you can see where structures are that you previously saw. For example when you start a game you can see the location of all the mineral patches and XelNaga towers on the map. When you scout an opponents building you can see where it was through the fog of war.
You can also give orders to your units, for example sending a worker to mine from a mineral field which is not in your current vision.
I need a way to know what unit is the target of an order. with the worker and mineral example, I need to know which mineral patch the worker is being ordered to mine from. If the mineral patch is within my vision you can use the trigger "target of order" to retrieve the target, "target location of order" gives the units position. But when that target is outside of vision "target of order" returns null and "target location of order" returns null as well.
It only changed in a patch earlier this year. It used to work as expected where you could get the target unit even if you didn't have vision of it, so Blizzard has changed things since that patch.
My initial reaction was to just give players vision of all the mineral patches which solves that problem... But I have lots of players bitching to me about how I need to fix it! For whatever strange reason people are upset that they share vision with the mineral patches. So if it's important to them then I must find a way to fix it.
tldr; Does anyone on SC2mapster have any ideas about how I can figure out what unit is the target of an order?
EDIT: getting the ability command for the above case is still "harvest" ability, so the unit knows that it is going to use the harvest ability on it's target. But I can't figure out a way to get the target.
Maybe something like:
Action
Unit uses harvest ability
function - get unit in unit group closest to point. Specify the unit group to be minerals, and the point to be the player's mouse cursor world position.
The problem is that the "ghost" units you target are not real.
This has always been a massive "pain in the (you know)" for RTS developers. You want to keep a snap shot of what they know while also not divulging its current state in any way. As such the "unit" you target through the fog of war is not the actual unit, but a "ghost" of that unit. The ghost will be there until the unit is revealed in sight again, or is discovered to be dead.
Old RTS games like Age of Empires and Empire Earth used special ghost units for this, which were declared like normal units but were separate data entries. Newer ones are designed specifically to support this in an easy to use way.
The problem still remains that when you target such a "ghost" you are not targeting a unit or a point. The order generated must be a special order with a special ghost target which then resolves into an actual order at the time the ghost is revealed (a unit if still alive, otherwise a point). Ghost orders are not supported by the triggers as far as I know (how would one interpret them in a meaningful way?).
My recommendation is that instead of running the triggers in response to the order, you run them in response to an action. When the action occurs the ghost would have been resolved so there is no ambiguity as to what the target is.
thing is I need to erase the unit and then replace it with another. This replacement unit needs to be given the same orders as the killed unit.
It's not just for minerals, say if it was a marine given a move instruction to a Xel'Naga tower. I need to be able to kill that marine and create a new unit which has the same order. If I can resolve the target unit then all I have to do is extract the ability and the target from the first unit and issue that command to the second unit.
One thing I've tried is granting vision temporarily. So for the marine moving to the xelnaga tower which is not in vision. I grant vision of the whole map, wait 0.5 seconds (in case the vision isn't automatic or it takes the game a while to resolve the ghost units), then try and extract the target, then proceed as normal.
However the ghost unit is not resolved when the player gets vision of the unit (the player gets vision of the whole map in this example), the ghost unit gets resolved when the unit reaches the destination.
Using mouse positions would be disasterous as every time a unit was issued a command I would have to run multiple checks and get the mouse coordinates and figure out what units are nearby. That's not just player issued orders either, that's every time a unit comes out of a structure and has a waypoint, every time a swarm host spawns units, or every time a worker mines minerals it is assigned new orders to return them and come back for more.
For the record, I'd be happy if I could just get it to work with neutral units (minerals, towers, gas guysers, rocks and destructable things in the environment). Getting it to work with enemy structures would be nice but I think it would be a rare occurance so I'm OK with it failing in this rare event.
Sounds like you need to revise your map mechanics. Why remove the ordered unit in the first place?
I need to create an exact snap shot of the game at a given time with enough data to completely recreate the game state so that it would be completely indistinguishable. That is down to every behaviour, cooldown, unit stat, rally point, control group, training slot, upgrade level, player camera position, saved camera location, hotkeys, etcetcetc and an important part of that is that I need to know every detail about every order issued so that it can be 100% recreated. And I need to do this whenever and however many times the player wants to.
When I have a specific question I limit the scope to what is relevant information otherwise I am just wasting everyones time and obscuring what the actual problem is. Then discussion gets side tracked away from what the origional question was about.
Hopefuly, if anyone has any ideas on how I could get at the data I need they can offer a suggestion.
The unit won't use the ability until it reaches its target. Maybe I could try using the "unit is issued order" event and try to see if "triggering ability target unit" can give me the information needed, but I doubt that will be a lead. It's worth trying though, thanks :)
Lol I totally agree :P
yeah, that's what I do with XelNaga towers. But for all other neutral units like minerals and destructable rocks I set their vision range to zero and then share vision between the player and those units. It has the same effect but it's much quicker and easier than creating 200 revealers.