Accessed None

  • 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.

Darknigh+

New Member
Oct 19, 2003
113
0
0
www.cis.usouthal.edu
I am getting an access none error. I know what and Access None error is but I don't see why I am getting it. Yea I know that sounds crazy.

Here is my code:
Code:
class TestOneDeathMatch extends xDeathMatch;

function RestartPlayer(Controller aPlayer) {
    
	local Controller C;
	Super.RestartPlayer(aPlayer);

	for(C = Level.ControllerList; C != None; C = C.NextController)
	{
		 if( C.bIsPlayer && !C.IsA('PlayerController') )
		 {
			Log("Found AI controll Players**************");
			TestOnePawn(C.Pawn).PostSpawn();		 
						
			break;
		 }		

	}
    
	//TestOnePawn(aPlayer.Pawn).PostSpawn();


	//Log("+++++++++++++Restarting Player++++++++++++");
	
}
/*don't know if possibly to do:
DefaultPlayerClassName="MutTestOne.TestOnePawn"
to get spawn my pawn class??
*/
defaultproperties
{
     MapPrefix="BS"
     BeaconName="BS"
     GameName="TEST ONE"
	 //DefaultPlayerClassName="MutTestOne.TestOnePawn"
}

Here is my Pawn:
Code:
class TestOnePawn extends xPawn;


function PostSpawn()
{
  Log("start------->>>>>>>>>>>>>");
  log("[TestOnePawn] Spawning " $ ControllerClass $ " for " $ self.Name, 'Informant');
  Controller = spawn(ControllerClass);
  Controller.Possess(self);
  Controller.GotoState('Idle');

}
defaultproperties
{

	 ControllerClass=class'TestOneController'

}

And my controller:
Code:
class TestOneController extends Controller;

function PostBeginPlay()
{
	Super.PostBeginPlay();
	Log("bot===============POstBeginplay");

}

auto state() Idle
{
  function BeginState()
  {
	  Log("+++++++++++BEGIN STATE()+++++++");
    log(Pawn.Name $ " is idle", 'Informant');
  }

  event SeePlayer(Pawn player)
  {
    log(Pawn.Name $ " sees " $ player.Name, 'Informant');

    MoveTarget = player;
    GoToState('FollowPlayer', 'Begin');
  }
}

state FollowPlayer
{
  function BeginState()
  {
    log(Pawn.Name $ " will now follow " $ MoveTarget.Name, 'Informant');
  }

  Begin:
    log("moving...", 'Informant');
    MoveToward(MoveTarget);
    GotoState('GreetingPlayer');
    Stop;
}

defaultproperties
{
    PlayerReplicationInfoClass=Class'XGame.xPlayerReplicationInfo'
	//PawnClass=Class'MutTestOne.TestOnePawn'    
}
 
Last edited:

Loqa

New Member
Dec 13, 2001
117
0
0
the low lands
Visit site
Log("Found AI controll Players**************");
TestOnePawn(C.Pawn).PostSpawn();

If C.Pawn is not a TestOnePawn it will become none
C.Pawn could be none which is unlikely but still

If I understand correctly you're trying to get your controller onto a bot pawn. It is probably better to do this when the bot itself is spawned. AddBot and SpawnBot functions are the best places to start looking for that.
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
As posted in another guy's thread about Accessed Nones:
me said:
Warning: nsfPlayerReplicationInfo DM-Aztec[FuT]rev1.nsfPlayerReplicationInfo (Function nsf.nsfPlayerReplicationInfo.Tick:000A) Accessed None
You could have guessed from the message: The Accessed None happened in the Tick() function of the nsf.nsfPlayerReplicationInfo class, and there's only one access to an object's property in it: "Controller.Pawn"
If Controller is None this results in an Accessed None, that easy.

(see UnrealWiki: Log Warnings)

Also: Please post only relevant parts of your code.
 
Last edited:

Darknigh+

New Member
Oct 19, 2003
113
0
0
www.cis.usouthal.edu
I apoligize for not indicating where the Access None error is occuring I was in a hurry and it must of slipped my mind. Thanks for the replays. As Loqa said the Access None error is occuring at:
Code:
TestOnePawn(C.Pawn).PostSpawn();

And YES I checked the UnrealWiki: Log Warnings before posting.

