Ambient lighting script (EM4)

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

  • Sample script to create ambient lighting in EMERGENCY 4.

    Umfeldbeleuchtungs-Script

    The ambient lighting script is used to illuminate the area of emergency vehicle. All environment lights must be defined as "Special Lights" in the editor.

    Operation

    The ambient lighting script has the name "VCmdSurroundingLights". "Cmd" is my personal brand of script naming. "VCmd" means "VehicleCommando".

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

    Script

    The Script is offered as a download, as well as a code directly on this page. (surroundinglights.rar)

    Source Code

    1. const char DUMMY_HASSURLIGHTS[] = "DUMMYHasSurroundingLights";
    2. // Here the name(!) of the image of the UI folder must stand .
    3. const char IMG[] = "SurroundingLights";
    4. int DummyGroup = 20;
    5. // 1.0
    6. object VCmdSurroundingLights : CommandScript
    7. {
    8. VCmdSurroundingLights()
    9. {
    10. SetIcon(IMG);
    11. SetCursor(IMG);
    12. SetRestrictions(RESTRICT_SELFEXECUTE);
    13. }
    14. bool CheckPossible(GameObject *Caller)
    15. {
    16. if (!Caller->IsValid())
    17. return false;
    18. if (Caller->GetType() == ACTOR_VEHICLE)
    19. {
    20. return true;
    21. }
    22. return false;
    23. }
    24. bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    25. {
    26. if (!Caller->IsValid() || !Target->IsValid() || Target->GetID() != Caller->GetID())
    27. return false;
    28. if (Caller->GetType() == ACTOR_VEHICLE)
    29. {
    30. return true;
    31. }
    32. return true;
    33. }
    34. void PushActions(GameObject *Caller, Actor *Target, int childID)
    35. {
    36. Vehicle v(Caller);
    37. if (v.HasCommand(DUMMY_HASSURLIGHTS))
    38. {
    39. v.EnableSpecialLights(false);
    40. v.RemoveCommand(DUMMY_HASSURLIGHTS);
    41. return;
    42. }
    43. if (!v.HasCommand(DUMMY_HASSURLIGHTS))
    44. {
    45. v.EnableSpecialLights(true);
    46. v.AssignCommand(DUMMY_HASSURLIGHTS);
    47. return;
    48. }
    49. }
    50. };
    51. // 1.1
    52. object DUMMYHasSurroundingLights : CommandScript
    53. {
    54. DUMMYHasSurroundingLights()
    55. {
    56. SetGroupID(DummyGroup);
    57. }
    58. bool CheckGroupVisibility(GameObject *Caller)
    59. {
    60. return false;
    61. }
    62. bool CheckPossible(GameObject *Caller)
    63. {
    64. return false;
    65. }
    66. bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    67. {
    68. return false;
    69. }
    70. void PushActions(GameObject *Caller, Actor *Target, int childID)
    71. {
    72. }
    73. };
    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 is to be added.

    Author: Bass-ti
    Contact: Bass-ti@ddr-mod.de
    Script name: SurroundingLights.script
    Script version: V.1.0 Datum: 29.04.2006
    Note: All subsequent environment lights shall be defined as Special Lights.

    749 times viewed