Hi I am trying to make my own mod.
I played Project Reality and I saw that tanks sights have zoom.
How is it done? In weapons it is simple by adding ObjectTemplate.zoom.addZoomFactor.
In tanks it can be done with this command but I want zoom which activate when X is pressed, not PPM.
Re: Zoom in tanks
Posted: 2014-04-20 19:09
by Mats391
The zoom on PR tanks is done with the smoke-launcher or the coax mg.
For example the us_tnk_m1a2 uses CoaxialBrowning, which you can find in weapon/armament/coaxial_browning and in there you have:
rem ---BeginComp :D efaultZoomComp ---
ObjectTemplate.createComponent DefaultZoomComp
ObjectTemplate.zoom.zoomInput PIFlareFire
ObjectTemplate.zoom.zoomDelay 0
ObjectTemplate.zoom.addZoomFactor 0
ObjectTemplate.zoom.addZoomFactor 0.33
ObjectTemplate.zoom.addZoomFactor 0.1
rem ---EndComp ---
Similar components you will find for any land vehicle that has zoom. Choppers use a different system with cemaras.
Edit:
When you use this way of making zoom make sure the weapon with the zoom comp never gets deselected like the coax mg. Otherwise you will unzoom when switching weapons.
Re: Zoom in tanks
Posted: 2014-04-20 19:59
by czesiek77
Thank you very much! It is that what I have been triying to do for last week.
Re: Zoom in tanks
Posted: 2014-04-21 17:55
by czesiek77
I was wondering about one more thing. How do I move camera in tanks to other side of the barrel?
Re: Zoom in tanks
Posted: 2014-04-21 20:41
by Mats391
You have to change the position of the gunners camera then. To stick with the m1a2 example it would be called "us_tnk_m1a2_Gunner_Camera" it will have similar name to that always and is usually located on the turret somewhere. Best is to check its position in the bf2editor and adjust it to the position you like. However i do not recommend to save it from the editor, just use it as preview and make your changes with notepad directly in the tweak files.
Re: Zoom in tanks
Posted: 2014-04-21 22:29
by czesiek77
Thank you again for helping.
Re: Zoom in tanks
Posted: 2014-04-26 14:34
by czesiek77
Sorry for bothering but I have problem with adding zoom to LAV25. It has problem meybe becouse of guidence?
Re: Zoom in tanks
Posted: 2014-04-26 14:41
by Mats391
I doubt it is a problem with the guidance, other weapons have it and zoom fine (for example most AT vehicles in PR).
Can you post the code you added to zoom? And also are you working on bf2 LAV or PR one?
Re: Zoom in tanks
Posted: 2014-04-26 14:50
by czesiek77
I am working on LAV from other mod, Here is the code :
rem ---BeginComp :D efaultZoomComp ---
ObjectTemplate.createComponent DefaultZoomComp
[color=Red]ObjectTemplate.createComponent DefaultZoomComp[/color]
ObjectTemplate.zoom.zoomInput PIFlareFire
ObjectTemplate.zoom.addZoomFactor 0
ObjectTemplate.zoom.addZoomFactor 0.25
rem ---EndComp ---
You are createing the component twice in there. I also would add "ObjectTemplate.zoom.zoomDelay 0" as i dont know what the default zoom delay is.
What is the "delayToUse"? You wont be able to zoom during that delay or reloading the weapon
Re: Zoom in tanks
Posted: 2014-04-26 15:01
by czesiek77
Ok I will try deleting it and adding zoomdelay.
Re: Zoom in tanks
Posted: 2014-04-26 15:06
by czesiek77
It worked! Thanks!
Re: Zoom in tanks
Posted: 2014-05-11 18:47
by czesiek77
One more thing. Is there anyway to do zoom like in BF3/4? I mean that some parts of hud are magnified?
Re: Zoom in tanks
Posted: 2014-05-11 19:51
by Mats391
Yes and no. There is no thing to check the zoom level, the only way is having a button node that activates when pressing the zoom key. You then cant have a lot of zoom delay or time between changing zoom levels otherwise the HUD wont synch with the zooming.
Easiest way to do that is if you have right mouse as zoom key. For any non mouse button you would likely need some hack like PR did with the C for changing to backup sights.
In want to achive similiar effect in BF2. I ve tried with altguiindex of main cannon but nothing works.
Yes i understand what you are trying and the way i described it was how i did it previously for handheld weapons
Example:
As you can see the indicator on the top switches from WFOV to NFOV when zooming in. I did this with a button node that reacts on right click, but i guess this is no option for vehicles
czesiek77 wrote:When I add altguiindex to main cannon it work but after shot it goes back to normal guiindex.
This seems like a way easier way to do it
I guess the reason it switches back after firing is because your main cannon is reloading then and "unzooms" (view is still zoomed because you have the zoom comp on other weapon). To fix this you can either add the zoom comp to the main cannon and then have the view zoom out after firing. Or you add the guiIndexes to the weapon with zoom comp (e.g. coax) and get the HUD based on that. The second approach might require you to make a lot of unique coax guns.
Re: Zoom in tanks
Posted: 2014-05-12 14:55
by czesiek77
I need only 3 HUDs like that so I have too add Guiindex and altGuiindex to 3 coax guns, am I correct?
Re: Zoom in tanks
Posted: 2014-05-12 17:52
by Mats391
czesiek77 wrote:I need only 3 HUDs like that so I have too add Guiindex and altGuiindex to 3 coax guns, am I correct?
Yes and make sure the main cannon has no guiIndex then or it could give troubles. Best is to set it to -1 i think at least that is how its done on jets with the cannon.