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
15
S
6
Posts: 232
Reputation: 1,931

Post » Thu Apr 13, 2017 10:04 pm

Array.At(Array.IndexOf("WeaponName"),1)
Mistakes were made.
B
53
S
27
G
114
Posts: 1,695
Reputation: 64,438

Post » Thu Apr 13, 2017 10:23 pm

@oosyrag Perfect, thanks!
B
15
S
6
Posts: 232
Reputation: 1,931


Return to How do I....?

Who is online

Users browsing this forum: facecrime and 8 guests