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"

How to get an actor's specific component with a component blueprint?

So I have a projectile that has a Box collosion component. I created a "CanHarm" blueprint component that applies damage to enemy on hit. alt text

The problem is it kills the first enemy but after that the arrow(projectile) flies away from target (I have a custom homing projectile that's not perfect but it worked without my custom component). Also there is one error message when I stop playing:

Accessed None 'CallFunc_Array_Get_Item' from node "Do Damage" in blueprint "Can Harm"

I think this is the source of the projectile strange behaviour. Also I tried "Is Valid" stuff with owning actor and the component too (so from "Get Owner" and after the get first item from array).

Product Version: Not Selected
untitled.jpg (407.1 kB)
more ▼

asked Apr 19 '15 at 10:57 AM in Blueprint Scripting

avatar image

21 6 8 11

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

3 answers: sort voted first

Accessed Nine 'CallFunc_Array_Get_Item' from node "Do Damage" in blueprint "Can Harm"

Do you mean "Accessed None"? That would be caused by the array "Get 0" node. If you have no items in an array (the length is zero) but try to get the first item, you'll get an error. Item 0 is the first item, which is only okay to ask for if there is indeed at least one item in an array. So the bullet is likely hitting something that doesn't have that component on it.

To fix this issue, put in a branch that checks if the length of the array is > 0.

I'm not sure that will fix all of your errors, but at least you'll be able to solve the error message.

more ▼

answered Apr 19 '15 at 11:15 AM

avatar image

431 19 14 36

avatar image Levike Apr 19 '15 at 06:08 PM

Yes it got rid of the error message just like the "Is Valid" node from the GET node. The projectile still behaves strangely tho. Nevermind I'll find a solution. I wanted to know if I do things right and I guess I did everything right.

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

I have no idea if this is the issue, but have seen that error message more than I care too. When your in a loop manipulating an array, I have seen this message pop up, because the number of items in the array were being altered. In this case, it's always when you remove an item. it feels as if that during the loop the value for the "end index" is not re-evaluated during each loop, but only set, when the loop is first started. (whether you use a For loop or For Each, makes no difference). I could find no "cheap" (i.e. little processing), way to force re-evalution at the top of the loop.

So there are really only two other alternatives,

  1. build your own for loop construct ( I mean let's face it, a loop is nothing more than an IF statement that does some housekeeping for you) and make that a macro

2.if you are going to modify the contents of an array in a loop, have a temporary loop to the side, that you keep the index of the items to remove from the array, after the processing is done, just hooke the "remove" code up to the completed pin, and get after it.

To me, option 1 is the best way.

Hope that helps,

Jay Ice IceWare

more ▼

answered Sep 16 '15 at 11:29 PM

avatar image

1.4k 41 28 56

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

Bah, generally for what I was speaking of, the error message will also say something like, "9/5" as well, trying to tell you that you were trying to get the 9th element of an array that only has 5 elements

Well if this is so, how did we ever get the 6th Element without that message if the array only has 5 elements, and how did we get to the 9th element before the message was issued, if we only had 5 elements. i.e. there is no checking of the last index, at the top of the loop.

Now to your issue, yes this does pop up, in general what I found it means is that you have a null value, in the array, hence it's saying "none". I encountered this when doing Get all Overlapping actors, and the same for Overlapping Components. and using the return value to set an array. i.e. UE4 at 4.8.3, 4.9.0 and 4.9.1, is for some reason at times injecting a null into hte array coming back from the overlap request.

In order to circumvent this issue. I wrote a small routine to take an array, check for nulls, and return a new array, that has the nulls removed.

Hope this helps,


more ▼

answered Sep 16 '15 at 11:35 PM

avatar image

1.4k 41 28 56

avatar image Levike Sep 17 '15 at 06:10 AM

Uhh I haven't cared about this project for a while. The goal was to make a tower defense game. When enemy goes into towers range attack it and stay on it until it dies or goes away from range and when that happens attack next enemy. Also I wanted every projectile to hit the target.

So I created array to hold enemies only in range. I behaved funny when the enemy died in range. Leaving the area worked fine I guess. But as I'm writing I'm thinking it's not even a good thing to making an array. In Unity there is a onBeginOverlap and onBeingOverlapped :D I don't know the exact name. but UE4 has only 1 that checks if something came into range or not.

Maybe I'll try your first method. basically you are saying that the built in array not built for what I want to do. It's not that dynamic? Anyway thanks for the answer.

(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