I’m trying to create something that will let me shoot something with a line trace and teleport them to a location. I’ve set up 3 target points and have managed to have them teleport there but the issue is that once one has been teleported, another one can be teleported to the same spot. Is there a way I can alter this code so that once that spot has been called, it can’t be picked again? Thanks
You can just remove the target from the array, using REMOVEINDEX.
I’ve tried the remove index but I can’t figure out how to get it to work for what I want to do. Do you know how I’d implement it? Thanks
Just before you decide to jaunt there, remove the index:
Not at a machine right now, so can’t draw it. But you have the array and index, that’s all you need.
( store that random in in a variable first ).
Yes, because you’ve removed the index, and then try to use it.
Either
-
Store the index and location, then remove the index and make the jump
-
Store the index, make the jump, then remove the index.
Store the index, then only use that variable. Don’t keep making calls to ‘random integer’, because every time you reference it, you’ll get another value.
That looks good. Does it work?
No it didn’t, it put all 3 characters on top of each other
Is the code you’re showing here, just to move one player?
Is there any other code?
So I have 3 “Aliens” (AI) in my level that when hit with a line trace (EventAnyDamage at the start of this code) teleports them to a “Prison area” which is where the 3 target points are. The only other code related to this is the linetrace hitting them
Ah, I see the problem… ( sorry for confusion ).
The problem is, that every AI is always getting all of the target points.
In the AI, you don’t need to remove the index, you need to destroy that target point. ( DestroyActor ).
Then, the other AIs won’t get it in their list when you hit them.
You can get the actor reference here