PDA

View Full Version : error : type mismatch in 'new' name



acropole
11-14-2009, 10:33 AM
HI,

I don't understand why I get this error :

error : type mismatch in 'new' namein this script :



class LegionsManager extends Object
notplaceable
perobjectconfig
config(LegionsMan)
dependson(Legion);

var array<class<Legion> > Legions;
var config array<name> LegionsNames;

function LoadLegions(){
local name LegionName;

foreach LegionsNames(LegionName)
{
Legions.AddItem( new(none, LegionName) class'Legion' );
}
}

immortius
11-14-2009, 03:59 PM
The error message should give you the line the error is on.

For one you're trying to put a Legion object in an array of Legion classes.

Your array should just be:

var array<Legion> Legions;

Wormbo
11-15-2009, 04:20 AM
Also I think the second parameter of new() must be a string, not a name. (Right, it specifies the object name, but is of type string.)