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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Triggering an event from a collision box

I am trying to make a procedurally generated world where the next two rooms will spawn when the player enters the room leading to them. At the moment I am able to get them to spawn as many rooms as I want by placing a loop on the "Spawn Rooms" function, but that's not what I need.

At the center of the world is an actor called "Course Generator". This is used to spawn all the rooms. On "Event BeginPlay" it spawns the first room, then the second two leading off, as you can see below. After that, I want to move into the right room in-game through that door and have the next two rooms spawn.

I have tried varies things, but I can't get it to work from the collision box. I have tested the collision box is working and that the cast is working by having the player character explode while it goes through and that worked fine, but I can't get the rooms to spawn for some reason.

alt text

Product Version: UE 4.12
Tags:
2016-09-04.jpg (916.8 kB)
more ▼

asked Sep 03 '16 at 10:44 PM in Blueprint Scripting

avatar image

Mx Tekuno
15 4 6 6

avatar image Lolxh4 Nov 23 '18 at 12:16 AM

I think we need some more info on the rest of the code or where it is failing. We can't really tell what's going wrong when what you have given so far works (the collision and event call). Can you simply spawn the rooms without the collision and instead use a keypress after begin play?

avatar image ThompsonN13 Nov 23 '18 at 12:37 AM

doubt youll get a reply there the question is from over two years ago.

its a pretty simple thing though. if they want to have more rooms spawn off the one they just entered, then you would simply need to have a room actor, have a collision volume that cover the entire room, then have designated locations where you would spawn the further rooms. for the script you would have on begin overlap -> check is player -> for loop -> spawn room actor. you would also need to plug in the locations where you want to spawn the room. the locations could be set either with scene components or you could convert local space to world space.

the issue with this approach is that it doesnt take into consideration if overlapping rooms happen. so you may also want to add a step which checks for overlaps where you attempting to place a room. this approach may also lead to a grid style layout so you may want to add in variations to the rooms, some with two exits, some with 3, others like a hall. though that leads to another issue of door placement since you may spawn a room with 4 doors next to a hall which doesnt have a door facing the room with doors.

avatar image Lolxh4 Nov 23 '18 at 02:18 AM

Oh, I'm quite new to the community and thought I was browsing new threads lol. Glad to see how active you are around here; I hope to share my knowledge as I learn along with others.

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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