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.
[09:24 pm]
Moose -- denis
[05:00 pm]
lil-Inferno -- benis
[10:41 am]
v9bettel -- Nice
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[2024-4-18. : 10:11 pm]
Ultraviolet -- :P
[2024-4-18. : 10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
Please log in to shout.


Members Online: jjf28