Jump to content
Alex03

Scripts Help

Recommended Posts

Hey

Me and Matte are having some problems with these sosi scripts. Could annyone pleas take a look on them and see if they could find whats wrong?

http://pastebin.com/g0YuwQBz

and

**************************************************************************************************
// #Version 1.0# Command-Script ****
// ****
// Includes: SonderSignalScript - deutsch ****
// ****
// 01.0 = Hauptkommando VCmdSiren ****
// 01.1 = Updatekommando DUMMYUpdatePos ****
// 01.2 = Deaktivierungskommando DUMMYDisableSiren ****
// 01.3 = Erkennungskommando DUMMYFindPath ****
// 01.4 = Erkennungskommando DUMMYHasSiren ****
// ****
//**************************************************************************************************
// Sponsored by: DDR-MODIFIKATION | www.ddr-mod.de | Errors? Contact: Bass-ti@ddr-mod.de ****
//**************************************************************************************************

const char IMG[] = "SoSi_Icons";

const char EACTION_FINDPATH[] = "EActionFindPath";
const char EACTION_EXTINGUISH[] = "EActionExtinguish";

const char DUMMY_HASSIREN[] = "DUMMYHasSiren";
const char DUMMY_UPDATEPOS[] = "DUMMYUpdatePos";
const char DUMMY_FINDPATH[] = "DUMMYFindPath";

const char NAME_DUMMYOBJECT[] = "HelpingObjekt_Isgard";

// FireFighter
const char PROTO_FF_01[] = "mod:Prototypes/Vehicles/Fire Department/CHIDEA_SK_HLF.e4p";
const char PROTO_FF_02[] = "mod:Prototypes/Vehicles/Fire Department/dekonp.e4p";
const char PROTO_FF_03[] = "mod:Prototypes/Vehicles/Fire Department/CHIDEA_SCANIA_HLF1.e4p";
const char PROTO_FF_04[] = "mod:Prototypes/Vehicles/Fire Department/hagglunds.e4p";
const char PROTO_FF_05[] = "mod:Prototypes/Vehicles/Metz/Naila.e4p";
const char PROTO_FF_07[] = "mod:Prototypes/Vehicles/Metz/Hof.e4p";
const char PROTO_FF_08[] = "mod:Prototypes/Vehicles/Metz/Helmbrechts.e4p";
const char PROTO_FF_09[] = "mod:Prototypes/Vehicles/Metz/gtf.e4p";

// Police
const char PROTO_PD_30[] = "mod:Prototypes/Vehicles/Police/stw.e4p";
const char PROTO_PD_31[] = "mod:Prototypes/Vehicles/Police/mtw.e4p";
const char PROTO_PD_32[] = "mod:Prototypes/Vehicles/Police/test.e4p";
const char PROTO_PD_33[] = "mod:Prototypes/Vehicles/Police/civilvan01.e4p";
const char PROTO_PD_34[] = "mod:Prototypes/Vehicles/Mobile Wache/mowa.e4p";

// Ambulance
const char PROTO_A_60[] = "mod:Prototypes/Vehicles/Ambulance/rtw.e4p";
const char PROTO_A_61[] = "mod:Prototypes/Vehicles/Ambulance/rhf.e4p";
const char PROTO_A_62[] = "mod:Prototypes/Vehicles/Ambulance/KTWCrafter.e4p";
const char PROTO_A_63[] = "mod:Prototypes/Vehicles/Ambulance/RTWCrafter.e4p";

// TEC
const char PROTO_TEC_90[] = "mod:Prototypes/Vehicles/TEC/fgri.e4p";
const char PROTO_TEC_91[] = "mod:Prototypes/Vehicles/TEC/asf.e4p";

int DummyGroup = 20;

