Raised This Month: $ Target: $400
 0% 

Permanent Field of View change?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kocayine
New Member
Join Date: Feb 2014
Old 02-21-2014 , 08:57   Permanent Field of View change?
Reply With Quote #1

Hey there. I've been searching for a good time now for a simple plugin that changes the FOV of all players to something fixed (110 I'm thinking). Because in 1.6 the FOV is way too low on widescreen resolutions.

Setting it manually would also be ok, and I actually found a script that does this:
https://forums.alliedmods.net/showth...&highlight=FOV

The 2nd post by "TheRadiance".

However, when the zoom on a weapon is used then the FOV gets reset to 90. So what I'm basically looking to do is keep that FOV on 110 (or reset to 110 after unzoom). Actually, it also seems it can also be set once and even tho setting something like 110, which is not that high, it always sets the fov to something that looks like 170. After death it also resets. So yeah, that script is a bit wonky. Hope it can be done better.

If there's somehow a way to 'unlock' default_fov to be changeable, that'd work too.

My scripting knowledge is very limited, sorry, but I hope someone can help me with this.

Last edited by Kocayine; 02-21-2014 at 09:03.
Kocayine is offline
Kocayine
New Member
Join Date: Feb 2014
Old 02-23-2014 , 11:24   Re: Permanent Field of View change?
Reply With Quote #2

No one? It's a little thing, innit? I know it's probably a bit rude to just sign up and make ones first post a request but still...
Kocayine is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Location: Tunisia
Old 02-23-2014 , 11:49   Re: Permanent Field of View change?
Reply With Quote #3