I found this bite of code that someone posted:
Code:
// Set bot pawn class
function Bot SpawnBot(optional string botName)
{
	local Bot B;

	B = Super.SpawnBot(botName);

	if(B != None)
	{
		B.PawnClass = class'BonusPack.xMutantPawn';
	}

	// Update list of bottom players when a bot joins
	UpdateBottomFeeder();

	return B;
}

What is UpdateBottomFeeder()? I know it isn't a function in GameInfo/DeathMatch. Why would I have to Update the list of players if all I am doing is taking a current bot in the list and just reassigning its pawnclass? Also if I reassign the pawnClass will the Controller be assigned because of my defaultproperties? I look forward to your responses
 
Last edited:

Sir_Brizz

Administrator
Staff member
Feb 3, 2000
26,021
86
48
that snippet in from Mutant and has nothing to do with your gametype other than in theory.
 

Darknigh+

New Member
Oct 19, 2003
113
0
0
www.cis.usouthal.edu
Okay I got it working I just have one more question though.I don't understand why in my Pawn class that:
Code:
Controller = spawn(ControllerClass)
doesn't work. I have set the default property.

I had to comment it out and use the following:
Code:
  Controller = Spawn(class'TestOneController');

My classess:
Pawn class:
Code:
class TestOnePawn extends xPawn;

event PreBeginPlay()
{
	Super.PreBeginPlay();
  Log("start------->>>>>>>>>>>>>");
  log("[TestOnePawn] Spawning " $ Controller $ " for " $ self.Name, 'Before');

  //Controller = spawn(ControllerClass);
  Controller = Spawn(class'TestOneController');
  Controller.Possess(self);
  Controller.GotoState('Idle');
  log("[TestOnePawn] Spawning " $ Controller $ " for " $ self.Name, 'After');

}


defaultproperties
{

	 ControllerClass=class'TestOneController'

}

DeathMatch class:
Code:
class TestOneDeathMatch extends xDeathMatch;

function Bot SpawnBot(optional string botName)
{
	local Bot B;
	Log("================In SpawnBot==========");

	B = Super.SpawnBot(botName);

	if(B != None)
	{
		B.PawnClass = class'MutTestOne.TestOnePawn';
		Log("++++++++this is pawnClass"$B.Pawn);
		
	}
	else
	{
		Log("============ERROR=======");
	}
	
	return B;
}

defaultproperties
{
     MapPrefix="BS"
     BeaconName="BS"
     GameName="TEST ONE"

}

Controller class:
Code:
class TestOneController extends Controller;

function PostBeginPlay()
{
	Super.PostBeginPlay();
	Log("bot===============POstBeginplay");

}

auto state() Idle
{
  function BeginState()
  {
	  Log("+++++++++++BEGIN STATE()+++++++");
    //log(Pawn.Name $ " is idle", 'Informant');
  }

  event SeePlayer(Pawn player)
  {
	  Log("this is in SeePlayer+++++++++++++++++");
    //log(Pawn.Name $ " sees " $ player.Name, 'Informant');

    MoveTarget = player;
    GotoState('FollowPlayer', 'Begin');
  }
}

state FollowPlayer
{
  function BeginState()
  {
	  Log("Inside the followPlayer**************");
    //log(Pawn.Name $ " will now follow " $ MoveTarget.Name, 'Informant');
  }

  Begin:
    log("moving...", 'Informant');
    //MoveToward(MoveTarget);
    GotoState('Idle');
    Stop;
}

defaultproperties
{
    PlayerReplicationInfoClass=Class'XGame.xPlayerReplicationInfo'
	//PawnClass=Class'MutTestOne.TestOnePawn'    
}

Thanks for the help guys..:)
 
Last edited:

Sir_Brizz

Administrator
Staff member
Feb 3, 2000
26,021
86
48
because that Controller Class variable is a pointer to a class it's not actually a class.
 

Loqa

New Member
Dec 13, 2001
117
0
0
the low lands
Visit site
It is probably required to use it's full classname(PackageName.ClassName) in the properties section, as you did in your Controller, like this:

ControllerClass=class'MutTestOne.TestOneController'
 

Darknigh+

New Member
Oct 19, 2003
113
0
0
www.cis.usouthal.edu
Pawn moves?

I had my AI Class extend controller because the only state defined in it is Died. But my bot moves when it startes. Goes along the same path everytime and then just stands there waiting for something to happen. Where is it getting this from because my Controller doesn't tell it to.

