I have this float named "Speed" since forever in my game, and I also always have this problem with RenderParticles:OnEmitExpression component saying: Invalid conversion: float(Speed))
So I converted Speed to SpeedRounded (int), because of that error message, and everything was fine. But I suspected that was weird, since the RenderParticles properties are float.
Today, I dug a little, and it turns out that float/int wasn't the problem! The bug is that RenderParticles:OnEmitExpression can't tell the difference between the RenderParticles properties and the name of the var:
this.Speed = Player.Speed; // BUG!
I made a really small example:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?> <ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2"> <OnUpdate> <ZExpression> <Expression> <![CDATA[ Speed = 5.5; VarInt = Speed;]]> </Expression> </ZExpression> </OnUpdate> <OnRender> <RenderParticles ParticlesPerSecond="50" Spread="3.14" ParticleWidth="0.01" ParticleHeight="0.01" Speed="2.75" ParticleLifetime="2" AnimateSize="0.1"> <OnEmitExpression> <![CDATA[//Emit particle. //PColor : particle color, PAngle : particle angle //Speed = VarInt; this.Speed = Speed;]]> </OnEmitExpression> </RenderParticles> </OnRender> <Content> <Variable Name="VarInt" Type="1"/> <Variable Name="Speed"/> </Content> </ZApplication>
This is preventing users to have variables named "Speed", "Direction" or "Gravity" in their projects if they are using a RenderParticles component and want to plug the RenderParticles properties to those variables.
So I was wondering if this was normal before renaming all my variables to more personal nicknames such as "MySpeed"?