Here's what I'm trying to replace:
Code: Select all
else if( WhatDied.IsA('EXUBrute') || WhatDied.IsA('Brute') )
Brutes++;
else if( WhatDied.IsA('EXUGasbag') || WhatDied.IsA('Gasbag') )
Gasbags++;
else if( WhatDied.IsA('EXUKrall') || WhatDied.IsA('Krall') )
Krall++;
etc, etc etc
That shit sucks balls. Sure, the elses at least help terminate conditions earlier, but if you don't match ANY of the conditions, you have to check every single one of them and there's dozens. Every single time a pawn dies. In EXU2.
Yeah.
Here's what I tried to alleviate this problem:
Code: Select all
switch( WhatDied.Class )
{
Case class'EXUBrute':
Case class'Brute':
log(self$": "$PlayerName$" killed a Brute");
Brutes++;
break;
Case class'EXUGasbag':
Case class'Gasbag':
log(self$": "$PlayerName$" killed a Gasbag");
Gasbags++;
break;
Case class'EXUKrall':
Case class'Krall':
log(self$": "$PlayerName$" killed a Krall");
Krall++;
break;
etc, etc etc etc
Problem HERE is it evaluates classes LITERALLY, i.e. it doesn't check to see if a class is a child class the way IsA() does. Is there any way to use a switch statement with IsA() in the way I'm trying to, or am I stuck with if/else bullfuckery?
I also tried switch( WhatDied) and then did stuff like Case WhatDied.IsA('EXUBrute'):, but the syntax made UCC disappointed in me and it refused to cooperate. I'm guessing you can't have an uncertain statement in a switch case.