Spread Code

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Fustrun

Artist
Oct 30, 2002
31
0
0
Visit site
Hi hhhmmm
Im having a problem I would be very glad if someone could pls help me out here . . .
Well im writing a code for realistic spread of fire based upon player movment now I have this Line -
If(Instigator.bIsCrouched && VSize(instigator.velocity) == 0)
Now as you know it detects if the player is crouching And Moving.
And I have this line -
If(Instigator.bIsCrouched)
Wich detectes if the player is ONLY crouching . . .

Well the problem is he only excutes the If(Instigator.bIsCrouched) command allthough im moving too and the first line stands at top of my code so he willl check it first but no help . . . .

HELP PLS !
 

EvilDrWong

Every line of code elevates you
Jun 16, 2001
932
0
0
40
Inside the machine
Visit site
You could probably simplify it by doing a more general check, such as:
Code:
if(Instigator.bIsCrouched)
{
    if(VSize(Instigator.Velocity)>=0)
    {
        //Crouched and moving
    }
    else
    {
        //Crouched and stationary
    }
}
I believe the problem might be that youve got two seperate if's. First one makes sure to see if theyre both crouched and immobile, second one only checks the bIsCrouched value... meaning that as long as the player is crouched both of them will evaluate as true.
 

Fustrun

Artist
Oct 30, 2002
31
0
0
Visit site
But I have Alot Of Checks jumps runs walks . . .and my ELSE will ne if the player is standing still and doing non of those actions
 

EvilDrWong

Every line of code elevates you
Jun 16, 2001
932
0
0
40
Inside the machine
Visit site
then you add another bit after the IsCrouched check... because if the player is not crouched theyve got to be standing.
Code:
if(Instigator.bIsCrouched)
{
    if(VSize(Instigator.Velocity)>0)
    {
        //Crouched and moving
    }
    else
    {
        //Crouched and stationary
    }
}
else
{
    if(VSize(Instigator.Velocity)>0)
    {
        //Standing and moving
        if(VSize(Instigator.Velocity)>=Instigator.GroundSpeed*0.8)
        {
            //Standing and running
        }
        else
        {
            //Standing and moving, not running
        }
    }
    else
    {
        //Standing and still
    }
}
Up in that first bit i had a >= where it should have only been a > :eek: my bad. You could even turn that else into an Else If(!Instigator.bIsCrouched) and add in a falling check via else if(Instigator.Physics==PHYS_Falling) then further screw with their accuracy in there.