Hazard lights script (EM4)

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

Information: The EMERGENCY community board is completely free and is financed by advertisement. Please deactivate adblocker if you use this site. Thank you!

  • Sample script to create hazard lights in EMERGENCY 4.

    Hazard lights-script

    The hazard lights script activates the turn signals which are existing on every civil and emergency vehicle in EMERGENCY 4 from the beginning. Thanks to Patch 1.05, it is possible to individually activate the turn signal via command script.

    This command script only works with EMERGENCY 4 version 1.05 or higher!

    Operation

    The hazard lights script has the name "VCmdWarningLights". VCmd is my personal version of the script naming, so that one later track reserves which command is for which type intended. VCmd" - "Vehicle Commando".

    For proper function the vehicle requires only the "VCmdWarningLights" in the editor. How a command script is assigned to a vehicle is explained in the editor instructions.

    Script

    The script is available as download and as code snippet on this page. (warninglights.rar)

    Source Code

    1. const char DUMMY_HASWARNINGLIGHTS[] = "DUMMYHasWarningLights";
    2. // Hier muss der Name(!) des Bildes aus dem UI-Ordner stehen.
    3. const char IMG[] = "warninglight";
    4. const char DUMMY_HASWARNINGLIGHTS[] = "DUMMYHasWarningLights";
    5. int DummyGroup = 20;
    6. // 1.0
    7. object VCmdWarningLights : CommandScript
    8. {
    9. VCmdWarningLights()
    10. {
    11. SetIcon(IMG);
    12. SetCursor(IMG);
    13. SetGroupID(DummyGroup);
    14. SetGroupLeader(true);
    15. SetRestrictions(RESTRICT_SELFEXECUTE);
    16. }
    17. bool CheckPossible(GameObject *Caller)
    18. {
    19. if (!Caller->IsValid())
    20. return false;
    21. if (Caller->GetType() == ACTOR_VEHICLE)
    22. {
    23. return true;
    24. }
    25. return false;
    26. }
    27. bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    28. {
    29. if (!Caller->IsValid() || !Target->IsValid() || Target->GetID() != Caller->GetID())
    30. return false;
    31. if (Caller->GetType() == ACTOR_VEHICLE)
    32. {
    33. return true;
    34. }
    35. return true;
    36. }
    37. void PushActions(GameObject *Caller, Actor *Target, int childID)
    38. {
    39. Vehicle v(Caller);
    40. if (v.HasCommand(DUMMY_HASWARNINGLIGHTS))
    41. {
    42. v.EnableBlinker(BLT_NONE);
    43. v.RemoveCommand(DUMMY_HASWARNINGLIGHTS);
    44. return;
    45. }
    46. if (!v.HasCommand(DUMMY_HASWARNINGLIGHTS))
    47. {
    48. v.EnableBlinker(BLT_BOTH);
    49. v.AssignCommand(DUMMY_HASWARNINGLIGHTS);
    50. return;
    51. }
    52. }
    53. };
    54. // 1.1
    55. object DUMMYHasWarningLights : CommandScript
    56. {
    57. DUMMYHasWarningLights()
    58. {
    59. SetGroupID(DummyGroup);
    60. }
    61. bool CheckGroupVisibility(GameObject *Caller)
    62. {
    63. return false;
    64. }
    65. bool CheckPossible(GameObject *Caller)
    66. {
    67. return false;
    68. }
    69. bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    70. {
    71. return false;
    72. }
    73. void PushActions(GameObject *Caller, Actor *Target, int childID)
    74. {
    75. }
    76. };
    Display All

    Troubleshooting

    If error messages and problems occur, the author of the script can be contacted. For this, a detailed description of the fault and, optimally, a log file has to be added.

    Author: Bass-ti
    Contact: Bass-ti@ddr-mod.de
    Scriptname: WarningLights.script
    Script version: V.1.1 Date: 18.04.2006
    Notes: See below

    This hazard light script is not only used to disable the hazard lights, it is also the group leader all DUMMY scripts I write. As you can see each command script in the EMERGENCY 4 menu I had to think of something, so that one no longer sees this. So I needed a commando what each vehicle has, which has a meaningful function and at the same time is the group leader for dummies. If a group has several commands, then looks EMERGENCY 4 ever after which is the commandos group leader and displays any of the other (unless the group leader is not executable).

    1,797 times viewed