x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Accessed none trying to read property

Hey guys!

I'm having trouble on making my enemy follow the character. I'm trying to use AI Controller on it, but when I run the game I receive the error "accessed none trying to read property" when the game tries to read the Enemy AI information.

Can anyone help me?

Here is my code.

alt text

Thx.

Product Version: UE 4.19
Tags:
acessednone.png (115.3 kB)
more ▼

asked May 25 '18 at 05:59 PM in Blueprint Scripting

avatar image

Tabacudo
62 3 5 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

Well, this may mean that there is no enemy AI, in the index you get or your pawn is not spawned yet. When you use beginplay you should use "Is Valid" node, to check if object exist to pass the logic you refer, also you may add a bit delay after beginplay, to give those objects time to spawn and load, so their reference will be valid, once logic refers to them.

more ▼

answered May 25 '18 at 07:08 PM

avatar image

Dino zavr
78 6 8

avatar image Tabacudo May 25 '18 at 07:18 PM

Unfortunately, the EnemyAI exists. I've tried using delay and the "isValid" node where at false I print string and it's printing. What could make it not a valid request?

avatar image Dino zavr May 25 '18 at 07:25 PM

Make sure you pick the correct class of "Enemy AI" in get all actors of class, also make sure that Enemy AI is placed on the level or spawned, before you use this logic.

avatar image Tabacudo May 25 '18 at 07:29 PM

It's not placed in the map. It's a AI Module type of class. Is it possible to place in the map? When I try to drag it in, nothing happens.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

GetAllActors node can only get things that were placed in the map while editing the level OR were Spawned into the game world by a Spawn command during the game's runtime, and are not yet destroyed.

What is the Enemy AI class based on? Is it based on Controller class, Pawn class, etc.? What does its Icon look like in your Contents browser it is a blueprint you created?

more ▼

answered May 25 '18 at 07:55 PM

avatar image

mightyenigma
3.8k 18 23 20

avatar image Tabacudo May 25 '18 at 08:33 PM

This is my EnemyAI class. I've created it manually.

alt text

ai.png (157.9 kB)
avatar image mightyenigma May 25 '18 at 08:42 PM

Okay in that case, instead of GetAllACtors on the Enemy AI, maybe try GetAllActors on the Pawns they control, then GetController or GetAIController off of that, and cast to EnemyAI.

I haven't made anything with AI in it yet so not sure if that's the way to go but try it and let me know.

avatar image Tabacudo May 25 '18 at 08:46 PM

That's what I've done. I've even put a print string at the end of the code and found out that the code achieves the last node, buit, for some reason, the object is no following my character.

I'm not receiving the error anymore, now I put my AI controller to posses the pawn and when the pawn is possessed it should start following the character. My pawn should have any movement controller like "projectile movement" for projectiles?

Thx for the help.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Which property is it getting an AccessedNone for? I can see it maybe happening if the Get Player Character from index 0 is trying to get a Character when the player has possessed some other kind of pawn that is not a Character, OR, it could happen if the player at index 0 is not possessing anything at all (though that seems like likely than the first idea I had).

I am basing these comments on what I see in your blueprint screenshot above.

more ▼

answered May 25 '18 at 06:44 PM

avatar image

mightyenigma
3.8k 18 23 20

avatar image Tabacudo May 25 '18 at 07:02 PM

Hey Mightyenigma!

The message says it's about the AI obtained in "Get all actors of class" node. My character is surely a pawn. How can i get it then?

I'm using the Twin Stick Shooter pattern and the character already comes as a pawn.

avatar image Tabacudo May 25 '18 at 07:08 PM

I tried now using "Get player pawn" but no success. The message sais the the 'none' is obtained when I use the "GET" in array.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I'm not sure but if you want to use NavMesh functions like MoveTo, etc., I think I heard that they require CharacterMovement component so the Pawn should extend the Character class.

Again I have never tried doing this so it's only a guess.

more ▼

answered May 25 '18 at 08:50 PM

avatar image

mightyenigma
3.8k 18 23 20

avatar image Tabacudo May 25 '18 at 09:22 PM

I'm trying with character too. I don't know the reason yet but, using AI to control the movement is not working. When I use another node that doesn't requires AI control, it works fine, but the character has no "Intelligence" and moves in straight line.

avatar image mightyenigma May 25 '18 at 09:31 PM

Hm did you ever Possess the pawn with your EnemyAI class?

avatar image mightyenigma May 25 '18 at 09:31 PM

Oops sorry you already mentioned earlier that you did. my mistake.

avatar image mightyenigma May 25 '18 at 09:32 PM

I'm sorry I can't be more helpful. I think it would be a good idea to try some more tutorials on how to do this. I have found several good ones in the past.

avatar image Tabacudo May 25 '18 at 09:41 PM

Ive just found that it was because I had no "floor". I've just put a floor in the scene and it started working. I can't believe this.

Thanks for the help! :D

avatar image mightyenigma May 25 '18 at 09:52 PM

OH! yes that's right - Navigation Mesh and its related functions are dependent on the floor layout, assuming that the character pawns controlled by the AI are going to be Walking :)

I'm glad you found the problem and fixed it!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question