Ghost Graphic Designs Posted March 23, 2014 Report Share Posted March 23, 2014 Hi. I'm using this script to turn the headlights (set as Special Light) on and off (just like the flashing lights script, for example). The thing is that I can only turn the lights on and when I click on the script again, the lights stay turned on. Any idea of what I'm doing wrong here? Here's the script:const char IMG[] = "Headlights";const char DUMMY_HASBELICHTING[] = "DUMMYHasBelichting";int DummyGroup = 20;// 1.0object Headlights : CommandScript{Headlights(){SetIcon("Headlights");SetCursor("Headlights");SetRestrictions(RESTRICT_SELFEXECUTE);}bool CheckPossible(GameObject *Caller){if (!Caller->IsValid())return false;if (Caller->GetType() == ACTOR_VEHICLE){return true;}return false;}bool CheckTarget(GameObject *Caller, Actor *Target, int childID){if (!Caller->IsValid() || !Target->IsValid() || Target->GetID() != Caller->GetID())return false;if (Caller->GetType() == ACTOR_VEHICLE){return true;}return true;}void PushActions(GameObject *Caller, Actor *Target, int childID){Vehicle v(Caller);if (v.HasCommand(DUMMY_HASBELICHTING)){v.EnableSpecialLights(false);v.RemoveCommand(DUMMY_HASBELICHTING);} else if (!v.HasCommand(DUMMY_HASBELICHTING)){v.EnableSpecialLights(true);v.AssignCommand(DUMMY_HASBELICHTING);}}}; Quote Link to comment Share on other sites More sharing options...
Hoppah Posted March 23, 2014 Report Share Posted March 23, 2014 The script should technically work, but you probably didn't add a dummy commandscript with the name "DUMMYHasBelichting"? If the vehicle does NOT have that dummycommand, the script will turn the lights on. That part seems to work. It's also trying to add the dummy command. If the scripts finds that dummy command, it will turn the lights off. For some reason the script probably cannot find the added dummy command, because it is non existant. That's my guess. The script is running in a loop now and keeps trying to enable the lights and add a command that probably doesn't exist. Check the logfile, it should mention it if a certain commandscript cannot be found. Quote Link to comment Share on other sites More sharing options...
Ghost Graphic Designs Posted March 23, 2014 Author Report Share Posted March 23, 2014 Copy that. Thanks for the help. Quote Link to comment Share on other sites More sharing options...