I made the following changes to my AI class:
Code:
class TestOneController extends Controller;

function PostBeginPlay()
{
	Super.PostBeginPlay();
	Log("bot===============POstBeginplay");

}

auto state() Idle
{
  function BeginState()
  {
	  Log("+++++++++++BEGIN STATE()+++++++");
    //log(Pawn.Name $ " is idle", 'Informant');
  }

  event SeePlayer(Pawn player)
  {
	  Log("this is in SeePlayer+++++++++++++++++");
    //log(Pawn.Name $ " sees " $ player.Name, 'Informant');

   // MoveTarget = player;
  }

  Begin:
    log("I am Idle", 'Informant');
    Sleep(10);
    GotoState('Idle');

}


defaultproperties
{
    PlayerReplicationInfoClass=Class'XGame.xPlayerReplicationInfo'
	//PawnClass=Class'MutTestOne.TestOnePawn'    
}

I have also tried setting the pawns acceleration and velocity to zero and setting the physics to none. Could some give me any more direction or am I headed in the right direction?
 
Last edited:

Sir_Brizz

Administrator
Staff member
Feb 3, 2000
26,021
86
48
you probably didn't give your pawn class to the bots when they joined your game. Look for SpawnBot in mutant code.
 

Darknigh+

New Member
Oct 19, 2003
113
0
0
www.cis.usouthal.edu
I have posted the code for my 3 classes like 2 post back. As far as I know I am. Here is my spawnBot:
Code:
function Bot SpawnBot(optional string botName)
{
	local Bot B;
	Log("================In SpawnBot==========");

	B = Super.SpawnBot(botName);

	if(B != None)
	{
		B.PawnClass = class'MutTestOne.TestOnePawn';
		Log("++++++++this is pawnClass"$B.Pawn);
		
	}
	else
	{
		Log("============ERROR=======");
	}
	
	return B;
}
 

Sir_Brizz

Administrator
Staff member
Feb 3, 2000
26,021
86
48
oops sorry I didn't notice...

I think that the major problem you run into right now is that the AI is not being controlled by the Controller but by the SquadAI class (possibly.) This is normally defined in the gametype class, so check and make sure that in xDeathmatch in the def props that there is no line about SquadAI (sorry I can't check right now, I' still recovering from a system overhaul.)
 

[SAS]Solid Snake

New Member
Jun 7, 2002
2,633
0
0
41
New Zealand
www.digitalconfectioners.com
If you look at your code carefully, you'll notice the error. Well, I'll give you a hint anyways, it is the order in the way you are doing things.

First you spawn the bot, and then you changed the PawnClass variable. While your logging verifies your change, it doesn't do anything because the PawnClass variable (unchanged) was used in the Super state. Because the Pawn class variable wasn't changed before the Super state, no changes would have been made in the end.

A much better example of how to do this is avaliable in the Invasion gametype.
 

Sir_Brizz

Administrator
Staff member
Feb 3, 2000
26,021
86
48
/me smacks head :)

well in all fairness I DID tell you to look at the mutant code :lol:
 

Darknigh+

New Member
Oct 19, 2003
113
0
0
www.cis.usouthal.edu
Okay I see what you are saying. So does that now mean that I will have to rewrite the spawnBot,InitializeBot..etc.So I am going to have to traverse the whole chain function calls and overwrite all those functions?

I am out of the states right now and I have to pay for internet access per minute. Could you by any chance give me just the code.(for invasion )
 
Last edited:

Sir_Brizz

Administrator
Staff member
Feb 3, 2000
26,021
86
48
noooo

you need to not use the if statement, and force the bots to use the pawn class no matter what BEFORE you spawn them.
 

Darknigh+

New Member
Oct 19, 2003
113
0
0
www.cis.usouthal.edu
I have done that and also logged commands to see if the correct classes were being used for the pawn and the Controller. However I do believe what you mention ealier about the SquadAI may be the problem. Because if I assign DMSquadClass to None in the DeathMatch class the Pawn does nothing and runs though my States in my controller class. However I get tones of Accessed None errors of course. I noticed that the defaultproperty in the DMSquad class is set to FreeLance
Code:
CurrentOrders = Freelance

I think this is causing the problem however I have yet to been able to trackdown how to make the Orders be just stand there.s