Jump to content
Bernt

Script error

Recommended Posts

Hello,

I added 2 lines to my script, but now i recieve a error.

I hope some one can help me.

1293260624-970.png

This i added:

  
// BMA-Einsätze initialisieren
ofz->PushActionExecuteCommand(ACTION_APPEND,"bmaeinsatz_initialisierung",ofz,0,false);

My script:

//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Brabant Mod - Freeplay - Script v1.1 //
// ************************************* //
// //
// 1.0| FPPlaceUnits //
// | | //
// | |- Units worden geplaatst, comment lijnen (//) is verdeeld in blokken. //
// | | Elk van hen kan worden verwijderd zonder dat het script fouten geeft. //
// | | //
// | '- Die met een Ster (*) markeert is moet aangepast worden. //
// | Meerdere sterren betekent dat er meedere dingen moeten worden aangepast //
// | Daarbij geld: 2 steren 2 aanpassingen, enzo verder. //
// | //
// 2.0| FPMSG_1 //
// | //
// 2.1| FPMSG_2 //
// | //
// 3.0| OnLoad //
// //
// _____________________ //
// Skript frei fuer alle //
//////////////////////////////////////////////////////////////////////////////////////////////////////////


// 1.0
void FPPlaceUnits()
{

// Grüne Schatten deaktivieren
System::SetEnv("e4_doocclusion", 0);

Camera::SetMinCamZ(500.0f);
Camera::SetMaxCamZ(9000.0f);

Camera::SetMinCamPitch(20.0f);
Camera::SetMaxCamPitch(90.0f);

// Parameter fuer Fahrzeugerzeugung definieren
Vector parkplatz;
Actor parkobj;
float rot[9];
float childRot[9];
Vehicle v;
ActorList l1;
GameObjectList vl;
GameObject *o1;
GameObjectList ol1;
GameObject *o2;
GameObjectList ol2;
GameObject *ofz;
GameObjectList lfz;
ActorList fzl;

//Mission::PlayHint("Meldkamer word ingericht");

ol1=Game::GetGameObjects("LeitstellePerson");
if(ol1.GetNumObjects() > 0)
{
//Brandweer1
o1 = *ol1.GetObject(0);
Game::AddToGroup(o1,0);
Person p1(o1);
p1.AssignCommand("Alarmering_Neven");
p1.AssignCommand("Alarmering_Centrum");
p1.AssignCommand("Alarmering_PostN");
p1.AssignCommand("Alarmering_PostC");

//Brandweer2
o1 = *ol1.GetObject(1);
Game::AddToGroup(o1,1);
Person p2(o1);
p2.AssignCommand("PCmdFPAlarmTS3P");
p2.AssignCommand("PCmdFPAlarmAL2P");
p2.AssignCommand("PCmdFPAlarmSWP");
p2.AssignCommand("PCmdFPAlarmTWP");
p2.AssignCommand("PCmdFPAlarmDB2P");

//Ambulance
o1 = *ol1.GetObject(2);
Game::AddToGroup(o1,2);
Person p3(o1);
p3.AssignCommand("Alarmambu");
p3.AssignCommand("PCmdFPAlarmFR");
p3.AssignCommand("PCmdFPAlarmMMTA");
p3.AssignCommand("PCmdFPAlarmOVDG");
p3.AssignCommand("PCmdFPAlarmLH");

//Politie
o1 = *ol1.GetObject(3);
Game::AddToGroup(o1,3);
Person p4(o1);
p4.AssignCommand("PCmdFPAlarmTouran");
p4.AssignCommand("PCmdFPAlarmTouran2");
p4.AssignCommand("PCmdFPAlarmTouran3");
p4.AssignCommand("PCmdFPAlarmGolf");
p4.AssignCommand("PCmdFPAlarmGolf2");
p4.AssignCommand("PCmdFPAlarmGolf3");
p4.AssignCommand("PCmdFPAlarmT5");
p4.AssignCommand("PCmdFPAlarmOVDP");

//Overige
o1 = *ol1.GetObject(4);
Game::AddToGroup(o1,4);
Person p5(o1);
p5.AssignCommand("PCmdFPAlarmEOC");
p5.AssignCommand("PCmdFPAlarmANWB");

//Buiten de map
o1 = *ol1.GetObject(5);
Game::AddToGroup(o1,5);
Person p6(o1);
p6.AssignCommand("PCmdFPAlarmMEA");
p6.AssignCommand("PCmdFPAlarmVOA");
p6.AssignCommand("PCmdFPAlarmATA");
p6.AssignCommand("PCmdFPAlarmHV2P");
p6.AssignCommand("PCmdFPAlarmA1");
p6.AssignCommand("PCmdFPAlarmA2");
p6.AssignCommand("PCmdFPAlarmA3");
p6.AssignCommand("PCmdFPAlarmA4");

}
else
{
Mission::PlayHint("Kan de centralisten niet vinden!");
}


ol2 = Game::GetGameObjects("Meldkamer");
if(ol2.GetNumObjects() > 0)
{
o2 = *ol2.GetObject(0);
OpenHouse oh(o2);
oh.ShowCeiling(false,false,false);
}
else
{
Mission::PlayHint("Kan de meldkamer niet vinden!");
}

// BMA-Einsätze initialisieren
ofz->PushActionExecuteCommand(ACTION_APPEND,"bmaeinsatz_initialisierung",ofz,0,false);


//Mission::PlayHint("Hulpverleningsvoertuigen worden op de map gezet!");

/////// Touran ///////////////////////////////////////////////////////////////////////////////////////////////////////////

vl=Game::GetGameObjects("Touran"); // *
if(vl.GetNumObjects() > 0)
{
Mission::PlayHint("STW1 befindet sich bereits auf der Karte!"); // *
}
else
{
l1=Game::GetActors("Touran"); // *
if(l1.GetNumActors() > 0)
{
parkobj = *l1.GetActor(0);
parkplatz = parkobj.GetPosition();
v = Game::CreateVehicle("mod:Prototypes/Vehicles/03Politie/touran_weiss.e4p","Touran"); // **
v.SetSpeed(14.0f); // *
v.SetMaxPassengers(2); // *
v.SetMaxTransports(2); // *
v.EnableBlueLights(false);
v.EnableBreakLights(false);
v.EnableSpecialLights(false);
v.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
Math::EulerToMatrix(0.f, 0.f, 0.f, childRot); // *
Math::MultiplyMatrices(childRot, rot);
v.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);
v.SetPosition(parkplatz);
v.SetCommandable(false);
v.RemoveCommand("DUMMYHasAutoSiren");
v.RemoveCommand("GoHome");
v.AssignCommand("DUMMYFPIsFreeForAlert");
v.AssignCommand("VCmdFPSetFreeForAlert");
v.AssignCommand("DUMMYFPIsInBase");
v.AssignCommand("VCmdFPGoHome");
v.SetParking(true); // test
}
else
{
Mission::PlayHint("Kann Parkplatz fuer STW1 nicht finden!"); // *
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
};

// 2.0
void FPMSG_1()
{
//Mission::PlayHint("Kaart word ingericht");
};

// 2.1
void FPMSG_2()
{
Camera::SetCameraToLocation("Meldkamer");

Mission::PlayHint("Kaart ingericht! Michael en Bernt wensen u veel plezier met het spelen van de mod!!");
};

// 3.0
bool OnLoad()
{
FPMSG_1();
FPPlaceUnits();
FPMSG_2();
Process::Kill();
return true;
}

Happy x-mas

Link to comment
Share on other sites

line 127 is nothing,....(see pic)

127.jpg

So you would have an error in the lines above it.

Most times i have something like that(wrong error line)

means i forgot to close an object, or function.

So my guess would be there.

Link to comment
Share on other sites

that is what i thought first to..

but if you start the script at line 1:


void FPPlaceUnits()
{

you would get a if/else to that part.


if(ol1.GetNumObjects() > 0)
{

So the line 127 is not done with the script.

All lines are part of the first part.

and closes here:


}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
};

(line 187)

Although on the bottom line you could be correct


bool OnLoad()
{
FPMSG_1();
FPPlaceUnits();
FPMSG_2();
Process::Kill();
return true;
}

there the ; behind the } is indeed missing.

