Here is a video link to my problem that I have uploaded to youtube: https://www.youtube.com/watch?v=_8Pa_wz4bfk
if dropable:
if Input.is_action_just_pressed("right_click"):
if inventory[dropable_index] != null: # If input and slot isnt empty add and remove 1
if inventory[dropable_index].amount < inventory[dropable_index].max_amount:
if hand_array[0].amount > 1:
inventory[dropable_index].amount += 1
hand_array[0].amount -= 1
update_slot(dropable_index)
update_held_item()
else:
if hand_array[0].amount > 1:
var saved = hand_array.duplicate(true) # A dup that SHOULDNT TOUCH THE ORIGNAL ARRAY
saved[0].amount = 1 # sets it to one ONCE
print(hand_array[0].amount) # GETS TOUCHED ANYWAY
inventory[dropable_index] = saved[0] # Setting the new inventory slot to new item
hand_array[0].amount -= 1 # Removes one to make it look like its dropping a item
update_slot(dropable_index)
update_held_item()
for what ever reason this website cant format my code correctly...
anyways I am trying to duplicate an item in the array between two different arrays one being the inventory and one being the held item array but for what ever reason it keeps touching the held item array when I SPECIFICALLY TOLD IT, ITS A DUPLICATE and it still touches the array like its still referencing it when i told it, it shouldn't!