@rrowland:
ok i included my map. still got the same problem i havent added anything fancy like moving yet. i am just trying to get the shooting mechanic to work first.
Okay. You're passing in the player "0" which is a neutral player, so its pitch and yaw will always be the same. You need to pass player 1. Also, the height you're passing is 4.1 which is the worldheight + 0.1, which is not high enough. The marine is about 1.0 high, so you'll want to make that WorldHeight + 1. If you plan on making your character able to leave the ground by jumping or whatnot, you'll want to make it WorldHeight + UnitHeight + 1. If you change your camera height you will want to adjust the 1.0 to the new camera height.
As for the error, for some reason you're using the traceline position in your set camera bounds statement, which doesn't make much sense. Set your camera bounds to a circle at the position of your main unit with a radius of 0.1.
I have this slightly working now. The problem is that to get a unit target with the traceline, I have to aim at the position of the unit. So for example if I'm aiming at the head it won't recognize that.
ok i fixed the camera looking up but what do you mean by add the camera to a circle. right now i've attached it to a local variable that gives the position of the main unit with an offset. but i have to do that on a 0.0 timer and its choppy as hell. in your video your camera is silky smooth... does that have anything to do with the fact that you used a custom physics engine? or is it just the circle thingy?
ok i fixed the camera looking up but what do you mean by add the camera to a circle. right now i've attached it to a local variable that gives the position of the main unit with an offset. but i have to do that on a 0.0 timer and its choppy as hell. in your video your camera is silky smooth... does that have anything to do with the fact that you used a custom physics engine? or is it just the circle thingy?
again thanks and any help is much apriciated.
When I looked at your triggers you were setting the camera bounds to some funky rectangle. Instead of "Region from Rectangle" use "Region from Circle". And make the radius 0.1.
i dont think it will help us who dont really understand the scripting language. cause i believe he wrote his entire map using custom scripts, not the trigger editor
I put the traceline into the trigger~ but it's still not working~
the targetunit is always null, plz take a look at my map~
I have no idea what's going on :( THX again
The tutorial is nice, however the function is very inefficient. You should create a line between camera position and clicked location and simply calculate distance from this line for every unit in the general area. You would save the 100 loops. (This test the unit position in 2D, to test it's heigh, calculate distance from camera and you the same formula with Tangens you already used, just calculate constant tangens outside loops)
The tutorial is nice, however the function is very inefficient. You should create a line between camera position and clicked location and simply calculate distance from this line for every unit in the general area. You would save the 100 loops. (This test the unit position in 2D, to test it's heigh, calculate distance from camera and you the same formula with Tangens you already used, just calculate constant tangens outside loops)
How is that? If you mean terrain height, then not, since I suggested to keep the height test you use, only to change the XY position test, which should not be affected by terrain.
Hello, thanks for the tutorial rrowland :D
But i have a problem, it looks like i don't get a target... If someone that got this to work could take a look at my map i would be very happy :D
sebbn
The tutorial is nice, however the function is very inefficient. You should create a line between camera position and clicked location and simply calculate distance from this line for every unit in the general area. You would save the 100 loops. (This test the unit position in 2D, to test it's heigh, calculate distance from camera and you the same formula with Tangens you already used, just calculate constant tangens outside loops)
pretty sure that doesn't work. My traceline calculates range, anything about 160 speed on a projectile doesn't register range.
Ok, sorry to revive a dead thread here, but I'm having trouble implementing the function. I created the traceline function as described with parameters:
Camera Position = (Position of Rogue [41.06, 88.89]) <Point>
Camera Height = TraceH <Real>
Player = 1 <Integer>
Where TraceH is:
TraceH = (+ (2.0, (Height of Main Unit), (Ground height at (Position of Main Unit)))) <Real>.
I then created an attack trigger:
Attack
Events
UI - Player 1 clicks Left mouse button Down.
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
traceline_currentTarget[1] == No Unit
Then
UI - Display "no unit targeted " for (All players) to Subtitle area
Unit - Create 1 Probe for player 1 at traceline_currentTargetPoint[1] using default facing (No Options)
Else
UI - Display (Name of (Unit type of traceline_currentTarget[1])) for (All players) to Subtitle area
Traceline((Position of Main Unit), TraceH, 1)
My problem is that the probe is being created (correctly) at traceline_currentTargetPoint[1], but traceline_currentTarget is not actually targeting a unit, so I get the message "no unit targeted", even though there are a bunch of neutral and enemy units between my unit and the probe. Am I missing something obvious here?
I'm attaching my map, which is basically a stripped-down version of One.Two's WoW map with some modifications to the camera and abilities. The attack trigger is under the folder "Player Spells" and it's called "Attack". In-game, press "f" to start 3rd person movement mode, and middle mouse button to bring back up mouse control.
Thanks!
--edited to reflect map update, now with camera that doesn't point directly at unit and crosshair. still doesn't work.--
Thanks for the help!
I manged to run the map now, but it still didnt work for some reason (the mouseover target).
Thanks anyways! :D
Okay. You're passing in the player "0" which is a neutral player, so its pitch and yaw will always be the same. You need to pass player 1. Also, the height you're passing is 4.1 which is the worldheight + 0.1, which is not high enough. The marine is about 1.0 high, so you'll want to make that WorldHeight + 1. If you plan on making your character able to leave the ground by jumping or whatnot, you'll want to make it WorldHeight + UnitHeight + 1. If you change your camera height you will want to adjust the 1.0 to the new camera height.
As for the error, for some reason you're using the traceline position in your set camera bounds statement, which doesn't make much sense. Set your camera bounds to a circle at the position of your main unit with a radius of 0.1.
I have this slightly working now. The problem is that to get a unit target with the traceline, I have to aim at the position of the unit. So for example if I'm aiming at the head it won't recognize that.
What I have currently is:
Also, I don't know why, but after I've shot a few times the game freezes. Happened every time I've tested the map so far.
@Kanaru: Go
I'm not sure why you're crashing. Disable the effect and sound and shoot a few times and see if it still crashes.
As for the height of the unit, you need to change
So that the right-hand side of the condition is the height of the unit.
It works great now. The crashing was caused by the gauss rifle damage (I don't know why), so I just switched the damage effect to another.
ok i fixed the camera looking up but what do you mean by add the camera to a circle. right now i've attached it to a local variable that gives the position of the main unit with an offset. but i have to do that on a 0.0 timer and its choppy as hell. in your video your camera is silky smooth... does that have anything to do with the fact that you used a custom physics engine? or is it just the circle thingy?
again thanks and any help is much apriciated.
When I looked at your triggers you were setting the camera bounds to some funky rectangle. Instead of "Region from Rectangle" use "Region from Circle". And make the radius 0.1.
@rrowland:
i'm sorry for the brain fart here. but where do i get the circle? or the ractangle for that matter? do you mean a region?
can you upload your tutorial map for us so that we can learn it more faster and clearer :D THX
@robinjfor:
i dont think it will help us who dont really understand the scripting language. cause i believe he wrote his entire map using custom scripts, not the trigger editor
@HaVoC373: Go
I know~ but I have a problem in attaching Traceline script into a trigger, and many other things :(
I put the traceline into the trigger~ but it's still not working~ the targetunit is always null, plz take a look at my map~ I have no idea what's going on :( THX again
Everything works for mine but it's only hitting units when im right in front of them and my mouse is under the texture
The tutorial is nice, however the function is very inefficient. You should create a line between camera position and clicked location and simply calculate distance from this line for every unit in the general area. You would save the 100 loops. (This test the unit position in 2D, to test it's heigh, calculate distance from camera and you the same formula with Tangens you already used, just calculate constant tangens outside loops)
You're forgetting about terrain.
How is that? If you mean terrain height, then not, since I suggested to keep the height test you use, only to change the XY position test, which should not be affected by terrain.
Hello, thanks for the tutorial rrowland :D But i have a problem, it looks like i don't get a target... If someone that got this to work could take a look at my map i would be very happy :D sebbn
pretty sure that doesn't work. My traceline calculates range, anything about 160 speed on a projectile doesn't register range.
.... why can't you delete posts, this forum is so weird sometimes.
Ok, sorry to revive a dead thread here, but I'm having trouble implementing the function. I created the traceline function as described with parameters:
Camera Position = (Position of Rogue [41.06, 88.89]) <Point>
Camera Height = TraceH <Real>
Player = 1 <Integer>
Where TraceH is:
TraceH = (+ (2.0, (Height of Main Unit), (Ground height at (Position of Main Unit)))) <Real>.
I then created an attack trigger:
Attack
Events
UI - Player 1 clicks Left mouse button Down.
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
traceline_currentTarget[1] == No Unit
Then
UI - Display "no unit targeted " for (All players) to Subtitle area
Unit - Create 1 Probe for player 1 at traceline_currentTargetPoint[1] using default facing (No Options)
Else
UI - Display (Name of (Unit type of traceline_currentTarget[1])) for (All players) to Subtitle area
Traceline((Position of Main Unit), TraceH, 1)
My problem is that the probe is being created (correctly) at traceline_currentTargetPoint[1], but traceline_currentTarget is not actually targeting a unit, so I get the message "no unit targeted", even though there are a bunch of neutral and enemy units between my unit and the probe. Am I missing something obvious here?
I'm attaching my map, which is basically a stripped-down version of One.Two's WoW map with some modifications to the camera and abilities. The attack trigger is under the folder "Player Spells" and it's called "Attack". In-game, press "f" to start 3rd person movement mode, and middle mouse button to bring back up mouse control.
Thanks!
--edited to reflect map update, now with camera that doesn't point directly at unit and crosshair. still doesn't work.--