HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Sniper Scope

02-25-2004, 06:32 AM#1
SektorGaza
Ok, so I decided to release this. Even though it needs major work I think it's worthy of this forum.

What is it?
Well, as far as I know, nobody has ever came up with a sniper scope. Sure, everyone already knows how to make 3d cam rotate around the unit, sure, people can use arrow keys, that's all simple, but nobody got a good idea for a sniper rifle. Well I'm not saying I came up with complete/graphical sniper scope either, this is merely a concept that could be developed and possibly become popular in sniper games.

How my scope works
Basically there is no fade in/out and no cool crosshair(although that could be made). Yep, too bad fade only works for all players.
So I came up with an idea so that when a player uses a scope there should be some kind of limitation, but at the same time visibility towards the forward of the unit. The farther the zoom, the more is visible in front. And that's basically what I did.
I have 3 different levels of zoom. Well, it's up to the creator of the game really how many to have and how far to zoom. Each level of zoom zooms into the map(in front of the hero) and at the same time he gets a visible view in front of him as far as he's zooming.
I create dummy units in front of the hero in a straight line so that the dummy units open up the visibility for the sniper. The fartherst I create is 2300 units from the hero and each dummy unit has a 400 radius visibilty, thus revealing the area in front in a straight line.

When using the right/left keys, the unit rotates and at the same time the dummy units rotate moving the scope line for the sniper's sight.

Some problems so far:
When hero is issued order to move forward or any direction for that matter while in scope mode, the scope line doesn't move along, it stays behind, so it has to be refreshed in this situation


Well, that's about all explanation I can come up with now, be sure that this can be impoved 100%, but important thing that I came up with some concept how to do it.

Disclamer:

If you want to use it, please give me credit, I prefer my battlenet name, sashok, if you decide to give me credit :D
02-25-2004, 07:26 PM#2
MysticGeneral
Nice - Well done. Try to add in a cool fade filter where it fades in to a circular shape - that would own.
02-25-2004, 10:31 PM#3
SektorGaza
yes, it would definately be cool. Problem is, is it possible though?

Anyway, here's how I did this for all of you that questioning if this is really useful.

Edit: Some other uses you may find in this.
You could make an actual real life tower where the guard or projector light can't really look all around at the same time, it goes in a circle motion uncovering the terrain. Same could be done with a lighthouse, you could make an actual light house, or something in that sense


As you see in the picture, there's your Hero unit, he's standing at certain coordinates(point) x,y. We want to make a unit that will spawn where the hero is facing. For that we need to know what angle hero is facing, that's easy. East being 0 degrees and I believe it goes counterclockwise, making full circle of 360 degrees. So doesn't really matter what the hero is facing, his angle is there.

Then a problem arises, we know the angle, and we also know how far we want to put spawn unit from our hero, so how do we know the coordinates(point) of the new unit?

This is where some trigonometry comes into use. Sohcahtoa lololol
We find cosing of the angle multiplying it by the distance of new unit and the whole thing is substracted from Y coordinate of Hero's unit.
So it will look like this

Ypoint=HeroYpoint-(cosine(facingAngle)*DistanceNewUnit)

and same thing for Xpoint only using sine.

Xpoint=HeroXpoint-(sine(facingAngle)*DistanceNewUnit)

So by knowing our coordinates we can place the new unit now.
02-27-2004, 03:46 PM#4
Kythorak
Light Tower:

All you need to do is have an attachment point that rotates around the tower, like the Blood Mage's balls.

Then, just have the ability "Spotlight" and set the attachment points in the right place, and VOILA, circling searchlight ^^
03-01-2004, 06:49 AM#5
SektorGaza
Quote:
Originally posted by Kythorak
Light Tower:

All you need to do is have an attachment point that rotates around the tower, like the Blood Mage's balls.

Then, just have the ability "Spotlight" and set the attachment points in the right place, and VOILA, circling searchlight ^^



sounds much harder than mine to implement in my point of view, but if possible, your method is much more efficient. But I'm not sure it would do what my method would do.
04-07-2004, 06:53 PM#6
JesusOfNazareth
your download didn't work man... :(

and i badly want to know how to make the sniper thing
04-11-2004, 03:45 AM#7
Pyrokinesis
The map crashes my world editor when trying to open, as if it were protected - says missing trigger unit-x.
04-11-2004, 03:56 AM#8
Wolf Boy
Pyro it works for me... well of course i opened it in umswe ^_^ ^_^ ^_^
04-11-2004, 04:01 AM#9
Pyrokinesis
Ah that explains it.
04-18-2004, 04:59 PM#10
ThyFlame
Quote:
Originally Posted by SektorGaza
yes, it would definately be cool. Problem is, is it possible though?

Anyway, here's how I did this for all of you that questioning if this is really useful.

Edit: Some other uses you may find in this.
You could make an actual real life tower where the guard or projector light can't really look all around at the same time, it goes in a circle motion uncovering the terrain. Same could be done with a lighthouse, you could make an actual light house, or something in that sense


As you see in the picture, there's your Hero unit, he's standing at certain coordinates(point) x,y. We want to make a unit that will spawn where the hero is facing. For that we need to know what angle hero is facing, that's easy. East being 0 degrees and I believe it goes counterclockwise, making full circle of 360 degrees. So doesn't really matter what the hero is facing, his angle is there.

Then a problem arises, we know the angle, and we also know how far we want to put spawn unit from our hero, so how do we know the coordinates(point) of the new unit?

This is where some trigonometry comes into use. Sohcahtoa lololol
We find cosing of the angle multiplying it by the distance of new unit and the whole thing is substracted from Y coordinate of Hero's unit.
So it will look like this

Ypoint=HeroYpoint-(cosine(facingAngle)*DistanceNewUnit)

and same thing for Xpoint only using sine.

Xpoint=HeroXpoint-(sine(facingAngle)*DistanceNewUnit)

So by knowing our coordinates we can place the new unit now.



What?

The sniper scope is already at set offsets, the created unit only needs to be created and hidden at a specific offset, which you can use a variable to see what level of zoom you're using.

Trig is not needed here.
04-18-2004, 07:30 PM#11
SektorGaza
k, do it and post it here please