Hi All,
I was wondering if someone maybe able to help with a very annoying coding problem i’ve got.
I need to find distance between player and 4 moving triggers in the same room.
How the map works is player needs to find location A then B in a room from location 1 after which they are moved to location 2 in the same room but they now have to find location C and D.
By moving to location 2 (and because I’m pants at programming) I’ve moved the triggers for location A and B below the ground so the player can’t mistakenly walk on them to activate them.
Now here’s the tricky bit if the player can’t find location A, B, C or D, I need the player to press a key from their current location in the room that will show their distance between them and the trigger.
I also need to be able to test this to ensure if I get some values I can run a calculation to ensure its accurate.
I’ve tried the “get distance to” function on keypress between each trigger location in a variable that’s sequentially updated when each trigger is moved into the desired location, but it’s not working and I can’t test the data I get back to check.
Although, that sounds quite difficult to do or make sense of even, for me as a very amateur programmer, how would I repurpose my BP to include the functionality of yours?
The reason why I haven’t destroyed the trigger (I sorta looked into this) is because in my game we try to give the player 3 attempts to learn where each of the triggers are before on the 4th attempt they’ve gotta do it for real.
I only set the first one, but you get the idea. You have an int which tells you which is the current target. Then you can make a function which gives the distance to the current target:
One of the problems I have is for my map I need to train the player in finding two trigger locations in a room by having them do it 4 times once they’re comfortable with finding these 2 items, they then have to find another 2 from a different location in the map similarly 4 times.
They then return to their first position in the room find the first 2 triggers then are moved to the second position to find the last two to complete the game.
I’m using separate triggers each time (my BP looks like bad spaghetti!) is this the correct way to do it, or should I simply use 4 triggers that are enabled and disabled each time instead (or use separate triggers that are destroyed sequentially as they’re used)?
In theory would that need changing the code above?
I’ve not actually tested this, but maybe you get the idea. In fact, we don’t use the overlap of the triggers at all, because in this case, it just complicates the situation. We’re just using them as markers.
You could also do a more elaborate version that does use overlap and destroy, and spawns the boxes at the start of each round. But that would be a lot to explain here.
Tell me how it goes…
( you wanna make that distance to check 100 rather than 50 ).
Oh Man, I can’t even set up the trigger array, I’ve added an array, with a variable type of trigger box, but in its default values section I only have the option of selecting one of the triggers that already in the map, not the option of adding multiple array elements you have in yours?
Could I be really annoying and please ask for a step by step, I’m going mad trying to figure this out on 4.21.
When I try to set up the trigger array I can only get 1 trigger reference in there not the multiple values for multiple triggers I should and like you do in the image?
If you could do a step by step I’d really appreciate it because as I’m stupid, I’m doing something very simple wrong and I’m sorry for the hassle this must cause
I’m REALLY SORRY, I’m going to look really really stupid but I can’t get it to work, I can’t seem to even find the variable types.
I’m honestly SORRY to be a pain but would it be possible to list which exact variables you’ve used to construct the BP as I’m really pulling my hair out, a step by step would be massively appreciated.
I know you’re very busy, but I’d really appreciate it.