I did not think this would work!

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:smile: :sad: :eek: :shock: :cool: :-x :razz: :oops: :evil: :twisted: :wink: :idea: :arrow: :neutral: :mrgreen:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: I did not think this would work!

Re: I did not think this would work!

by Roody_Yogurt » Sat Aug 24, 2024 11:00 pm

Yeah, this can be pretty useful. I usually add parentheses, though, just in case I'm grouping the properties in an order that the engine doesn't expect:

Code: Select all

print (ItemsArray[fighter.equippedWeapon].ammo_type).name

I did not think this would work!

by Ice Cream Jonsey » 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:

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.

Top