AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   problem with EV_INT_fixangle (https://forums.alliedmods.net/showthread.php?t=61147)

Voi 09-22-2007 07:05

problem with EV_INT_fixangle
 
Code:

new Float:angle[3]
entity_get_vector(id,EV_VEC_angles,angle)

angle[0] += recoil[0]
angle[1] += recoil[1]

entity_set_vector(id,EV_VEC_angles,angle)
entity_set_int(id,EV_INT_fixangle,3)

this should work, but y axis is allways stuck and changing to 0 repeatedly, do anyone know why? when i comment entity_set_int(id,EV_INT_fixangle,1) setting view angle doesnt work

pls help me

Arkshine 09-22-2007 07:13

Re: problem with EV_INT_fixangle
 
1 Attachment(s)
If you want an anti-recoil, see this plugin by VEN.

Voi 09-22-2007 08:33

Re: problem with EV_INT_fixangle
 
no, i want to add an effect of shaking hand while looking to the scope(stalker, call of duty etc.)

i have almost acomplished it, but the y axis stays 0(middle of the screen), and i dont know why, so it moves randomly like it suppose to(axis x and y), but you cant aim up and down(axis y)

i just need it fixed

Voi 09-22-2007 09:44

Re: problem with EV_INT_fixangle
 
i will try it now, thanks for reply

edit:

nah angles[2] = z axis

still the same problem

[ --<-@ ] Black Rose 09-22-2007 15:45

Re: problem with EV_INT_fixangle
 
1 Attachment(s)
You were changin X and Y.
but when i looked at this pic i though that it should be Y and Z.

potatis_invalido 09-22-2007 18:01

Re: problem with EV_INT_fixangle
 
Not tested, but it should work. Notice the change fromentity_get_vector(id,EV_VEC_angle,angle) to entity_get_vector(id,EV_VEC_v_angle,angle)
Code:


new Float:angle[3]
entity_get_vector(id,EV_VEC_v_angle,angle)
 
angle[0] += recoil[0]
angle[1] += recoil[1]
if(angle[0] < -88.994750)
{
angle[0] = -88.994750;
}
else if(angle[0] > 88.994750)
{
angle[0] = 88.994750;
}
if(angle[1] > 180.0)
{
angle[1] -= 360.0;
}
else if(angle[1] < -180.0)
{
angle[1] += 360.0;
}
 
entity_set_vector(id,EV_VEC_angles,angle)
entity_set_int(id,EV_INT_fixangle,1)

This function is tested and works GREEEEAT.
Code:


public recoil_dod_style(id, Float:recoil, no_punch)
{
 new Float:angles[3];
 pev(id, pev_v_angle, angles);
 
 angles[0] -= random_float(recoil * 1.2, recoil * 0.8);
 if(angles[0] < -88.994750)
 {
  angles[0] = -88.994750;
 }
 else if(angles[0] > 88.994750)
 {
  angles[0] = 88.994750;
 }
 
 angles[1] += random_float(recoil * 0.35, recoil * -0.35);
 if(angles[1] > 180.0)
 {
  angles[1] -= 360.0;
 }
 else if(angles[1] < -180.0)
 {
  angles[1] += 360.0;
 }
 if(no_punch == 1)
 {
  set_pev(id, pev_punchangle, Float:{ 0.0, 0.0, 0.0 });
 }
 set_pev(id, pev_angles, angles);
 set_pev(id, pev_fixangle, 1);
}


Voi 10-15-2007 20:14

Re: problem with EV_INT_fixangle
 
set_pev(id, pev_fixangle, 2);

makes adding the angle instead changing it, i try it but it doesnt work

there was a function or something to add an angle to player view but i dont remeber the name

potatis_invalido 10-16-2007 05:30

Re: problem with EV_INT_fixangle
 
Does this do what you want?
Using Engine:
Code:

public add_to_aim(id, Float:up, Float:right)
{
    new Float:angle[3];
    entity_get_vector(id, EV_VEC_v_angle, angle);
    angle[0] -= up;
    angle[1] -= right;
    if(angle[0] < -88.994750)
    {
          angle[0] = -88.994750;
    }
    else if(angle[0] > 88.994750)
    {
          angle[0] = 88.994750;
    }
    if(angle[1] > 180.0)
    {
          angle[1] -= 360.0;
    }
    else if(angle[1] < -180.0)
    {
          angle[1] += 360.0;
    }
 
    entity_set_vector(id, EV_VEC_angles, angle);
    entity_set_int(id, EV_INT_fixangle, 1);
}

Using Fakemeta:
Code:

public add_to_aim(id, Float:up, Float:right)
{
    new Float:angle[3];
    pev(id, pev_v_angle, angle);
    angle[0] -= up;
    angle[1] -= right;
    if(angle[0] < -88.994750)
    {
          angle[0] = -88.994750;
    }
    else if(angle[0] > 88.994750)
    {
          angle[0] = 88.994750;
    }
    if(angle[1] > 180.0)
    {
          angle[1] -= 360.0;
    }
    else if(angle[1] < -180.0)
    {
          angle[1] += 360.0;
    }
 
    set_pev(id, pev_angles, angle)
    set_pev(id, pev_fixangle, 1);
}


Voi 10-17-2007 11:55

Re: problem with EV_INT_fixangle
 
not exacly couse when i call this every second, player isnt able to move the rifle

pls test it yourself

is there a message that adds a vector to player aim ??

potatis_invalido 10-17-2007 15:04

Re: problem with EV_INT_fixangle
 
1 Attachment(s)
Tested. It's working fine. You probably need to call it on playerprethink. This is the script I used to test it:


All times are GMT -4. The time now is 16:17.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.