I have a big problem with my scripted weapons: I can't find a way to make snipers zoomable!
Any suggestions of how to do it?
Does anyone have any info about the SetCameraWindow() command? What is the 'Field of View' exactly? It doesn't seem to have effect on anything...
Is there something special I need to know about it?
Scripted zoom
Scripted zoom
Pain is only psychological.
yea i havnt scripted before but when going over the scipts some time ago i saw this and thought yea could be used for sniper
this will cause problems with lod models and would have to reduce the turning rate down so the cpu doesnt have to work over time to see all the distant objects in high detail.
if i understand this correctly then you would have a resolution of say 800x600 and to zoom in you would have a field view of 30,30 in the bottom left corner (so it would be a 30x30 pixle view of what was originaly seen) and get the camera to move to the center of view, so use another command that moves camera view by ## number of pixels x ## number of pixles so it would now be showing the center of what was on the screenSetCameraWindow(float FOV, bool UseWidthHeight, int Left, int Top, int Width/Right, int Height/Bottom);
Sets the field of view of the camera and the size of the camera viewport. If UseWidhtHeigth is true, the last 2 parameters are the width and height of the viewport, otherwise these parameters represent the bottom right corner of the viewport.
this will cause problems with lod models and would have to reduce the turning rate down so the cpu doesnt have to work over time to see all the distant objects in high detail.
*GD*
it seemed to work fine when i used it. Sorry to correct u scott, but your number entries for FOV were way off. FOV sets the zoom amount. The lower the number the more you zoom. RF uses a default FOV of 2. in order to zoom in you need to reduce this number. try these settings:
SetCameraWindow(0.5, true, 100, 100, 640, 480);
SetCameraWindow(0.5, true, 100, 100, 640, 480);
Thanks for that info! I thought FOV was something like degrees and I was trying numbers like 90.RF uses a default FOV of 2
But.... I still couldn't get it to work. However, I've found a way around this.
I can attach a FixedCamera to the player and activate it whenever I need to use the zoom. The SetFixedCameraFOV command works like a dream.
Pain is only psychological.
thats alright, i didnt know how it used the numbers, i thought it would use pixles, so the original would be set at 800x600 at what ever resolution you are using, and from that you specifide how many of those then would be put on the screen, like 30x30, but as i think of it i understand that wouldnt work, but hay, for my very first thought to scriptingi have ever made i was close
*GD*
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
I tested it with this simple script:
First I only had some projectile definitions in the weapon.ini (I'm using scripted weapons, so that's all I need). Not a single weapon definition, and the FOV part of the SetCameraWindow() command didn't work. I could change the size of the viewport but not 'zoom in'.
Then I added one weapon to the weapon.ini. I just copied the 'c8' weapon definition from the RF demo, and wham! it worked just like it's supposed to.
Code: Select all
{
a [1]
Spawn[ ()
{
Console(true);
LowLevel("setup");
} ]
setup[ ()
{
self.ThinkTime = 0;
a = a + 0.1;
SetCameraWindow(sin(a));
} ]
}
Then I added one weapon to the weapon.ini. I just copied the 'c8' weapon definition from the RF demo, and wham! it worked just like it's supposed to.
Pain is only psychological.