M
mcsqueasy
Guest
Hello! Super green and barely started tinkering around with gms2. I'm following Tom Francis' tutorial series Making a Game With No Experience (done in gms 1.4). Part 9 has him designing an array that builds itself as the player picks up weapons. However, after following the video multiple times and ensuring my code matches his, I get this error on trying to pick up a weapon:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object oSingleShotGun:
Variable oSingleShotGun.SelectedWeaponIndex(100010, -2147483648) not set before reading it.
at gml_Object_oSingleShotGun_Step_0 (line 7) - if Owner.Weapon[SelectedWeaponIndex] = self.id {
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oSingleShotGun_Step_0 (line 7)
I gather that it's needing the SelectedWeaponIndex to be defined, but I have it set to 0 in the Create event for the player object. I'm not sure where else to look or what I need to add to make it happy. I've tried adding SelectedWeaponIndex = 0 for the Create events on the weapon objects, but then that breaks the code I have to switch weapons with rmb.
Any help would be amazing. Thanks!
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object oSingleShotGun:
Variable oSingleShotGun.SelectedWeaponIndex(100010, -2147483648) not set before reading it.
at gml_Object_oSingleShotGun_Step_0 (line 7) - if Owner.Weapon[SelectedWeaponIndex] = self.id {
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oSingleShotGun_Step_0 (line 7)
I gather that it's needing the SelectedWeaponIndex to be defined, but I have it set to 0 in the Create event for the player object. I'm not sure where else to look or what I need to add to make it happy. I've tried adding SelectedWeaponIndex = 0 for the Create events on the weapon objects, but then that breaks the code I have to switch weapons with rmb.
Any help would be amazing. Thanks!