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
16
S
7
Posts: 246
Reputation: 2,094

Post » Thu Apr 13, 2017 10:04 pm

Array.At(Array.IndexOf("WeaponName"),1)
Mistakes were made.
B
55
S
28
G
115
Posts: 1,709
Reputation: 65,116

Post » Thu Apr 13, 2017 10:23 pm

@oosyrag Perfect, thanks!
B
16
S
7
Posts: 246
Reputation: 2,094


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests