Donate for Oldunreal:


Links to our wiki:




Unreal Reference



Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Issues with Amplifier, ScubaGear, and UPakScubaGear [#54 - #57] (Read 323 times)
Developer Team

Posts: 1134
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Issues with Amplifier, ScubaGear, and UPakScubaGear [#54 - #57]
Mar 24th, 2018 at 3:49pm
Print Post  
Issue #54. Missing sound/lighting of active Amplifier, ScubaGear, and UPakScubaGear.

Amplifier, ScubaGear, and UPakScubaGear use owner's AmbientSound to play the sound of the corresponding active device. When two or more such devices are active simultaneously, only one of them is able to use owner's AmbientSound, so sounds of other devices won't be played. Moreover, deactivation of any such device resets AmbientSound to none and then other active devices do not try to reuse vacant AmbientSound.

Suggested resolution: when an Amplifier/ScubaGear/UPakScubaGear is activated, spawn an auxiliary actor attached to the owner (by means of setting Physics to PHYS_Trailer), so that the aux actor would play the ambient sound instead of the owner. For Amplifier, the aux actor should also emit light. The change should alter only standard classes; derived classes should not be affected (e.g., for Amplifier, the changes would be applied only when self.Class == class'Amplifier').

Issue #55. Players drown too fast after deactivation of ScubaGear/UPakScubaGear underwater.

When a player deactivates a ScubaGear underwater, the max time he can swim without drowning is about 1 second, even if the player just entered the water zone. This seems unfair. In contrast, the previous implementation of UPakScubaGear allowed to swim without drowning during 15 seconds after deactivation, that is unfair too.

Suggested resolution: when ScubaGear/UPakScubaGear is active, calculate owner's PainTime using its previous value and consume Charge when the resulting PainTime would be less than 1:


Select All
-		if ( Pawn(Owner).HeadRegion.Zone.bWaterZone && !Pawn(Owner).FootRegion.Zone.bPainZone )
-		{
-			Pawn(Owner).PainTime = 1;
+		if (OwnerPawn.HeadRegion.Zone.bWaterZone && !OwnerPawn.FootRegion.Zone.bPainZone)
+		{
+			if (0 < OwnerPawn.PainTime && OwnerPawn.PainTime < OwnerPawn.UnderWaterTime)
+			{
+				OwnerPawn.PainTime = FMin(OwnerPawn.PainTime + 0.1, OwnerPawn.UnderWaterTime);
+				if (OwnerPawn.PainTime < 1)
+				{
+					Charge -= (1 - OwnerPawn.PainTime) * 10;
+					OwnerPawn.PainTime = 1;
+				}
+			} 


Select All
-	if ( (OwnerPawn != None) && !OwnerPawn.FootRegion.Zone.bPainZone && OwnerPawn.HeadRegion.Zone.bWaterZone )
+	if (OwnerPawn != none && 0 < OwnerPawn.PainTime && OwnerPawn.PainTime < 15 &&
+		!OwnerPawn.FootRegion.Zone.bPainZone && OwnerPawn.HeadRegion.Zone.bWaterZone)
+	{
		OwnerPawn.PainTime = 15;
+	} 

This implementation makes cheating difficult, because it restores owner's PainTime nearly according to the consumed Charge. There are only two ways to increase PainTime "for free":
1) by exploiting rounding errors: int((1 - OwnerPawn.PainTime) * 10) < (1 - OwnerPawn.PainTime) * 10,
2) by using +15 extra seconds when the scuba gear becomes empty (this possibility should be preserved for custom maps where players have to activate scuba gear underwater when PainTime is already close to 0).

Issue #56. ScubaGear and UPakScubaGear play breath sound after respawning.

When ScubaGear/UPakScubaGear is respawned, it plays breath sound.

Suggested resolution: add the following code to classes ScubaGear and UPakScubaGear:

Select All
state Sleeping
	ignores Touch;

	if (RespawnSound != sound'UnrealShare.Pickups.Scubal2')

Issue #57. Players can use an empty UPakScubaGear infinitely.

An empty UPakScubaGear can be activated and give the player +15 seconds for underwater swimming without drowning.

Suggested resolution: allow activation only when Charge > 0.

The following video demonstrates the aforementioned issues related to ScubaGear and UPakScubaGear: https://www.youtube.com/watch?v=qnsgncvt1QU
Back to top
IP Logged
Developer Team

Posts: 1134
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Issues with Amplifier, ScubaGear, and UPakScubaGear [#54 - #57]
Reply #1 - Mar 31st, 2018 at 8:52pm
Print Post  
Here's the latest revised versions of Amplifier.uc, SCUBAGear.uc, UPakScubaGear.uc, and Cloak.uc


So far I couldn't notice any noticeable problems with using special actors for playing amb sounds.
All these 4 classes have been changed to store the special effects actor in variable EffectsActor:

Select All
var Actor EffectsActor; 

New function

Select All
function bool UseSpecialEffectsActor() 

indicates whether the current inventory (one of the listed above) should use a special effects actor. The default implementation returns True only for the current class (in derived classes, this function may return True only if it's overridden correspondingly).

Function names EnableInventoryEffects and DisableInventoryEffects have also been unified for these classes (so it's easy to see that they use the same pattern).

SCUBAGear & UPakScubaGear may share the same effects actor in order to avoid multiple breath sounds playing at the same time. Moreover, when any of the two breath sounds (stored in ActivateSound/RespawnSound) is played by the Owner as the AmbientSound, the special effects actor temporarily becomes quiet (its AmbientSound is set to None).

Simultaneous use of SCUBAGear & UPakScubaGear allows to recover the owner's PainTime with double speed (single scuba gear can only maintain PainTime at the same level; two scuba gears can increase PainTime up to UnderwaterTime).
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