logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Issue #60. Duplicated message "<Weapon> has no ammo" (Read 187 times)
Masterkent
Developer Team
Offline



Posts: 1050
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Issue #60. Duplicated message "<Weapon> has no ammo"
Mar 26th, 2018 at 1:04pm
Print Post  
When a player tries to select a weapon with no ammo, the message "<Weapon> has no ammo" may be displayed twice. How to reproduce: run the game, execute "open dmDeck16" in the console, find any weapon (e.g. Minigun), waste all ammo of the taken weapon, then try to change DispersionPistol to that weapon using the corresponding slot number ("SwitchWeapon 0" for Minigun).

The reason why this happens is that the current implementation may consider the same sequence of weapons twice when trying to find an appropriate weapon that corresponds to the requested slot.

Suggested resolution:

In class Engine.Weapon, add new variable

Code
Select All
var transient bool bBreakWeaponChange; 



Change function Engine.Weapon.WeaponChange as indicated below:

Code
Select All
function Weapon WeaponChange( byte F )
{
	local Weapon newWeapon;

+	if (bBreakWeaponChange)
+		return none;
+
	if ( InventoryGroup == F ) 


Change function Engine.PlayerPawn.SwitchWeapon as indicated below:

Code
Select All
	if ( Inventory == None )
		return;
-	if ( (Weapon != None) && (Weapon.Inventory != None) )
-		newWeapon = Weapon.Inventory.WeaponChange(F);
-	else
-		newWeapon = None;
-	if ( newWeapon == None )
-		newWeapon = Inventory.WeaponChange(F);
+
+	if (Weapon != none && Weapon.Inventory != none)
+	{
+		newWeapon = Weapon.Inventory.WeaponChange(F);
+		if (newWeapon == none)
+		{
+			Weapon.bBreakWeaponChange = true;
+			newWeapon = Inventory.WeaponChange(F);
+			Weapon.bBreakWeaponChange = false;
+		}
+	}
+	else
+		newWeapon = Inventory.WeaponChange(F);
+
	if ( newWeapon == None )
		return; 


[Note: modified PlayerPawn.uc and Weapon.uc will be provided as a part of 227j_39_40_appendix_2]
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo