Making AEmitters emit? -still not working-
So yeah, I decided to start learning lua. I made a simple script attached to an AHuman, to turn on a emitter if the "R" key was pressed. Here's it:
Code:
function Create(self)
-- Defining the variables:
self.ChainPower = 0;
self.Chain1 = CreateAEmitter("Chainz Cut");
self.Chain2 = CreateAEmitter("Chainz Smoke");
end
function Update(self)
-- Now it checks if the chainbot is selected, if the chains are off and if the ignition is activated:
if self:ChainPower == 0 and MovableMan:IsActor (self) and UInputMan:KeyPressed == ("R") then
-- If all of the above conditions are true, enable the chains and smoke:
self.ChainPower = 1;
self.Chain1:EnableEmission(ChainsEnabled);
self.Chain2:EnableEmission(SmokeEnabled);
-- The else case is not here because it is not needed.
end
-- Now it checks again for the above conditions again, but to see if the chains are already activated:
if self:ChainPower == 1 and MovableMan:IsActor (self) and UInputMan:KeyPressed == ("R") then
-- If the conditions are fulfilled, turn the chains and smoke off:
self.ChainPower = 0;
self.Chain1:EnableEmission(false);
self.Chain2:EnableEmission(false);
-- Again, the else case is not needed.
end
end
And when I press the R key... Nothing happens. Nothing appears on the console, the emitters are not activated, absolutely nothing. The game doesn't even crash or show an error message.
If anyone could point out the problem, I would be most grateful.