UE1 - UT syntax to assign class type variable via a name variable?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Helen

Member
Jan 23, 2010
48
0
6
Does anyone have an answer to this question, see the comments in the code sample, thanks.

Code:
var class<Weapon> DefaultWeapon;

function dummy()
{
	local name aWeaponName;

	// Assume I have a valid class around called myCustomWeapon
	aWeaponName = 'myCustomWeapon';

	// This sort of assignment works
	DefaultWeapon = class'myCustomWeapon';

	// But how can I assign DefaultWeapon based on aWeaponName?
	// Here is stuff I tried but doesn't work...
	DefaultWeapon = class(aWeaponName);
	DefaultWeapon = class<aWeaponName>;
	DefaultWeapon = aWeaponName.class;
}
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Note that classes need a package reference. Just the name won't be enough for loading it. You can try looking it up in the INT files, though. GetNextInt() is your friend there.