Both sides previous revisionPrevious revisionNext revision | Previous revision |
4rpl:commands:setunitspecifiedtarget [2022/03/31 02:28] – Expansion of description Vertu | 4rpl:commands:setunitspecifiedtarget [2025/02/14 14:57] (current) – external edit 127.0.0.1 |
---|
Sets a unit's specified target location. The specified target is a map cell location that is set either by player interaction or by script. | Sets a unit's specified target location. The specified target is a map cell location that is set either by player interaction or by script. |
| |
The value to set is a vector consisting of three coordinates. The map position is in the X and Z locations. The Y-value/2nd vector of this V3 is ignored but still needs to "exist" so you can't use only a V2 as the 2nd vector of the V2 will be placed in the Y-vector of the V3 only to then be ignored, causing a V3 of (X Z 0). To avoid this, either use a V3 like in the example or organize a V3 like so: "V3(<-X 0 <-Z)" or "V3(<-.x 0 <-.z)". You can not directly input a V2 into this API because of this need of organizing the stack around the Y-value vector. | ''<-pos'' must be a V3, despite the Y location being completely unused. It expects the vector to be this: ''V3(<-X 0 <-Z)'', so if your input is this; ''V2(<-X <-Z)'' the Z value will be read incorrectly. You may easily "convert" vectors as such: ''V3(swap(EV2(<-vector) 0))'' or ''EV2 0 swap V3'' or ''<-vector.y ->vector.z'' If you are converting two ints into a V3, (like what [[GetUnitCell]] returns,) simply push a 0 and [[swap]]. |
| |
---- | ---- |
The "SpecifiedTarget" only exists when the unit has "Can Specify Target" enabled in their cpack settings, found in the "Basic" tab of Settings. When a unit allows "Can Specify Target", an opaque line or arch (specified by [[SetUnitSpecifiedTargetPathHeight]]((A height of 0 means it will be a line, any other number will produce an arch with an apex of that height value.))) can be seen even when inside or behind terrain along with a visable gray target icon at the SpecifiedTarget location. The gray line can become invisible by using the API [[SetUnitSpecifiedTargetShowPath]] to set it to <color #8BDFFF>false</color>, making __only the gray line invisible__ (except at 0,0,0).\\ | The "SpecifiedTarget" only exists when the unit has "Can Specify Target" enabled in their cpack settings, found in the "Basic" tab of Settings. When a unit allows "Can Specify Target", an opaque line or arch (specified by [[SetUnitSpecifiedTargetPathHeight]]((A height of 0 means it will be a line, any other number will produce an arch with an apex of that height value.))) can be seen even when inside or behind terrain along with a visable gray target icon at the SpecifiedTarget location. The gray line can become invisible by using the API [[SetUnitSpecifiedTargetShowPath]] to set it to <color #8BDFFF>false</color>, making __only the gray line invisible__ (except at 0,0,0).\\ |
Both the gray line (if visible) and gray target marker will follow the mouse when selected. SpecifiedTarget is good for units that like to allow a player to specify where they should fire or, for especially flying and controllable units, move to without involving the unit ghost created by the game's built-in movement system which implies the unit is meant for the ground and not the air. The Thor is a perfect example of using SpecifiedTarget as a way for a player to control air units neatly. Just beware of how visually noisy the opaque lines can be. | Both the gray line (if visible) and gray target marker will follow the mouse when selected. SpecifiedTarget is good for units that like to allow a player to specify where they should fire or, for especially flying and controllable units, move to without involving the unit ghost created by the game's built-in movement system which implies the unit is meant for the ground and not the air. The Thor is a perfect example of using SpecifiedTarget as a way for a player to control air units neatly. Just beware of how visually noisy the opaque lines can be. |
| |
| Note: If you're potentially assigning fractional values to it, it's better to make them integers first. If you assign it to say, 80.8 x, 30 z it will actually round up and target tile 81, but drops the visual marker on tile 80. |
| |
===== Examples ===== | ===== Examples ===== |