var shootsSemi =1; var shootsBursts =0; var shootsAutomatic =1; enum fireMode {Safe, Semi, Burst, Auto } var fireSelector : fireMode; var triggerDown; function initializeVariables() { slideRestPosition = gunslide.localPosition; burstShotsToGo = shootsBursts; // If the designer sets gun to a mode it doesnt have - find another if ( (shootsSemi < 1 && fireSelector = fireMode.Semi) || (shootsBurst < 1 && fireSelector = fireMode.Burst) || (shootsAuto < 1 && fireSelector = fireMode.Auto) ) { fireSelector.Value = fireMode.Safe; if (shootsSemi < 1) fireSelector = fireMode.Semi; if (shootsBurst < 1) fireSelector = fireMode.Burst; if (shootsAuto < 1) fireSelector = fireMode.Auto; } }