[Help] Aimed Fire Only

  • Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

ro_sauce

FNG / Fresh Meat
Sep 26, 2007
3,135
329
0
bwhgaming.com
i'm trying to make my machineguns only able to fire in aiming only, not hip, so i took the code out of LAW and LAWFire, but it keeps going out of ironsights after each shot, and I cant figure out how to make it do this only when magammoremaining=0.

dp28weapon:
Spoiler!

dp28Fire:
Spoiler!

do i need to post default props too for help?
 

RuneHarle

FNG / Fresh Meat
Jan 5, 2011
316
49
0
On Steam: VelvetHarle
I'm looking at it from work and I'll be able to look more thuroughly in about 10 hours, but I noticed this immediately and it might be the cause.
Spoiler!


its calling the same transition if interupted or not
 

RuneHarle

FNG / Fresh Meat
Jan 5, 2011
316
49
0
On Steam: VelvetHarle
and that would make it zoomout after each shot?

alright don't quote me but
Spoiler!
I think that function is saying between all animations zoom out

try removing it
 

RuneHarle

FNG / Fresh Meat
Jan 5, 2011
316
49
0
On Steam: VelvetHarle
This is how a weapon without a flashlight would handle the weapontick, so maybe try this

Spoiler!

OR
just remove the weapon tick altogether, provided you are calling back to KFWeapon, it would default to the above expressions.
 
Last edited:

braindead

FNG / Fresh Meat
Aug 22, 2009
918
346
0
Merry Ol' England
Entangler is right RO, don't try and complicate it by using the LAW code, as that is set different to a standard machine gun.

Instead, base it off the AK or something and put this in your Fire code

Code:
function bool AllowFire()
{

        if( !KFWeapon(Weapon).bAimingRifle )
            return false;

	return Super.AllowFire();
}

That should stop firing when not in iron sight mode but may need checking
 
Last edited:

RuneHarle

FNG / Fresh Meat
Jan 5, 2011
316
49
0
On Steam: VelvetHarle
what is a check?
a check is where we tell the program to see if condition a is met before moving on, in this case
Spoiler!
is checking to see if your not aiming the rifle, and if so it returns a an answer that says you cannot fire.

the bit afterward says that in all other cases where the above condition is not met, allow the fire based on the superclass's conditions.

-if I'm wrong feel free to correct me :p
 
Last edited:

Gartley

Grizzled Veteran
Dec 27, 2010
2,340
349
83
UK
www.wildcardproductionstudios.co.uk
the check is the IF statment.

The function is a group of statements

Code:
function bool AllowFire()

bool - simple true/false yes/no on/off 1/0
AllowFire - Can the gun fire or not

Code:
{
        if( !KFWeapon(Weapon).bAimingRifle )
            return false;

	return Super.AllowFire();
}

{} Defines the function bounds
if( !KFWeapon(Weapon).bAimingRifle ) - reads as if the weapon is not (!) set as a weapon that needs to aimed (bAimingRifle) (defined by the weapons default properties) then say it's not allowed to fire (return false) end statment ( ; )
should the condition is not met (so the weapon is being aimed) then tell the main weapon it can fire.

Hope that explains it. :) I just hope I got it right now I've gone to the trouble to expand on it. :D
 
  • Like
Reactions: FluX

FluX

Grizzled Veteran
Oct 26, 2010
5,395
234
63
www.fluxiserver.co.uk
the check is the IF statment.

The function is a group of statements

Code:
function bool AllowFire()

bool - simple true/false yes/no on/off 1/0
AllowFire - Can the gun fire or not

Code:
{
        if( !KFWeapon(Weapon).bAimingRifle )
            return false;
 
    return Super.AllowFire();
}

{} Defines the function bounds
if( !KFWeapon(Weapon).bAimingRifle ) - reads as if the weapon is not (!) set as a weapon that needs to aimed (bAimingRifle) (defined by the weapons default properties) then say it's not allowed to fire (return false) end statment ( ; )
should the condition is not met (so the weapon is being aimed) then tell the main weapon it can fire.

Hope that explains it. :) I just hope I got it right now I've gone to the trouble to expand on it. :D
That explaination is good mate don't worry. Well done on it - can tell you have been doing a little research again recently. ;)
 

ro_sauce

FNG / Fresh Meat
Sep 26, 2007
3,135
329
0
bwhgaming.com
thanks for the explanation, it really cleared a few things up for me, especially (!=non).

and the allowfire check works great.
now to figure out how to overheat barrels!
 
Last edited:

ro_sauce

FNG / Fresh Meat
Sep 26, 2007
3,135
329
0
bwhgaming.com
the code is in RO, i'm just having trouble sussing out how to make the parts i need work.
i'll start a separate thread for that when i get stuck again, i really appreciate everyone's help, and i think this gun pack will be quite enjoyable when all the stuff works.

i have been thinking of adjusting the damage and stuff to make a "ww2 weapons kf gungame", then i can port some maps from RO (berezina might be fun!, or danzig) to use in kf gungame.
 

FluX

Grizzled Veteran
Oct 26, 2010
5,395
234
63
www.fluxiserver.co.uk
thanks for the explanation, it really cleared a few things up for me, especially (!=non).

and the allowfire check works great.
now to figure out how to overheat barrels!
Just had a thought, check the Minigun out that you find in maps as it has a overheating system.