"else if" problems.

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Solve

New Member
Sep 19, 2003
37
0
0
Visit site
So I've been reading Tim Sweeneys overview of UScript and in the Conditional Statements section Sweeney gives this example of a "if-else if-else" statement:

Code:
if( LightBrightness < 20 )
   log( "My light is dim" );
else if( LightBrightness < 40 )
   log( "My light is medium" );
else if( LightBrightness < 60 )
   log( "My light is kinda bright" );
else
   log( "My light is very bright" );

So I wanted to try that out, but instead of LightBrightness I wanted to log when the Health hits a certain level:

Code:
class Law extends Mutator;

function ModifyPlayer(Pawn Other)
{
local xPawn n;
n=xPawn(Other);

if( n.Health < 20 )
   log( "tweeeeeeeeenty" );
else if( n.Health < 40 )
   log( "foooooooooorty" );
else if( n.Health < 60 )
   log( "siiiiiiiiiiixty" );
else
   log( "My health is very high" );
}

When I use this mut the only log that I get is "My health is very high". The others don't give the logs when my health reaches their level.
Can anyone tell me why this is happening?
 
Last edited:

Sir_Brizz

Administrator
Staff member
Feb 3, 2000
26,020
83
48
yes I think the functon you want is notifydamaged not positive on that don't have a way to check right now.
 

Solve

New Member
Sep 19, 2003
37
0
0
Visit site
ugh, I spent 7 hours straight trying to find something that makes this works. No results!

scripting is depressing. :(
 

Sir_Brizz

Administrator
Staff member
Feb 3, 2000
26,020
83
48
lol you're looking in the wrong place. You need to change the game rules.

My hard drives aren't done being fixed yet (i had to reinstall windows) so I can't check the exact funciton but search for Notify in all of the source to find the right function you need to overload. It's something like NotifyDamageTaken or NotifyDamaged.