For some reason when i shoot a unit it only affects it when i shoot directly at 0.00 height or their max height, in between doesn't work which it should,
BTW i made each units shield regen rate their max height
Traceline
Options: Action
Return Type: (None)
Parameters
Camera Position = No Point <Point>
Camera Height = 0.0 <Real>
Player = 0 <Integer>
Grammar Text: Traceline(Camera Position, Camera Height, Player)
Hint Text: (None)
Custom Script Code
Local Variables
A = 0 <Integer>
Pitch = (Current camera pitch of player Player) <Real>
Yaw = (Current camera yaw of player Player) <Real>
Trace Height = 0.0 <Real>
Trace Distance = 0.0 <Real>
Trace Point = No Point <Point>
Trace World Height = 0.0 <Real>
Trace Region = No Region <Region>
Unit Region = No Region <Region>
Closest Unit = No Unit <Unit>
Unit World Height = 0.0 <Real>
Actions
General - For each integer A from 1 to 200 with increment 1, do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Trace Distance < 50.0
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
Pitch < 90.0
Then
Variable - Set Trace Height = (* ((Tan(Pitch)), Trace Distance, -1.0))
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Pitch > 270.0
Then
Variable - Set Trace Height = ((Tan((360.0 - Pitch))) * Trace Distance)
Else
Variable - Set Trace Point = (Camera Position offset by Trace Distance towards Yaw degrees)
Variable - Set Trace World Height = (Ground height at Trace Point)
Variable - Set Trace Region = (Region(Trace Point, 1.5))
Variable - Set Closest Unit = (Closest unit to Trace Point in (Any units in Trace Region owned by player 15 matching Excluded: Missile, Dead, Invulnerable, with at most Any Amount))
Variable - Set Unit Region = (Region((Position of Closest Unit), (Closest Unit Radius (Current))))
Variable - Set Unit World Height = ((Unit type of Closest Unit) Height)
UI - Display (Name of (Unit type of Closest Unit)) for (All players) to Subtitle area
General - If (Conditions) then do (Actions) else do (Actions)
If
Closest Unit != No Unit
Closest Unit != Main Unit[Player]
(Trace Point is in Unit Region) == true
((Camera Height + Trace Height) - Unit World Height) <= ((Unit type of Closest Unit) Shields Regen Rate)
((Camera Height + Trace Height) - Unit World Height) >= Unit World Height
Then
Variable - Set traceline_CurrentTarget[Player] = Closest Unit
Variable - Set traceline_CurrentTargetPoint[Player] = Trace Point
Variable - Set traceline_CurrentTargetHeight[Player] = (Camera Height + Trace Height)
General - Custom Script: return;
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Camera Height + Trace Height) <= 0.0
Then
Variable - Set traceline_CurrentTarget[Player] = Closest Unit
Variable - Set traceline_CurrentTargetPoint[Player] = Trace Point
Variable - Set traceline_CurrentTargetHeight[Player] = (Camera Height + Trace Height)
General - Custom Script: return;
Else
Variable - Modify Trace Distance: + 0.25
Else
Variable - Set traceline_CurrentTarget[Player] = No Unit
Variable - Set traceline_CurrentTargetPoint[Player] = No Point
Variable - Set traceline_CurrentTargetHeight[Player] = 0.0
First of all how does this ever fall in?
General - If (Conditions) then do (Actions) else do (Actions)
If
(Camera Height + Trace Height) <= 0.0
Then
Variable - Set traceline_CurrentTarget[Player] = Closest Unit
Variable - Set traceline_CurrentTargetPoint[Player] = Trace Point
Variable - Set traceline_CurrentTargetHeight[Player] = (Camera Height + Trace Height)
And Variable - Set Unit World Height = ((Unit type of Closest Unit) Height) should be Variable - Set Unit World Height = (Ground height at Position of Closest Unit). I also don't know why you replaced the while loop Trace Distance < 50.0 for a for each integer loop.
There are a couple of more things but I think you should recheck rrowlands tutorial (where I suspect you took most of the parts from) and make the script the same as his. The unit max height you can just set through a simple if then else loop. If Unit Type = [Insert Name Here] set variable Unit Max Height = whichever max height value you want.
the only thing your shooting is zerg, which wont have shields :P and also i had the if then else for every unit and it just does the same thing 0.o
ps. when i try his tutorial's script it doesnt work like it should
For some reason when i shoot a unit it only affects it when i shoot directly at 0.00 height or their max height, in between doesn't work which it should,
BTW i made each units shield regen rate their max height
Traceline
Options: Action
Return Type: (None)
Parameters
Camera Position = No Point <Point>
Camera Height = 0.0 <Real>
Player = 0 <Integer>
Grammar Text: Traceline(Camera Position, Camera Height, Player)
Hint Text: (None)
Custom Script Code
Local Variables
A = 0 <Integer>
Pitch = (Current camera pitch of player Player) <Real>
Yaw = (Current camera yaw of player Player) <Real>
Trace Height = 0.0 <Real>
Trace Distance = 0.0 <Real>
Trace Point = No Point <Point>
Trace World Height = 0.0 <Real>
Trace Region = No Region <Region>
Unit Region = No Region <Region>
Closest Unit = No Unit <Unit>
Unit World Height = 0.0 <Real>
Actions
General - For each integer A from 1 to 200 with increment 1, do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Trace Distance < 50.0
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
Pitch < 90.0
Then
Variable - Set Trace Height = (* ((Tan(Pitch)), Trace Distance, -1.0))
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Pitch > 270.0
Then
Variable - Set Trace Height = ((Tan((360.0 - Pitch))) * Trace Distance)
Else
Variable - Set Trace Point = (Camera Position offset by Trace Distance towards Yaw degrees)
Variable - Set Trace World Height = (Ground height at Trace Point)
Variable - Set Trace Region = (Region(Trace Point, 1.5))
Variable - Set Closest Unit = (Closest unit to Trace Point in (Any units in Trace Region owned by player 15 matching Excluded: Missile, Dead, Invulnerable, with at most Any Amount))
Variable - Set Unit Region = (Region((Position of Closest Unit), (Closest Unit Radius (Current))))
Variable - Set Unit World Height = ((Unit type of Closest Unit) Height)
UI - Display (Name of (Unit type of Closest Unit)) for (All players) to Subtitle area
General - If (Conditions) then do (Actions) else do (Actions)
If
Closest Unit != No Unit
Closest Unit != Main Unit[Player]
(Trace Point is in Unit Region) == true
((Camera Height + Trace Height) - Unit World Height) <= ((Unit type of Closest Unit) Shields Regen Rate)
((Camera Height + Trace Height) - Unit World Height) >= Unit World Height
Then
Variable - Set traceline_CurrentTarget[Player] = Closest Unit
Variable - Set traceline_CurrentTargetPoint[Player] = Trace Point
Variable - Set traceline_CurrentTargetHeight[Player] = (Camera Height + Trace Height)
General - Custom Script: return;
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Camera Height + Trace Height) <= 0.0
Then
Variable - Set traceline_CurrentTarget[Player] = Closest Unit
Variable - Set traceline_CurrentTargetPoint[Player] = Trace Point
Variable - Set traceline_CurrentTargetHeight[Player] = (Camera Height + Trace Height)
General - Custom Script: return;
Else
Variable - Modify Trace Distance: + 0.25
Else
Variable - Set traceline_CurrentTarget[Player] = No Unit
Variable - Set traceline_CurrentTargetPoint[Player] = No Point
Variable - Set traceline_CurrentTargetHeight[Player] = 0.0
I hope for swift responses XD
@Splashy5
First of all how does this ever fall in?
General - If (Conditions) then do (Actions) else do (Actions)
If
(Camera Height + Trace Height) <= 0.0
Then
Variable - Set traceline_CurrentTarget[Player] = Closest Unit
Variable - Set traceline_CurrentTargetPoint[Player] = Trace Point
Variable - Set traceline_CurrentTargetHeight[Player] = (Camera Height + Trace Height)
And Variable - Set Unit World Height = ((Unit type of Closest Unit) Height) should be Variable - Set Unit World Height = (Ground height at Position of Closest Unit). I also don't know why you replaced the while loop Trace Distance < 50.0 for a for each integer loop.
There are a couple of more things but I think you should recheck rrowlands tutorial (where I suspect you took most of the parts from) and make the script the same as his. The unit max height you can just set through a simple if then else loop. If Unit Type = [Insert Name Here] set variable Unit Max Height = whichever max height value you want.
@Twinmold20:
plz type it in plain text i cant read that XD
@Beffyman: Go
Sorry, my mistake.
read my first post the Shield regen rate of the units that i set is their max height
also i set the loop to 200 for random purposes when i was testing it :P
@Beffyman: Go
That is just restrictive. Anyway I suggest you to check through rrowlands tutorial again.
@Twinmold20:
the only thing your shooting is zerg, which wont have shields :P and also i had the if then else for every unit and it just does the same thing 0.o
ps. when i try his tutorial's script it doesnt work like it should
@Beffyman: Go
In which way doesn't it work like it should?
@Twinmold20:
it only hits the target when im right infront of them for some reason it only detects the first loop even when the parameters are right
<<reply 184978>>
So the function you had looked exactly like this?
while(lv_traceDistance < 50.0) {
if(lv_pitch < 90){
lv_traceHeight = Tan(lv_pitch) * lv_traceDistance * (-1);
} else if(lv_pitch > 270) {
lv_traceHeight = Tan(360 - lv_pitch) * lv_traceDistance;
}
lv_tracePoint = PointWithOffsetPolar(lp_cameraPosition, lv_traceDistance, lv_yaw);
lv_traceWorldHeight = WorldHeight(c_heightMapGround, lv_tracePoint);
lv_traceRegion = RegionCircle(lv_tracePoint, 1.5);
lv_closestUnit = libNtve_gf_ClosestUnitToPoint(lv_tracePoint, UnitGroup(null, 15, lv_traceRegion, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
lv_unitRegion = RegionCircle(UnitGetPosition(lv_closestUnit), UnitGetPropertyFixed(lv_closestUnit, c_unitPropRadius, true));
lv_unitWorldHeight = WorldHeight(c_heightMapGround, UnitGetPosition(lv_closestUnit));
if(lv_closestUnit != null &&
lv_closestUnit != gv_mainUnit &&
RegionContainsPoint(lv_unitRegion, lv_tracePoint) &&
lp_cameraHeight + lv_traceHeight - lv_unitWorldHeight >= 0.0 &&
lp_cameraHeight + lv_traceHeight - lv_unitWorldHeight <= UnitGetPropertyFixed(lv_closestUnit, c_unitPropRadius, true)) {
gv_traceline_currentTarget[lp_player] = lv_closestUnit;
gv_traceline_currentTargetPoint[lp_player] = lv_tracePoint;
gv_traceline_currentTargetHeight[lp_player] = lp_cameraHeight + lv_traceHeight;
return;
}
if(lp_cameraHeight + lv_traceHeight <= lv_traceWorldHeight) {
gv_traceline_currentTarget[lp_player] = null;
gv_traceline_currentTargetPoint[lp_player] = lv_tracePoint;
gv_traceline_currentTargetHeight[lp_player] = lp_cameraHeight + lv_traceHeight;
return;
}
lv_traceDistance += 0.5;
}
gv_traceline_currentTarget[lp_player] = null;
gv_traceline_currentTargetPoint[lp_player] = null;
gv_traceline_currentTargetHeight[lp_player] = 0.0;
And you are sure you entered the camera height as the ground height plus whatever the height offset for the camera is?
copy paste = fail doesnt work even when all parameters and variables are there...