Blockland Forums > Modification Help
Set Field-of-View (Fov)
(1/3) > >>
EpicFrySauce:
In the server.cs file of a gun, in the //weapon image section, I added the code

--- Code: ---setFov = 30;
--- End code ---
to try to make the field of view zoom in a little when using the weapon.

So part of my weapon image code now looks like this...


--- Code: ---//weapon image

   mountPoint = 0;
   offset = "0 0 0";
   eyeOffset="0 0.9 -0.07";
   rotation = eulerToMatrix( "0 0 0" );
   setFov = 30;
--- End code ---

The problem is, nothing happens in the game.

How do I change field of view when a weapon is out?


---

Edit: Solved thanks to Munkey

Final code solution:


--- Code: ---function MP40Image2::onMount(%this,%obj,%slot)
{
setFov(30);
}

function MP40Image2::onUnMount(%this,%obj,%slot)
{
setFov(90);
}
--- End code ---
Marcem:
you have to call it when the weapon is equipped, you added a command to a set of values for other things
EpicFrySauce:

--- Quote from: Marcem on December 01, 2011, 07:51:35 PM ---you have to call it when the weapon is equipped, you added a command to a set of values for other things


--- End quote ---

Ah, thank you. So I write a small function for that? I'm quite new to programming so if you could provide a quick code example, that would be great.
Amade:
You would either need client-side coding or a separate player datablock for use with the gun to make this work.
EpicFrySauce:
Crap, guys I'm sorry. I really don't know what to do here. Can someone just make a code example?

I did try something like


--- Code: ---datablock gunImage::onActivate(FovChange)
{
setFov = 30;
}
--- End code ---

and yes, it was a fail.
Navigation
Message Index
Next page

Go to full version