I have code that lets you reload a gun in combat. By default, the game says
N)ew magazine
Well, that doesn't work when the weapon is a shotgun. I have a shotgun_type defined, so I was going to have the game say
N)ew round of shells
When the weapon to be reloaded was a shotgun. Except that the bean bag gun shoots bean bags, but it has shotgun_type
I ended up trying this, which I did not think would work:
Code: Select all
if ItemsArray[fighter.equippedWeapon] is shotgun_type
{
"N)ew round of ";
print ItemsArray[fighter.equippedWeapon].ammo_type.name
}
I didn't think you could reference the name of the ammo_type like that. For some reason, I thought that Hugo would stop you once you had, essentially, "the first dot." But it didn't!
So that is cool and made me happy.
I have code that lets you reload a gun in combat. By default, the game says
N)ew magazine
Well, that doesn't work when the weapon is a shotgun. I have a shotgun_type defined, so I was going to have the game say
N)ew round of shells
When the weapon to be reloaded was a shotgun. Except that the bean bag gun shoots bean bags, but it has shotgun_type
I ended up trying this, which I did not think would work:
[code]
if ItemsArray[fighter.equippedWeapon] is shotgun_type
{
"N)ew round of ";
print ItemsArray[fighter.equippedWeapon].ammo_type.name
}
[/code]
I didn't think you could reference the name of the ammo_type like that. For some reason, I thought that Hugo would stop you once you had, essentially, "the first dot." But it didn't!
So that is cool and made me happy.