Array syntax

Get help using Construct 2

Post » Thu Apr 13, 2017 9:51 pm

Hi everyone,

I have a two column array that serves as my inventory of collected weapons and their ammo count. So one column holds the name strings and the second has the ammo value.

Upon picking a weapon up i want to check if it is already in my inventory. If so i only want to add a fixed value to the ammo count.

My issue now: i cant get the expression right to only pass the weapon name in, find its line in the array and count up the value in the column next to it.
B
12
S
5
Posts: 207
Reputation: 1,672

Post » Thu Apr 13, 2017 10:04 pm

Array.At(Array.IndexOf("WeaponName"),1)
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Thu Apr 13, 2017 10:23 pm

@oosyrag Perfect, thanks!
B
12
S
5
Posts: 207
Reputation: 1,672


Return to How do I....?

Who is online

Users browsing this forum: ketramtu18, MaujDeveloper and 9 guests