(05-09-2013, 02:27 PM)JustAnotherPlayer Wrote: It's
if(alState == 1) //1 up, -1 down, 0 between
{
}
But how do I tell it which lever should be at that state? As it stands it is checking the 'LocalVarInt' for Wheels and Coal, there is no lever currently defined.
Here is the actual code I have (its from frictionals script and is placed before the onstart bit, its a bit strange but it works):
void StartMachine(string sEntity)
{
PlaySoundAtEntity("s1"+sEntity, "13_ignite", sEntity, 0.2f, false);
PlaySoundAtEntity("s2"+sEntity, "13_machine_fail", sEntity, 0.2f, false);
if(GetLocalVarInt("WheelOK") == 3 && GetLocalVarInt("Coal") == 3)
{
for(int i=1;i<=6;i++){
CreateParticleSystemAtEntity("DoneP"+i, "ps_steam.ps", "DoneParticles_"+i, true);
PlaySoundAtEntity("DoneS"+i, "13_steam", "DoneParticles_"+i, 0.5, true);
}
for(int i=1;i<=8;i++)
CreateParticleSystemAtEntity("SteamP"+i, "ps_steam_cloud.ps", "SteamCloud_"+i, true);
SetGlobalVarInt("ElevatorMachineRunning", 1);
StartScreenShake(0.03f, 2.0f, 0.5f,1.5f);
PlaySoundAtEntity("s3"+sEntity, "13_machine_run", sEntity, 2, true);
PlaySoundAtEntity("s31"+sEntity, "13_machine_extra", sEntity, 2, true);
PlaySoundAtEntity("s4"+sEntity, "13_whomp", sEntity, 4, true);
PlayMusic("13_puzzle_machine.ogg", false, 1.0f, 0.5f, 10, false);
GiveSanityBoost();
RunWheels(1.0f,-1.0f);
SetLeverStuckState(sEntity, 1, false);
}
else
{
StartScreenShake(0.01f, 1.0f, 0.25,0.5f);
AddTimer("stopwheels", 1, "TimerMachineError");
RunWheels(1.0f,-1.0f);