Jump to content


Tutorial info

  • Added on: Mar 06 2008 11:06 PM
  • Date Updated: Sep 21 2012 06:14 PM
  • Views: 15018
 


* * * * *
1 Ratings

Emergency 4 - Script: Siren

Posted by Hoppah on Mar 06 2008 11:06 PM
Emergency 4 - Script: Siren
Difficulty: Easy
Programs used:
Emergency 4 Editor (v1.3)
NotePad

==========================

WHAT ARE THE SIREN SCRIPTS:

The original Siren scripts are named SoSi and were made by Bass-Ti.
SoSi means Sondersignal in German. In English it means Siren.

In this tutorial we call the scripts 'Siren scripts'.
The scripts and commands make it possible to do a few new things:
- Possible to have a different siren for each vehicle.
- Sirens are looped: Siren won't stop after a few seconds, but will be repeated until the vehicle stops moving or when you disable the siren.

The scripts contain 3 new commands:
- VCmdSirens Turns the sirens on or off
- VCmdAutoSirenOn -Off Sirens will activate or deactivate automaticly when vehicle starts moving or stops moving. You can turn this off or on.

Image 01: Siren commands

==========================

HOW DOES IT WORK?:

Download this .zip package: Siren scripts
Extract the .zip package and move the 8 scripts to the following folder in your mod: "YourMod/Scripts/Game/Command/..."
Create new folders if necessary. Move the Icons folder from the package to your mod folder.

Start the editor, load your mod. Add the following two commands to all vehicles which must have the new siren commands
- VCmdSiren and VCmdAutoSirenOff.

VCmdAutoSirenOff means the vehicle HAS the ability to turn the automatic sirens off. This means automatic sirens are on for default when the vehicle has this command.

Image 02: Add commands to your vehicles

==========================

AUDIO FILES:
If you want to have custom, new sirens in your mod you need to find or make them.
Audio files in Emergency 3 and 4 will only work if they are mono and in .wav format.
Otherwise they won't be played.

If you want to use new sirens it can be a good idea to replace the original Emergency 4 sirens with empty audio files.
You can download empty sirens here: Empty sirens
Move the 4 audio files to the following folder in your mod: ".../Audio/Fx/sirens/"
In case you have new sirens, move them to the same folder.

==========================

CHANGING THE SCRIPTS:

Go to your ".../Scripts/Game/Command" folder in your mod and open Sirens.script with WordPad or Notepad.
You have to do two things for each vehicle you want to give sirens.

1. Find a line like this:

[i]const char CAR_01[] = "mod:Prototypes/Vehicles/Fire Department/rw.e4p";[/i]

This line has a const char value which has been connected to the path of a vehicle prototype.
Make sure these prototypes have the commands VCmdSiren and VCmdAutoSirenOff as explained earlier.

2. The const char value (CAR_01) is linked to another part of the script.
Scroll down and find a part like this:

[b][i]if (StrCompare(v.GetPrototypeFileName(), CAR_01) == 0)[/i]
[i]soundID = Audio::PlaySample3D("mod:Audio/FX/sirens/Emsiren01.wav", CarPos, true);[/i][/b]


As you can see the const char value can be found in this part of the script too.
The second line contains the path to a sound file, the siren.

Meaning of this code:

If the caller (car which executes command) has the prototype connected to the const char value it will play the audio file from the second line.

If you want to do this with more vehicle, simply copy the codes in part 1 and 2 and change them.
Make sure each vehicle has another const char code, like CAR_02, CAR_03 etc...

Image 03: Edit the script

Thanks to Bass-Ti for the original scripts.

For questions about this tutorial:
Emergency 4: Siren scripts

==========================
Tutorial made by Hoppah
March 2008

Powered by Tutorials 1.5.2 © 2024, by Michael McCune