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.
[02:53 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: I'll check it out this weekend!
Thanks
[02:47 am]
Symmetry -- I'll check it out this weekend!
[02:40 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: Another map maker? Damn we really ARE back
I invite you to try out the map I modified. I don't have the creativity to create maps from scratch, but I do have the know-how to modify existing ones; my project is to tweak community campaigns (specifically those with errors—to make them playable.
[02:27 am]
Symmetry -- Another map maker? Damn we really ARE back
[01:51 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Now that I wanted to change my avatar, the error image is showing up, haha.
[01:34 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
I invite you to try out a mission I'm modifying from *StarCraft Reversed*; I'm trying to make it more playable and challenging.
[01:33 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
[01:31 am]
Ultraviolet -- Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Is it forbidden to have a large avatar?
actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
[12:20 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: https://staredit.net/profile/133367/ dude's avatar is massive
Is it forbidden to have a large avatar?
[12:04 am]
Ultraviolet -- https://staredit.net/profile/133367/ dude's avatar is massive
Please log in to shout.


Members Online: UndeadStar, Ultraviolet