I dont know if this helps this code from zp5:
PHP Code:
/*================================================================================
    
    ----------------------------
    -*- [ZP] Zombie Features -*-
    ----------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <amx_settings_api>
#include <cs_ham_bots_api>
#include <zp50_core>
#define LIBRARY_NEMESIS "zp50_class_nemesis"
#include <zp50_class_nemesis>
#define LIBRARY_ASSASSIN "zp50_class_assassin"
#include <zp50_class_assassin>

// Settings file
new const ZP_SETTINGS_FILE[] = "zombieplague.ini"

new const bleeding_decals[] = { 99 107 108 184 185 186 187 188 189 }

new Array:
g_bleeding_decals

#define TASK_BLOOD 100
#define ID_BLOOD (taskid - TASK_BLOOD)

#define CS_DEFAULT_FOV 90

new g_IsModCZ
new g_MsgSetFOV

new cvar_zombie_fovcvar_zombie_silentcvar_zombie_bleeding

public plugin_init()
{
    
register_plugin("[ZP] Zombie Features"ZP_VERSION_STRING"ZP Dev Team")
    
    
g_MsgSetFOV get_user_msgid("SetFOV")
    
register_message(g_MsgSetFOV"message_setfov")
    
    
cvar_zombie_fov register_cvar("zp_zombie_fov""110")
    
cvar_zombie_silent register_cvar("zp_zombie_silent""1")
    
cvar_zombie_bleeding register_cvar("zp_zombie_bleeding""1")
    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
RegisterHamBots(Ham_Killed"fw_PlayerKilled")
    
    
// Check if it's a CZ server
    
new mymod[6]
    
get_modname(mymodcharsmax(mymod))
    if (
equal(mymod"czero")) g_IsModCZ 1
}

public 
plugin_precache()
{
    
// Initialize arrays
    
g_bleeding_decals ArrayCreate(11)
    
    
// Load from external file
    
amx_load_setting_int_arr(ZP_SETTINGS_FILE"Zombie Decals""DECALS"g_bleeding_decals)
    
    
// If we couldn't load from file, use and save default ones
    
new index
    
if (ArraySize(g_bleeding_decals) == 0)
    {
        for (
index 0index sizeof bleeding_decalsindex++)
            
ArrayPushCell(g_bleeding_decalsbleeding_decals[index])
        
        
// Save to external file
        
amx_save_setting_int_arr(ZP_SETTINGS_FILE"Zombie Decals""DECALS"g_bleeding_decals)
    }
}

public 
plugin_natives()
{
    
set_module_filter("module_filter")
    
set_native_filter("native_filter")
}
public 
module_filter(const module[])
{
    if (
equal(moduleLIBRARY_NEMESIS) || equal(moduleLIBRARY_ASSASSIN))
        return 
PLUGIN_HANDLED;
    
    return 
PLUGIN_CONTINUE;
}
public 
native_filter(const name[], indextrap)
{
    if (!
trap)
        return 
PLUGIN_HANDLED;
        
    return 
PLUGIN_CONTINUE;
}

// Ham Player Killed Forward
public fw_PlayerKilled(victimattackershouldgib)
{
    
// Remove bleeding task
    
remove_task(victim+TASK_BLOOD)
}

public 
client_disconnect(id)
{
    
// Remove bleeding task
    
remove_task(id+TASK_BLOOD)
}

public 
message_setfov(msg_idmsg_destmsg_entity)
{
    if (!
is_user_alive(msg_entity) || !zp_core_is_zombie(msg_entity) || get_msg_arg_int(1) != CS_DEFAULT_FOV)
        return;
    
    
set_msg_arg_int(1get_msg_argtype(1), get_pcvar_num(cvar_zombie_fov))
}

public 
zp_fw_core_infect_post(idattacker)
{
    
// Set custom FOV?
    
if (get_pcvar_num(cvar_zombie_fov) != CS_DEFAULT_FOV && get_pcvar_num(cvar_zombie_fov) != 0)
    {
        
message_begin(MSG_ONEg_MsgSetFOV_id)
        
write_byte(get_pcvar_num(cvar_zombie_fov)) // angle
        
message_end()
    }
    
    
// Remove previous tasks
    
remove_task(id+TASK_BLOOD)
    
    
// Nemesis Class loaded?
    
if (!LibraryExists(LIBRARY_NEMESISLibType_Library) || !zp_class_nemesis_get(id))
    {
        
// Set silent footsteps?
        
if (get_pcvar_num(cvar_zombie_silent))
            
set_user_footsteps(id1)
        
        
// Zombie bleeding?
        
if (get_pcvar_num(cvar_zombie_bleeding))
            
set_task(0.7"zombie_bleeding"id+TASK_BLOOD__"b")
    }
    
// Assassin Class loaded?
    
else if (!LibraryExists(LIBRARY_ASSASSINLibType_Library) || !zp_class_assassin_get(id))
    {
        
// Set silent footsteps?
        
if (get_pcvar_num(cvar_zombie_silent))
            
set_user_footsteps(id1)
        
        
// Zombie bleeding?
        
if (get_pcvar_num(cvar_zombie_bleeding))
            
set_task(0.7"zombie_bleeding"id+TASK_BLOOD__"b")
    }
    else
    {
        
// Restore normal footsteps?
        
if (get_pcvar_num(cvar_zombie_silent))
            
set_user_footsteps(id0)
    }
}

public 
zp_fw_core_cure_post(idattacker)
{
    
// Restore FOV?
    
if (get_pcvar_num(cvar_zombie_fov) != CS_DEFAULT_FOV && get_pcvar_num(cvar_zombie_fov) != 0)
    {
        
message_begin(MSG_ONEg_MsgSetFOV_id)
        
write_byte(CS_DEFAULT_FOV// angle
        
message_end()
    }
    
    
// Restore normal footsteps?
    
if (get_pcvar_num(cvar_zombie_silent))
        
set_user_footsteps(id0)
    
    
// Remove bleeding task
    
remove_task(id+TASK_BLOOD)
}

// Make zombies leave footsteps and bloodstains on the floor
public zombie_bleeding(taskid)
{
    
// Only bleed when moving on ground
    
if (!(pev(ID_BLOODpev_flags) & FL_ONGROUND) || fm_get_speed(ID_BLOOD) < 80)
        return;
    
    
// Get user origin
    
static Float:originF[3]
    
pev(ID_BLOODpev_originoriginF)
    
    
// If ducking set a little lower
    
if (pev(ID_BLOODpev_bInDuck))
        
originF[2] -= 18.0
    
else
        
originF[2] -= 36.0
    
    
// Send the decal message
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_WORLDDECAL// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
write_byte(ArrayGetCell(g_bleeding_decalsrandom_num(0ArraySize(g_bleeding_decals) - 1)) + (g_IsModCZ 12)) // decal number (offsets +12 for CZ)
    
message_end()
}

// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
    static 
Float:velocity[3]
    
pev(entitypev_velocityvelocity)
    
    return 
floatround(vector_length(velocity));

__________________
JusTGo is offline
Kocayine
New Member
Join Date: Feb 2014
Old 02-23-2014 , 13:42   Re: Permanent Field of View change?
Reply With Quote #4

Thanks for your post, but I don't know what to do with this. I could imagine this part of this 'zombie mod' got a FOV changer but I can't even compile the script without errors.
Kocayine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-23-2014 , 14:57   Re: Permanent Field of View change?
Reply With Quote #5

Try this.

Cvar in amxx.cfg :

amx_fov_default 110
Attached Files
File Type: sma Get Plugin or Get Source (default_fov.sma - 965 views - 787 Bytes)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Kocayine
New Member
Join Date: Feb 2014
Old 02-23-2014 , 15:10   Re: Permanent Field of View change?
Reply With Quote #6

Works a bloody charm mate, thank you so much !
Kocayine is offline
Snazz
New Member
Join Date: Jan 2018
Old 01-25-2018 , 18:50   Re: Permanent Field of View change?
Reply With Quote #7

Pardon the bump.

The plugin ConnorMcLeod posted works well for CS 1.6, I was hoping it would also work for Natural Selection 3.2.

I've confirmed the plugin is running in NS but it doesn't change the field of view.

Any ideas on how to make it compatible?
Snazz is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-26-2018 , 06:27   Re: Permanent Field of View change?
Reply With Quote #8

Quote:
Originally Posted by Snazz View Post
Pardon the bump.

The plugin ConnorMcLeod posted works well for CS 1.6, I was hoping it would also work for Natural Selection 3.2.

I've confirmed the plugin is running in NS but it doesn't change the field of view.

Any ideas on how to make it compatible?
Plugin is for cs, not surprised it does not work. You need to find the value of m_iFOV offset for your game.
__________________
HamletEagle is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 02-19-2021 , 03:22   Re: Permanent Field of View change?
Reply With Quote #9

I need fov offset for HL1, how I can find them?

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #pragma semicolon 1 #define PLUGIN "Default FOV" #define VERSION "0.0.1" new g_pCvarFov; public plugin_init() {     register_plugin( PLUGIN, VERSION, "ConnorMcLeod" );     g_pCvarFov = register_cvar("amx_fov_default", "110");     RegisterHam(Ham_Spawn, "player", "OnCBasePlayer_Spawn_P", true); } public OnCBasePlayer_Spawn_P(id) {     if( is_user_alive(id) )     {         pev(id, pev_fov, get_pcvar_num(g_pCvarFov));     } }
I tried to use pev, but nothing happens

Last edited by ZASTRELIS; 02-19-2021 at 04:14.
ZASTRELIS is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-19-2021 , 08:29   Re: Permanent Field of View change?
Reply With Quote #10

The "pev" function returns a value. What you need is "set_pev". Your line of code has no effect.

If that doesn't work, pretty sure SetFOV is supported in HL.

Code:
static iSetFOV if(!iSetFov) {     iSetFov = get_user_msgid("SetFOV") } message_begin(MSG_ONE, iSetFov, _, id) write_byte(get_pcvar_num(g_pCvarFov)) message_end()
__________________

Last edited by OciXCrom; 02-19-2021 at 08:30.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:25.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode