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
18
S
9
Posts: 272
Reputation: 2,363

Post » Thu Apr 13, 2017 10:04 pm

Array.At(Array.IndexOf("WeaponName"),1)
Mistakes were made.
B
60
S
30
G
132
Posts: 1,932
Reputation: 74,341

Post » Thu Apr 13, 2017 10:23 pm

@oosyrag Perfect, thanks!
B
18
S
9
Posts: 272
Reputation: 2,363


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 9 guests