But I have a piece of code that is confusing the heck out of me and would appreciate someone with far greater understanding helping me to become less stupid.
In porting the BOE recoil effect to NV, I could not get it to function properly for the longest time. Until I added an endif statement that by my reckoning should not be needed. Then the code functioned perfectly.
Here is the code which is attached to a token.
SCN xMoRecoilEffectshort ammocountshort Setupfloat fRisefloat fAnglefloat Kickref rCurrentGunref rCurrentAmmoref rNewAmmoBEGIN Gamemode IF Setup == 0 Set rCurrentGun to player.getequippedobject 5 Set rCurrentAmmo to GetPlayerCurrentAmmo Set AmmoCount to player.GetItemCount rCurrentAmmo; PrintToConsole "Current Weapon is %n" rCurrentGun; PrintToConsole "Current Ammo is %n" rCurrentAmmo Set Setup to 1 EndIF EndIF ; <---- script fails to execute without this additional EndIF ???? IF AmmoCount > (player.getitemcount rCurrentAmmo) Set Kick to xMoGuns.Kick IF IsControlPressed 6 Set Kick to (Kick*0.75) EndIF IF player.IsSneaking Set Kick to (Kick*0.75) EndIF set fAngle to player.getangle x - Kick IF ( fAngle>=-89 && fAngle<=89 ) player.setangle x fAngle EndIF set fRise to ((getrandompercent - 50)/150)*Kick set fAngle to player.getangle z - fRise player.setangle z fAngle; PrintToConsole "Kick applied is %.4f" kick; PrintToConsole "Ammo Count is %.0f" AmmoCount EndIF Set AmmoCount to player.GetItemCount rCurrentAmmo Set rNewAmmo to GetPlayerCurrentAmmo IF ( rCurrentAmmo != rNewAmmo); IF ( rCurrentAmmo != GetPlayerCurrentAmmo) Set Setup to 0 EndIF IF ( rCurrentGun != player.getequippedobject 5 ) player.removeitem xMoRecoilToken 1 1 EndIFEND