Staredit Network > Forums > SC2 Assistance > Topic: [SOLVED] Traceline/Adding crosshairs
[SOLVED] Traceline/Adding crosshairs
This topic is locked. You can no longer write replies here.
May 21 2010, 9:44 pm
By: FatalException  

May 21 2010, 9:44 pm FatalException Post #1



So I've been figuring out how to get a third-person shooter system going, and I have the WASD movement, the mouselook, and the 3D aiming and shooting in, but I can't seem to get anything that indicates just where you're aiming in three dimensions. Anyone know how to make a crosshair at a 3D point?

Edit: Also, see post #7 for current problems.

I fixed it. It was all kinds of broken; I have no idea how it's working for all those other people.

Post has been edited 3 time(s), last time on May 28 2010, 6:09 pm by FatalException.



None.

May 21 2010, 10:12 pm 13Stallion Post #2



I believe the crosshair is created by making an image/ dialog item image centered on your screen.

To find out where your aiming you have to make the unit face the position of your camera(yaw) and use the facing angle of unit as the angle that you fire in.

I would assume you have to use a projectile system as well.

Heres a map that should help you out

Attachments:
3PShooter_Advanced.SC2Map
Hits: 9 Size: 161.34kb



None.

May 21 2010, 10:24 pm FatalException Post #3



Yes, as I said, I have the aiming and firing working fine, but the center of the screen is not exactly where the shots go, so putting a crosshair there would be unreliable, and if I try to create some kind of sprite at a point where the player is aiming, it doesn't appear in the right place on the z-axis, so you can't tell how high you're aiming. Are there any sprites that can be placed anywhere on the z-axis and won't move?

Also, why are buildings and large units so hard to shoot? How can I make their hitboxes cover their entire models?



None.

May 21 2010, 10:49 pm 13Stallion Post #4



Here's an amazing tutorial from Sc2Mapster
-1:40 to view his headshot detection. Simply fantastic!

http://forums.sc2mapster.com/development/tutorials/1626-trigger-how-to-target-with-mouselook-tracelines/




None.

May 22 2010, 12:29 am FatalException Post #5



I scrapped what I had and put in that traceline stuff, but now when I try to use my firing function, I just get errors:

Code
Trigger error in 'gt_fire_Func': could not get 'p' from parameter in 'PointGetY' (value: 0). Trigger error in 'gt_fire_Func': could not get 'p' from parameter in 'PointGetX' (value: 0).


Post has been edited 1 time(s), last time on May 22 2010, 6:43 am by FatalException.



None.

May 22 2010, 1:18 am 13Stallion Post #6



-Condition-
traceline_current Target[0] != No unit

-I removed this from your "fire" trigger and the error disappeared. I still didnt see any explosion animation or w/e on the target units so i guess something else is wrong too. Im not a pro or anything with this stuff so sorry that I can't help you out very much.

-I have a map of my own that I actually left mouse relative off and you simply fire at targets by left-clicking them. Target detection is controlled via the unit-selection event. The major downside is that you cannot move the camera via mouse, which has its own problems. I hope Blizzard will allow us to have an option to enable using of the mouse with mouse relative mode on

Edit: I don't think your fire trigger has any problems, its probably something to do with the traceline function

Post has been edited 1 time(s), last time on May 22 2010, 1:26 am by 13Stallion.



None.

May 22 2010, 6:42 am FatalException Post #7



Yeah, the fire function is working fine. I added some debug script so it returns the coordinates of the traceline target point, and it always returns the coordinates of my unit and 0 height. I tried making it so the traceline function started at a distance of 0.25 from my unit and searched a circle with a radius of 0.2 so it couldn't target my unit, but that didn't fix anything. If someone who knows what they're doing could have a look at this, that would be great.

The attached version is current as of posting.

Edit: Now it won't let me put any debug script in, so I can't even check the values that the traceline function is getting as it's running. This is really fucking pissing me off.

Edit 2: After finding a way around the debug script problem, I've found that the function seems to think it's finished as soon as it's started, because for some reason, the traceline always starts at height 0, and if it goes below ground level, it stops. I made it so the function only stops when it's traced the entire line, and the point moves properly.


Edit 3: I fixed the height problem, and now I can shoot terrain beautifully. The problem is that now it either doesn't detect units where I'm pointing or it doesn't return a unit value in the target variable. Still need help, updated version attached. Also, if I'm getting "Too many threads" errors, does that mean that I'm telling the processor to do too much?

Attachments:
test 2a.SC2Map
Hits: 6 Size: 258.11kb

Post has been edited 4 time(s), last time on May 23 2010, 1:53 am by FatalException.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:19 pm]
Vrael -- IM GONNA MANUFACTURE SOME SPORTBALL EQUIPMENT WHERE THE SUN DONT SHINE BOY
[01:35 am]
Ultraviolet -- Vrael
Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
Gonna put deez sportballs in your mouth
[2024-5-01. : 1:24 pm]
Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
[2024-4-30. : 5:08 pm]
Oh_Man -- https://youtu.be/lGxUOgfmUCQ
[2024-4-30. : 7:43 am]
NudeRaider -- Vrael
Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
[2024-4-29. : 6:36 pm]
RIVE -- Nah, I'm still on Orange Box.
[2024-4-29. : 4:36 pm]
Oh_Man -- anyone play Outside the Box yet? it was a fun time
[2024-4-29. : 12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[2024-4-29. : 11:17 am]
Zycorax -- :wob:
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
Please log in to shout.


Members Online: Roy