accesed null

Discussions about Coding and Scripting
Post Reply
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

accesed null

Post by Rakiayn »

I am optimizing my codes but I got some acces null that I dont understand
got this error:

Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name

the code:

Code: Select all


simulated function CreateMMGameInfo()
{
local MMI_GameInfo sp;
local playerstart p;

BroadCastMessage("Creating MonsterMatchGameInfo");
Log("Creating MonsterMatchGameInfo");

        MMGameinfo = none;

	foreach AllActors(class'playerstart', P)
	{
		if (p != none)
		{
                      if (Unrealspawngametype.class != none)
                      {
                      sp = Spawn(default.Unrealspawngametype,,,p.location);
                      }
                      else
                      {
                      sp = Spawn(class'MMI_GameInfo',,,p.location);
                      BroadCastMessage("no unrealspawn gametype was set, now using default.");
                      }

		MMGameinfo = sp;
		break;
		}

	}

	if (MMGameinfo == none)
	{
    	BroadCastMessage("WARNING: failed to create a MMgameinfo");
    	Log("WARNING: failed to create a MMgameinfo");
	}
}

User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: accesed null

Post by Feralidragon »

Your problem relies here:

Code: Select all

if (Unrealspawngametype.class != none)
{
sp = Spawn(default.Unrealspawngametype,,,p.location);
}
Now, first off, in the Spawn function the first parameter is a Class, so what is exactly Unrealspawngametype?
Could you put the variable declaration here (something like "var something Unrealspawngametype")?
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: accesed null

Post by Rakiayn »

var config class<MMI_Gameinfo> Unrealspawngametype;

it is the same class as the local var sp. so there shouldnt be any mismatches right?

var MMI_Gameinfo MMGameinfo;
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: accesed null

Post by Feralidragon »

Ok, first that "if" is rather wrong, what you want is this:

Code: Select all

if (Unrealspawngametype != none)
Unrealspawngametype is a class by itself, there's no need for Unrealspawngametype.class, besides being wrong.

Secondly, use Unrealspawngametype instead of default.Unrealspawngametype, like so:

Code: Select all

sp = Spawn(Unrealspawngametype,,,p.location);
Since if you're checking Unrealspawngametype, you should use Unrealspawngametype, and not default.Unrealspawngametype, because default.Unrealspawngametype may have a different value relative Unrealspawngametype, so be always consistent in your code.
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: accesed null

Post by Rakiayn »

thanx, I changed it but there are still errors showing in the log
I feel such a noob for not understanding why these errors are generated lol

Code: Select all

simulated function CreateMMGameInfo()
{
local MMI_GameInfo sp;
local playerstart p;

BroadCastMessage("Creating MonsterMatchGameInfo");
Log("Creating MonsterMatchGameInfo");

        MMGameinfo = none;
        
	foreach AllActors(class'playerstart', P)
	{
		if (p != none)
		{
                      if (Unrealspawngametype != none)
                      {
                      sp = Spawn(Unrealspawngametype,,,p.location);
                      }
                      else
                      {
                      sp = Spawn(class'MMI_GameInfo',,,p.location);
                      BroadCastMessage("no unrealspawn gametype was set, now using default.");
                      }

		MMGameinfo = sp;
		break;
		}

	}

	if (MMGameinfo == none)
	{
    	BroadCastMessage("WARNING: failed to create a MMgameinfo");
    	Log("WARNING: failed to create a MMgameinfo");
	}
}


errors:

ScriptLog: searching MonsterMatchGameInfo
ScriptLog: Creating MonsterMatchGameInfo
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
Warning: Failed to load 'NULL': Can't resolve package name
Warning: Failed to load 'Class None.None': Can't resolve package name
ScriptLog: Initiating local logging...

EDIT:
unrealwiki says this:
Failed to load 'NULL': Can't resolve package name
Failed to load 'object class None.object name': Can't resolve package name
These two lines appear together and are caused by the DynamicLoadObject function when trying to load an object from a non-existing package. Object class is the class specified as second parameter of DynamicLoadObject and could be e.g. "Class", "Texture" or "Sound". Object name is the actual name of the object that should be loaded. Note that the object's package name is set to "None" because the package could not be loaded. (which caused the first warning)

so it seems something can not be loaded. the only thing that is loaded in the function is the mmi_gameinfo. which is strange because mmi_gameinfo is a class of the same package. so I dont understand why it can not be loaded
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: accesed null

Post by Feralidragon »

Well, basically you're using a DynamicLoadObject somewhere in your code, and that's not the actual function using it.
Search in your own code the functions where you use DynamicLoadObject, and you should find your problem.
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: accesed null

Post by Rakiayn »

Im not using that , at least not in that class.
Im not sure what it is and I cant remember I ever used it :???:
Post Reply