Jump to content
EM4life

Help with car's siren

Recommended Posts

I was trying to add a siren for a car I DL'd, the LAPD car converted from EM3 into EM4 to be more specific. I added the two parts into the LASiren script and used the correct names and everything. But when I turn on the siren it gives me an eror message. It says that the last part, the part that has the vehicles names listed in each section for the siren that that car's been asigned, is too long. idk why but I've attached it to the post so you can look over it. The car i'm trying to get to work is called "cv_umpc_burgundy" for your referance. I believe I've done everything right but, obvously not... If anyone finds the problem(s), let me know. Thanks for you time.

This was the process of finding this problem...in emoticons!... :grinsevil: to... :huh: then... :machkaputt: and finally... :flagwave:

Link to comment
Share on other sites

The scripts not here. ;) But dont need it. The problem is sort of self explanatory in a way, all be it vague to. The section of the script that says PROTO_LAPD,PROTO_LASD,PROTOT_CHP,etc is to long. I dont know exactly what the limit is, and not sure if its C++ related or related to the games engine(im going to guess its the engine). I had the same problem on my end. Basically you have to many units using the same siren. To fix this split it up. Say you have 12 units using sirens 1 and 2. Split that up so you have 2 sets of code of 6 units using those sirens rather then 12. If your lost I will explain it better tomorrow.

Link to comment
Share on other sites

Ya, I get it but I want to actually know how to do it. Whenever I wan't to make my LA Mod better, I always screw it up. But it always get's fixed in the end.:happy:

Try doing it your self, post the script if it causes an error, and I will take a look at it. If memory serves me right theres a tutorial about it. The tutorial itself refers to the sosi.script i think, but just ignore the script name and follow the example set by the tutorial as its the same principal.

Link to comment
Share on other sites

Well, I guess I'd mean the NY Mod you've got. Anyways, like in my prevoius post, all of the textures are in the wrong spots. They're not the conventional texture scheme. So it messes up the texture. Am I missing anything to make this show correctly?

At a glance it looks right. You said something about it being to long? Then split it up:


else if (StrCompare(v.GetPrototypeFileName(), PROTO_MOTORCYCLE) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD2) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD3) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD_ST) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD_K9) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAAP) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPP) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_UMPC_GREEN) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_UMPC_BURGUNDY) == 0
{
int random = Math::rand()%2;
if (random == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren05.wav", CarPos, true);
} else
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren06.wav", CarPos, true);
}
}
else if (StrCompare(v.GetPrototypeFileName(), PROTO_CV_UMPC) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_CHP) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_CHP2) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LASD) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CHARGER_LAPD) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CHARGER_CHP) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CAMARO_CHP) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_BPAT_DODGE_CHARGER) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_BPAT_TAHOE) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_ATF_CV) == 0)
{
int random = Math::rand()%2;
if (random == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren05.wav", CarPos, true);
} else
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren06.wav", CarPos, true);
}
}

Link to comment
Share on other sites

Guest Francis

Replace

StrCompare(v.GetPrototypeFileName(), PROTO_CV_UMPC_BURGUNDY) == 0

with

StrCompare(v.GetPrototypeFileName(), PROTO_CV_UMPC_BURGUNDY) == 0)

Also, there is no limit to conditions in C++. Use this code:

                        else if (StrCompare(v.GetPrototypeFileName(), PROTO_MOTORCYCLE) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD2) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD3) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD_ST) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD_K9) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAAP) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPP) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_UMPC_GREEN) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_UMPC_BURGUNDY) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_UMPC) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_CHP) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_CHP2) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CV_LASD) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CHARGER_LAPD) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CHARGER_CHP) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_CAMARO_CHP) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_BPAT_DODGE_CHARGER) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_BPAT_TAHOE) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_ATF_CV) == 0)
{
int random = Math::rand()%2;
if (random == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren05.wav", CarPos, true);
} else
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren06.wav", CarPos, true);
}
}

Link to comment
Share on other sites

Also, there is no limit to conditions in C++. Use this code:

I didnt think so, but i think there is in EM4. I had an error like his and as soon as i broke it down into 2 conditions, it worked fine. Plus you posted the same thing that he had in his original script that generated the error(from the looks of it). :P

EM4, pastebin the entire new script using the code I gave you.

http://pastebin.com/

Sorry to lazy to put a new script together.

Link to comment
Share on other sites

Guest Francis

Look at my code carefully, the only reason his failed is because he forgot to close the "else if" statement with a brace.

AKA:

StrCompare(v.GetPrototypeFileName(), PROTO_ATF_CV) == 0

instead of

StrCompare(v.GetPrototypeFileName(), PROTO_ATF_CV) == 0)

Link to comment
Share on other sites

Look at my code carefully, the only reason his failed is because he forgot to close the "else if" statement with a brace.

AKA:

StrCompare(v.GetPrototypeFileName(), PROTO_ATF_CV) == 0

instead of

StrCompare(v.GetPrototypeFileName(), PROTO_ATF_CV) == 0)

Actually, I just checked all three scripts he posted and havent seen a missing bracket on any of them in regards to the ATF_CV or was that just an example?

So, which one? Francis or Xplorer?

I edited the script but see "btw" below.

BTW: I'm using the NY Submod so my original LA Mod is in another folder as a backup for later.

Id use mine because I cant see what Francis is talking about unless it was just an example, but I wouldnt use these scripts for the NY Submod unless you have edited the NY submod to include all these units.

Link to comment
Share on other sites

I tried to edit my LA Mod to use the NY Submod but it failed. I ended up backing up my original, deleting the mod, reinstalling the mod and patch, then putting in the NY Submod.

P.S. The lights in that mod suck. I edited them heavily, as I always do to my mods, and it looks ok.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...