All other "void" are closed by }; but the bool is not.

But that is not till line 211.

and the script reports the error much sooner.

Link to comment
Share on other sites

When i add the ; after the } on line 211.

The script gives me a new error line: 142.

This is the empty line after: 141

ofz->PushActionExecuteCommand(ACTION_APPEND,"bmaeinsatz_initialisierung",ofz,0,false);

So that is the line you added, where something is wrong with it.

Dunno what, the line looks ok to me,..are you sure that this:

"bmaeinsatz_initialisierung"

Is correctly spelled and all?

Link to comment
Share on other sites

Yes it correctly,

Some one say this: i don't understand it:

[nl]

vrij simpel.

Je roept een object aan genaamt ofz, zonder in het script aan te geven wat de ofz dan wel moet zijn.

In andere worden je roept iets op wat niet bestaat, hierdoor geeft hij de fout.

je kunt nou eenmaal niet iets oproepen wat niet bestaat.

je zult de "ofz" een definitie moeten geven. en dan zou lijn 141 wel goed moeten zijn.

[en]

easy,

You forgot to define the "ofz" tag, that way the script is calling out for something that does not exist.

therefor making the script cause an error(you can't call what does not exist)

You would need to define the "ofz" and then the line should work

Wijziging:

He sosi.script doet dit bijvoorbeeld door:


const char PROTO_deconp[] = "mod:Prototypes/Vehicles/Fire Department/deconp.e4p";

Weet niet of jij de zelfde soort kan gebruiken...

Maar je moet wel iets "creëren" om het later op te roepen.

Edit:

The sosi.script uses defines like this:


const char PROTO_deconp[] = "mod:Prototypes/Vehicles/Fire Department/deconp.e4p";

Not sure you could use a line like that.

But you need to "create" the object before you call it.

Link to comment
Share on other sites

[NL] Foutje gevonden, je moet het GameObject nog verder defineren dan alleen: "GameObject *ofz;"

[EN] Error fount, the define was not enough to leave it as: "GameObject *ofz;"

code ziet er nu zo uit:

code looks like this now:


//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Brabant Mod - Freeplay - Script v1.1 //
// ************************************* //
// //
// 1.0| FPPlaceUnits //
// | | //
// | |- Units worden geplaatst, comment lijnen (//) is verdeeld in blokken. //
// | | Elk van hen kan worden verwijderd zonder dat het script fouten geeft. //
// | | //
// | '- Die met een Ster (*) markeert is moet aangepast worden. //
// | Meerdere sterren betekent dat er meedere dingen moeten worden aangepast //
// | Daarbij geld: 2 steren 2 aanpassingen, enzo verder. //
// | //
// 2.0| FPMSG_1 //
// | //
// 2.1| FPMSG_2 //
// | //
// 3.0| OnLoad //
// //
// _____________________ //
// Skript frei fuer alle //
// Bug fix by : Tian318 //
//////////////////////////////////////////////////////////////////////////////////////////////////////////


// 1.0
void FPPlaceUnits()
{

// Grüne Schatten deaktivieren
System::SetEnv("e4_doocclusion", 0);

Camera::SetMinCamZ(500.0f);
Camera::SetMaxCamZ(9000.0f);

Camera::SetMinCamPitch(20.0f);
Camera::SetMaxCamPitch(90.0f);

// Parameter fuer Fahrzeugerzeugung definieren
Vector parkplatz;
Actor parkobj;
float rot[9];
float childRot[9];
Vehicle v;
ActorList l1;
GameObjectList vl;
GameObject *o1;
GameObjectList ol1;
GameObject *o2;
GameObjectList ol2;
GameObject *ofz;
GameObjectList lfz;
ActorList fzl;


//Mission::PlayHint("Meldkamer word ingericht");

ol1=Game::GetGameObjects("LeitstellePerson");
if(ol1.GetNumObjects() > 0)
{
//Brandweer1
o1 = *ol1.GetObject(0);
Game::AddToGroup(o1,0);
Person p1(o1);
p1.AssignCommand("Alarmering_Neven");
p1.AssignCommand("Alarmering_Centrum");
p1.AssignCommand("Alarmering_PostN");
p1.AssignCommand("Alarmering_PostC");

//Brandweer2
o1 = *ol1.GetObject(1);
Game::AddToGroup(o1,1);
Person p2(o1);
p2.AssignCommand("PCmdFPAlarmTS3P");
p2.AssignCommand("PCmdFPAlarmAL2P");
p2.AssignCommand("PCmdFPAlarmSWP");
p2.AssignCommand("PCmdFPAlarmTWP");
p2.AssignCommand("PCmdFPAlarmDB2P");

//Ambulance
o1 = *ol1.GetObject(2);
Game::AddToGroup(o1,2);
Person p3(o1);
p3.AssignCommand("Alarmambu");
p3.AssignCommand("PCmdFPAlarmFR");
p3.AssignCommand("PCmdFPAlarmMMTA");
p3.AssignCommand("PCmdFPAlarmOVDG");
p3.AssignCommand("PCmdFPAlarmLH");

//Politie
o1 = *ol1.GetObject(3);
Game::AddToGroup(o1,3);
Person p4(o1);
p4.AssignCommand("PCmdFPAlarmTouran");
p4.AssignCommand("PCmdFPAlarmTouran2");
p4.AssignCommand("PCmdFPAlarmTouran3");
p4.AssignCommand("PCmdFPAlarmGolf");
p4.AssignCommand("PCmdFPAlarmGolf2");
p4.AssignCommand("PCmdFPAlarmGolf3");
p4.AssignCommand("PCmdFPAlarmT5");
p4.AssignCommand("PCmdFPAlarmOVDP");

//Overige
o1 = *ol1.GetObject(4);
Game::AddToGroup(o1,4);
Person p5(o1);
p5.AssignCommand("PCmdFPAlarmEOC");
p5.AssignCommand("PCmdFPAlarmANWB");

//Buiten de map
o1 = *ol1.GetObject(5);
Game::AddToGroup(o1,5);
Person p6(o1);
p6.AssignCommand("PCmdFPAlarmMEA");
p6.AssignCommand("PCmdFPAlarmVOA");
p6.AssignCommand("PCmdFPAlarmATA");
p6.AssignCommand("PCmdFPAlarmHV2P");
p6.AssignCommand("PCmdFPAlarmA1");
p6.AssignCommand("PCmdFPAlarmA2");
p6.AssignCommand("PCmdFPAlarmA3");
p6.AssignCommand("PCmdFPAlarmA4");

/////////////////////////////////////////////////////
// OFZ GameObject aanmaken voor de aanroeping later//
/////////////////////////////////////////////////////
ofz = *ol1.GetObject(6);
Game::AddToGroup(ofz,6);
Person p7(o1);
p7.AssignCommand("Alarmering_Neven");
p7.AssignCommand("Alarmering_Centrum");
p7.AssignCommand("Alarmering_PostN");
p7.AssignCommand("Alarmering_PostC");

}
else
{
Mission::PlayHint("Kan de centralisten niet vinden!");
}


ol2 = Game::GetGameObjects("Meldkamer");
if(ol2.GetNumObjects() > 0)
{
o2 = *ol2.GetObject(0);
OpenHouse oh(o2);
oh.ShowCeiling(false,false,false);
}
else
{
Mission::PlayHint("Kan de meldkamer niet vinden!");
}

// BMA-Einsätze initialisieren
ofz->PushActionExecuteCommand(ACTION_APPEND,"bmaeinsatz_initialisierung",ofz,0,false);


//Mission::PlayHint("Hulpverleningsvoertuigen worden op de map gezet!");

/////// Touran ///////////////////////////////////////////////////////////////////////////////////////////////////////////

vl=Game::GetGameObjects("Touran"); // *
if(vl.GetNumObjects() > 0)
{
Mission::PlayHint("STW1 befindet sich bereits auf der Karte!"); // *
}
else
{
l1=Game::GetActors("Touran"); // *
if(l1.GetNumActors() > 0)
{
parkobj = *l1.GetActor(0);
parkplatz = parkobj.GetPosition();
v = Game::CreateVehicle("mod:Prototypes/Vehicles/03Politie/touran_weiss.e4p","Touran"); // **
v.SetSpeed(14.0f); // *
v.SetMaxPassengers(2); // *
v.SetMaxTransports(2); // *
v.EnableBlueLights(false);
v.EnableBreakLights(false);
v.EnableSpecialLights(false);
v.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
Math::EulerToMatrix(0.f, 0.f, 0.f, childRot); // *
Math::MultiplyMatrices(childRot, rot);
v.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);
v.SetPosition(parkplatz);
v.SetCommandable(false);
v.RemoveCommand("DUMMYHasAutoSiren");
v.RemoveCommand("GoHome");
v.AssignCommand("DUMMYFPIsFreeForAlert");
v.AssignCommand("VCmdFPSetFreeForAlert");
v.AssignCommand("DUMMYFPIsInBase");
v.AssignCommand("VCmdFPGoHome");
v.SetParking(true); // test
}
else
{
Mission::PlayHint("Kann Parkplatz fuer STW1 nicht finden!"); // *
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
};

// 2.0
void FPMSG_1()
{
//Mission::PlayHint("Kaart word ingericht");
};

// 2.1
void FPMSG_2()
{
Camera::SetCameraToLocation("Meldkamer");

Mission::PlayHint("Kaart ingericht! Michael en Bernt wensen u veel plezier met het spelen van de mod!!");
};

// 3.0
bool OnLoad()
{
FPMSG_1();
FPPlaceUnits();
FPMSG_2();
Process::Kill();
return true;
};

ik voegde toe:

i added:


ofz = *ol1.GetObject(6);
Game::AddToGroup(ofz,6);
Person p7(o1);
p7.AssignCommand("Alarmering_Neven");
p7.AssignCommand("Alarmering_Centrum");
p7.AssignCommand("Alarmering_PostN");
p7.AssignCommand("Alarmering_PostC");

[NL]

De P moet uniek zijn. ik koos hier voor 10 omdat ik wist dat die vrij was.

De P nummers bij de commands moeten met het P nummer van Person overeen komen.

[EN]

The P must be unique. i picked 10 here, because i knew for sure that the number was free.

The P number for the commands must be the same as the P number of the person.

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