Download

Generate Overlap Events on ARRAY

Hello, I have 20 checkpoints in a racing game with the final checkpoint being the finish line. Once crossed I’m trying to generate an overlap event to reset all the checkpoints to true for a new lap. I’ve created an array with those 20 checkpoints and tried a few things but the problem i’m having is the SET GENERATE OVERLAP EVENTS only seems to apply to a single target, so I’m not sure how I can set all 20 at once based on the start line trigger.

The code below is pulling all the correct values for the array but fails to turn back on the generate overlap event. Any suggestions on what else I could try?

Thanks

That’s because you are applyng it to a single target: You have a single obj reference (FinishLineCollisionBox) connected to the bool set node and you are running it on every index of the string array.

The array you have in the image is an array of string, not of the checkpoints. you need to loop through an array that contains reference to the checkpoints and set the bool for each.

I’m not really clear on your suggestion but do appreciate the feedback and will have to do some more research to see if I can figure it out. I tried make array but it required I cast to each blueprint since each checkpoint is it’s own blueprint, could not make that work. Will keep playing around with it, thanks.

EDIT: Below is what I started with but it did not work because the variables on he trigger boxes throw a accessed none trying to read property, so no array was being created which is why I tried insead to put it in a string array but then the generate overlaps never worked because like you mentioned it can only be targets at one object.

Hey just wanted to post back based on another recommendation I found a workaround for this. Never could get it to work via an array like I was trying above so did used a different method.

  1. Create a blueprint just called BP_CHECKPOINT , add the collision box to this blueprint
  2. Create the 17 checkpoint blueprints as children of the above parent
  3. On each blueprint the collision box was inherited from the parent above so I had to remove my collision boxes and use the one from step 1
  4. Use a get all actors of class and call BP_CheckPoint class
  5. The output of this is an array, plugged in to a FOR EACH LOOP
  6. Then the generate overlap event works and the target is always the collision box from step 1. It now resets the overlap event for all 17 checkpoints.

I’m sure there are many ways to achieve this.

For example:

  1. BP_CheckpointController that holds reference to all checkpoints:
    Checkpoint Controller posted by pezzott1 | blueprintUE | PasteBin For Unreal Engine 4

  2. BP_Checkpoint that has the collision box:
    Checkpoint Actor posted by pezzott1 | blueprintUE | PasteBin For Unreal Engine 4

With a little extra work you can make it so they have to be triggered in order.

Hope it helps.

I wish I had found that video days ago, thank you for sharing I like that method better than what I’m using now so may end up changing my blueprint code.

1 Like