Variable "translation" in Actor clashes with Translation str

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!
User avatar
Jekyll Grim Payne
 
 
Posts: 1071
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Variable "translation" in Actor clashes with Translation str

Post by Jekyll Grim Payne »

Tried making a colored lensflare that changes sprite depending on master's translation.
This doesn't work:

Code: Select all

Class BD_PlasmaFlare : Actor
{
Default {
	+NOINTERACTION
	renderstyle "Add";
	alpha 0.4;
	scale 0.1;
	}
states
	{
	Spawn:
		LENB A 0 NoDelay {
			if (master && master.translation == Translation.GetId("GreenPlasma"))
				sprite = GetSpriteIndex("LENG");
			A_Warp(AAPTR_MASTER);
			}
		#### A 1 bright {
			if (!master)
				self.destroy();
			}
		wait;
	}
}
Error: Invalid expression on left hand side of GetID


This works, though:

Code: Select all

class Extensions {
    static int GetTranslationID (name transname) {
        return Translation.GetID (transname);
    }
}

Class BD_PlasmaFlare : Actor
{
Default {
	+NOINTERACTION
	renderstyle "Add";
	alpha 0.4;
	scale 0.1;
	}
states
	{
	Spawn:
		LENB A 0 NoDelay {
			if (master && master.translation == Extensions.GetTranslationID("GreenPlasma"))
				sprite = GetSpriteIndex("LENG");
			A_Warp(AAPTR_MASTER);
			}
		#### A 1 bright {
			if (!master)
				self.destroy();
			}
		wait;
	}
}

User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Variable "translation" in Actor clashes with Translation

Post by Graf Zahl »

This isn't really a bug. Unfortunately I do not have a good idea how to resolve this clash in a simple fashion.
Post Reply

Return to “Bugs [GZDoom]”