User Tools

Site Tools


4rpl:commands:setunitspecifiedtarget

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
4rpl:commands:setunitspecifiedtarget [2021/01/24 19:50] – added get/set tabs Sanian4rpl:commands:setunitspecifiedtarget [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 5: Line 5:
   * [[4rpl:commands:GetUnitSpecifiedTarget|Get]]   * [[4rpl:commands:GetUnitSpecifiedTarget|Get]]
   * [[4rpl:commands:SetUnitSpecifiedTarget|Set]]   * [[4rpl:commands:SetUnitSpecifiedTarget|Set]]
 +  * [[4rpl:commands:ClearUnitSpecifiedTarget|Clear]]
 </WRAP> </WRAP>
  
Line 11: Line 12:
  
 ===== Description ===== ===== Description =====
-Sets a unit's specified target. The specified target is a map cell location that is set either by the player 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. 
-It typically shows up for units that allow specified target to be set in their cpack settings. When a unit allows this, it will show a target icon that follows + 
-the mouse when selected.  The specified target is good for units that like to allow a player to specify where they should fire. +''<-pos'' must be 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 value to set is a vector consisting of three coordinates The map position is in the X and Z locations The Y value of the vector is ignored.+ 
 +---- 
 + 
 +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 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 neatlyJust 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 =====
4rpl/commands/setunitspecifiedtarget.1611517809.txt.gz · Last modified: 2025/02/14 14:56 (external edit)