I did not think this would work!
Posted: Tue Aug 20, 2024 8:21 pm
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:
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.
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
}
So that is cool and made me happy.