// 01.0
object VCmdSiren : CommandScript
{
// COMMENTARY:
// Das Commando welches Eure Einheiten benötigt heißt "VCmdSiren",
// VCmd steht für VehicleboundCommandoscript
VCmdSiren()
{
// COMMENTARY:
// Das Bild für Euer neues SoSi-Commando heißt "SoSi_Icons",
// der Name kann oben im globalen Bereich geändert werden.
SetIcon(IMG);
SetCursor(IMG);
SetRestrictions(RESTRICT_SELFEXECUTE);
SetPossibleCallers(ACTOR_VEHICLE);
}

bool CheckPossible(GameObject *Caller)
{
if (!Caller->IsValid())
return false;

return true;
}

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
if (!Target->IsValid() || Target->GetID() != Caller->GetID())
return false;

return true;
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Vehicle v(Caller);
if (!v.HasCommand(DUMMY_HASSIREN))
{
// COMMENTARY:
// Ist zum Zeitpunkt des Commandos kein Blaulicht aktiv,
// wird es automatisch aktiviert.
if (!v.IsBlueLightEnabled())
{
v.EnableBlueLights(true);
}

int soundID;
Vector CarPos = v.GetPosition();

// COMMENTARY:
// Hier kommen die StrCompares aller Eurer Fahrzeuge hin und die dazugehörigen SoundFiles.
if (StrCompare(v.GetPrototypeFileName(), PROTO_FF_01) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/EMsiren05.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_FF_02) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/EMsiren05.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_FF_03) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/EMsiren05.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_FF_04) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/EMsiren05.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_FF_05) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/EMsiren05.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_FF_07) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/EMsiren05.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_FF_09) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/EMsiren05.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_PD_30) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Emsiren01.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_PD_31) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Emsiren01.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_PD_32) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Emsiren02.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_PD_33) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Emsiren02.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_PD_34) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Emsiren02.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_A_61) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Emsiren03.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_A_62) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Emsiren03.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_A_63) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Emsiren03.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_TEC_90) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Emsiren04.wav", CarPos, true);
}

if (StrCompare(v.GetPrototypeFileName(), PROTO_TEC_91) == 0)
{
soundID = Audio::PlaySample3D("mod:Audio/FX/Emsiren04.wav", CarPos, true);
}

int CarID = v.GetID();

// COMMENTARY:
// Das aus dem alten Script bekannte Hilfsobjekt wird immernoch benötigt,
// um zu checken, ob das Fahrzeug die EActionFindPath hat (wenn es direkt aus der Wache beordert wurde)
GameObject mDummy = Game::CreateObject("mod:Prototypes/Objects/Misc/empty.e4p", NAME_DUMMYOBJECT);
mDummy.Hide();
mDummy.SetUserData(CarID);
mDummy.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_UPDATEPOS, &v, CarID, false);
v.AssignCommand(DUMMY_HASSIREN);

// COMMENTARY:
// Hier wird der Sound gebunden in einer ID auf das Fahrzeug übergeben.
// Außerdem wird diese ID in die UserData des Fahrzeugs geschrieben um es später wiederzuerkennen.
v.SetUserData(soundID);
v.AttachSound(soundID);

return;
}

if (v.HasCommand(DUMMY_HASSIREN))
{
if (childID == 1)
{
v.EnableBlueLights(false);
}

// COMMENTARY:
// RückAktion, der Sound wird gestoppt und vom Fahrzeug getrennt.
int CarID = v.GetID();
int ref = v.GetUserData();
v.UnattachSound(ref);
Audio::StopSample(ref);

// COMMENTARY:
// Außerdem wird das DummyObjekt gelöscht.
int mSirTest;
GameObjectList list = Game::GetGameObjects(NAME_DUMMYOBJECT);
for(int i=0; i

Any help is appreciated.

mvh

Alex and Matte

Link to comment
Share on other sites

With the script from paste bin, they should be like this



if (StrCompare(v.GetPrototypeFileName(), PROTO_f1) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_f2) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_f3) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_f4) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_f5) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_f6) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_f7) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_f8) == 0 ||
StrCompare(v.GetPrototypeFileName(), PROTO_f9) == 0)

You only put the bracket on the last one in that section and instead you use ||

The rest need to be fixed up aswell.

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...