• Register

Fursan al-Aqsa: The Knights of the Al-Aqsa Mosque® is a Third Person Action Game on which you play as Ahmad al-Falastini, a young Palestinian Student who was unjustly tortured and jailed by Israeli Soldiers for 5 years, had all his family killed by an Israeli Airstrike and now, after getting out from the prison, seeks revenge against those who wronged him, killed his family and stolen his homeland, by joining a new Palestinian Resistance Movement called Fursan al-Aqsa: The Knights of the Al-Aqsa Mosque®. Fursan al-Aqsa® is a Registered Trademark of Nidal Nijm Games © 2022, all rights reserved.

Post news Report RSS Weapons Ironsights for FPS Mode

This is a small but nice adition to Fursan al-Aqsa First Person Mode to make the aiming feel more natural and smooth for the player.

Posted by on


This is a small but nice adition to Fursan al-Aqsa First Person Mode to make the aiming feel more natural and smooth for the player.

Hello friends.

Since I am now on the final phase of Fursan al-Aqsa development, I am adding some of the new features I have on my TODO list, and the first one of this list is add iron sights for weapons in first person mode.

Nowadays this is the standard for first person shooters, I think almost all modern shooters COD-like have iron sights for weapons. I know I want my game to have that retro 90's shooters vibe, however, there are some modern gameplay features that indeed benefit the gameplay. I know iron sights add more to the cosmetic than the gameplay itself, but even then, since many gamers complained about the zooming effect of my game's guns in first person mode, I decided to make it feel more natural and smooth, and iron sights were the best option to make the aiming feel more comfortable for the players.

There were 2 ways of doing iron sights in UDK Engine. The first one is to do entirely via progamming in unreal scripting. I found this very old but nice tutorial for it:


I followed the tutorial step by step, also I did got the original sample scripts and change them to fit my custom game functions, however, after one entire day trying, it did not work. I think that's because I made too many changes on the default UDK Engine classes, specially the UTWeapon class which is what controls the function of all game's weapons.

So after this frustration, I said to myself: 'I will do this on my own'

After thinking a lot, I realized that the easiest and more simple way for adjusting the gun position to simulate the iron sight aiming effect we see in modern games is by manually animating the gun, and then change the UTWeapon zooming function by adding a new line of code to play this new animation. However, since there is no IronSighAnimation variable on the UTWeapon Code, I had to make some new variables to store the Ironsight Animations on the weapon's properties:

//custom animation for ironsights effect
var(Animations) name    WeaponIronsightAnimIn;
var(Animations) name    WeaponIronsightAnimOut;
var(Animations) array<name> WeaponIronsightAnimFire;
var bool IsIronSight;

User Posted Image


Then I simply called the function to PlayWeaponAnimation whenever the weapon enters zoomed mode, which is when the player presses or holds the RMB:

/** Called when zooming starts
 * @param PC - cast of Instigator.Controller for convenience
 */
simulated function StartZoom(UTPlayerController PC)
{
    IsIronSight = true;
    PC.StartZoom(ZoomedTargetFOV, ZoomedRate);
    //PlaySound(ZoomInSound, true);
    PlaySound(PickupSound, true);
	//custom function for ironsights animation
	PlayWeaponAnimation(WeaponIronSightAnimIn, 0.5, true, );
}

/** Called when zooming ends
 * @param PC - cast of Instigator.Controller for convenience
 */
simulated function EndZoom(UTPlayerController PC)
{
    IsIronSight = false;
    PC.EndZoom();
    //PlaySound(ZoomOutSound, true);
    PlaySound(PickupSound, true);
	//custom function for ironsights animation
	PlayWeaponAnimation(WeaponIronSightAnimOut, 0.5, false, );
}

User Posted Image


Just a problem arised, is that after the player shoots while in Ironsight (Zoomed Mode), the gun returns to it's idle animation, which is the default position (not iron sight), so that means the gun gets out of iron sights mode after the first shoot. To solve this problem, I simply made a new fire animation, using the Ironsights In animation as the initial position and rotation values, and added a check on the code to verify if the weapon is in Ironsights Mode or not, to play either the normal fire animation or the ironsights fire animation:

/**
 * PlayFireEffects Is the root function that handles all of the effects associated with
 * a weapon.  This function creates the 1st person effects.  It should only be called
 * on a locally controlled player.
 */
simulated function PlayFireEffects( byte FireModeNum, optional vector HitLocation )
{
    // Play Weapon fire animation

    if ( FireModeNum < WeaponFireAnim.Length && WeaponFireAnim[FireModeNum] != '' )
	
	  //here we will check if the weapon is on IronSight state to play the ironsight fire animation
	  if (IsIronSight == false)
      {	  
        PlayWeaponAnimation( WeaponFireAnim[FireModeNum], GetFireInterval(FireModeNum) );
	  } 
	  if (IsIronSight == true)
      {	  
        PlayWeaponAnimation( WeaponIronsightAnimFire[FireModeNum], GetFireInterval(FireModeNum), true, );
		setTimer(0.01, false, 'ReturnIronSightIdle');
	  }	  
	  //here we will check if the weapon is on IronSight state to play the ironsight fire animation
	  
    //if ( FireModeNum < ArmFireAnim.Length && ArmFireAnim[FireModeNum] != '' && ArmsAnimSet != none)
        //PlayArmAnimation( ArmFireAnim[FireModeNum], GetFireInterval(FireModeNum) );

    // Start muzzle flash effect
    CauseMuzzleFlash();

    ShakeView();
}

//this will make the weapon return to idle state of ironsights after shooting
function ReturnIronSightIdle(){
  //this is the idle animation for ironsights
  PlayWeaponAnimation(WeaponIronSightAnimIn, 0.5, true, );
ClearTimer();
}
//this will make the weapon return to idle state of ironsights after shooting

User Posted Image


So that's all for now. Cheers and until the next update.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: