# Does the Multi-Dimensional map exist?

**URL:** <https://forums.unrealengine.com/t/does-the-multi-dimensional-map-exist/1718172>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [February 28, 2024, 12:19pm UTC](https://forums.unrealengine.com/t/does-the-multi-dimensional-map-exist/1718172 "2024-02-28T12:19:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidpkami](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidpkami/32/1040403_2.png) [@davidpkami](https://forums.unrealengine.com/u/davidpkami)\
**Post date:** [February 28, 2024, 12:19pm UTC](https://forums.unrealengine.com/t/does-the-multi-dimensional-map-exist/1718172/1 "2024-02-28T12:19:33Z")

</div>

I am trying to use a multi-dimensional map.

```auto
var AllAgentsShopBeacons : [agent][int]?beacon_device = map{}

```

The code does not show any error, but when I try to change the value, I can´t

```auto
loop:
            if(MaybeBeacon := AllAgentsShopBeacons[Agent][Index], MaybeBeacon = false?, set AllAgentsShopBeacons[Agent][Index] = Beacon):
                break

```

ANy ideas?

---

<div class="post-metadata">

**Author:** ![LogisonDK](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LogisonDK](https://forums.unrealengine.com/u/LogisonDK)\
**Post date:** [February 29, 2024, 4:55am UTC](https://forums.unrealengine.com/t/does-the-multi-dimensional-map-exist/1718172/2 "2024-02-29T04:55:59Z")

</div>

Hey, when i have tried to use Multy-Dimensional map i could also not set the value when i used

```auto
set AllAgentsShopBeacons[agent][int] = Beacon

```

A work around could be to first get the map the agent is key to. Then you could make a copy of that map as a varible and set index as key to the Beacon value. Then at last save that map as value to AllAgentsShopBeacons[agent]

if AllAgentsShopBeacons[agent] dont have a map you could create a new map and set it to it.

here is a example i just tested where when i tried to check AllAgentsShopBeacons[agent][int] i got a value.

```auto
# Changed the types so it would be easier to test
var AllAgentsShopBeacons : [string][int]float = map{}
Agent := ""
Index :int= 0
Beacon := 1.0

# Loop break
var counter :int = 0
loop:
    if (counter = 10):
        Print("No beacons found")
        break
    
    if:
        Col := AllAgentsShopBeacons[Agent]
        var new : [int]float = Col
        set new[Index] = Beacon
        set AllAgentsShopBeacons[Agent] = new
    then:
        break
    else if:
        not AllAgentsShopBeacons[Agent]
        new : [int]float = map{Index => Beacon}
        set AllAgentsShopBeacons[Agent] = new
    then:
        break
    
    set counter = counter + 1
  
# To Test
if(Val := AllAgentsShopBeacons[Agent][Index]):
    Print("Beacon found {Val}") # Output = Beacon found 1.000000
else if(not AllAgentsShopBeacons[Agent][Index]):
    Print("if work but no beacon found")
else:
    Print("Beacon not found")

```

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 30, 2024, 4:56am UTC](https://forums.unrealengine.com/t/does-the-multi-dimensional-map-exist/1718172/3 "2024-03-30T04:56:06Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
