Jump to content
Oliver Hope

Splicing temp array splices original as well

Recommended Posts

hey

i made a tempary array so i could splice some elements out
i wanted to keep a refrence of all the original elements

but when splicing the tempary one it seems to splice the first one aswell

Ylands_181218_220223.thumb.png.0f2e826630706e214b1aa089df9a9934.png

basically im trying to choose a random player from an array of players except the one that triggered the trigger zone

JUGGERNAUT_1.0.6.zip

 

 
Edited by Oliver Hope_P1

Share this post


Link to post
Share on other sites

Hi you need to copy the first one. Arrays are reference types. Assigning them to a new variable will not make a new copy.

Use "Slice" to copy original array.

Share this post


Link to post
Share on other sites
10 hours ago, Houp said:

Hi you need to copy the first one. Arrays are reference types. Assigning them to a new variable will not make a new copy.

Use "Slice" to copy original array.

Ohhh that is very interesting and makes lots of sense, thanks a lot, i learnt something new

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×