开发者

UDK - Type mismatch in 'If' for MyInventory functil

开发者 https://www.devze.com 2023-03-03 17:18 出处:网络
I am having trouble getting a pawn class to compile. The error is Type开发者_JS百科 mismatch in \'If\' in the line:

I am having trouble getting a pawn class to compile. The error is Type开发者_JS百科 mismatch in 'If' in the line: if( MyInventory[inc] == int (x) );

CODE: [CODE]class BSAPawn extends UTPawn;

var() array MyInventory;

function bool HasItem(int x) { local int len; local int inc; len = MyInventory.Length;

for(inc = 0; inc < len; inc++)
{
   if( MyInventory[inc] = int x );
        return true;
}
return false;

}[/CODE]

Does anyone know how to sort this out? Tom


You're assigning a value = instead of doing a comparison ==

it should look like..

for(inc = 0; inc < len; inc++)
{
   if( MyInventory[inc] == x )
        return true;
}
return false;

Plus why are you using int x instead of simply x

0

精彩评论

暂无评论...
验证码 换一张
取 消