Jump to content
timmiej93

Error: Symbol <NAME> is not defined in current scope

Recommended Posts

Hey guys,

 

I'm getting above error quite frequently, and I'm just not getting it. 

To me it sounds like the game has trouble assigning a value to the Symbol, because it hasn't been defined.

 

In this case, the error is referring about this part of code:

			if(l1.GetNumActors() > 0)				Vector FirstPoint = l1.GetActor(0)->GetPosition();			if(l2.GetNumActors() > 0)				Vector TurnTo = l2.GetActor(0)->GetPosition();			Audio::PlaySample3D(SND_TOSTATION, Caller->GetPosition());			v.PushActionMove(ACTION_NEWLIST, FirstPoint);			v.PushActionTurnTo(ACTION_APPEND, TurnTo);

The error refers to the line with "v.PushActionMove" bit in it, and says "Symbol FirstPoint is not defined".

 

I really can't understand why, because I found the same bit of code in another script that comes with the mod, and it works fine there. 

 

Could anyone explain it to me?

 

Tim

Link to comment
Share on other sites

Most likely reason is because of this part:

if(l1.GetNumActors() > 0)	Vector FirstPoint = l1.GetActor(0)->GetPosition();

If the if() statement returns false, the FirstPoint variable never gets initialized.

 

Explanation:

say l1.GetNumActors() > 0 is false (because l1.GetNumActors() is 0)

 

then the

Vector FirstPoint = l1.GetActor(0)->GetPosition();

line gets skipped over completely and is never defined.

 

You either need to declare and set a default value for FirstPoint outside of the if() statement (somewhere before it), or you need to account for the situation that l1.GetNumActors() == 0 and bail out before it reaches the v.PushActionMove line.

Link to comment
Share on other sites

Lets debug this a little more. Let's first confirm my suspicion of the cause of the error:

 

Replace:

if(l1.GetNumActors() > 0)	Vector FirstPoint = l1.GetActor(0)->GetPosition();if(l2.GetNumActors() > 0)	Vector TurnTo = l2.GetActor(0)->GetPosition();Audio::PlaySample3D(SND_TOSTATION, Caller->GetPosition());v.PushActionMove(ACTION_NEWLIST, FirstPoint);v.PushActionTurnTo(ACTION_APPEND, TurnTo);

With:

//Debug L1f(l1.GetNumActors() > 0)	Game::PlayHint("L1 is good!");else if(l1.GetNumActors() == 0)        Game::PlayHint("L1 is equal to 0");else        Game::PlayHint("Impossible...this is worse than dividing by 0 (L1)");//Debug L2if(l2.GetNumActors() > 0)	Game::PlayHint("L2 is good!");else if(l2.GetNumActors() == 0)        Game::PlayHint("L2 is equal to 0");else        Game::PlayHint("Impossible...this is worse than dividing by 0 (L2)");/*Audio::PlaySample3D(SND_TOSTATION, Caller->GetPosition());v.PushActionMove(ACTION_NEWLIST, FirstPoint);v.PushActionTurnTo(ACTION_APPEND, TurnTo);*/

Tell me what the game ticker says...or any additional error.

Link to comment
Share on other sites

Well, for some reason, as you expected, L1 equals 0.

 

Here's the log bit:

?(_LAToPoliceStationa83eb): Error: Function PlayHint("L1 is equal to 0") is not defined in current scope ?(_LAToPoliceStationa83eb):  FILE:mod:/scripts/game/command/LAToPoliceStation.scripta83eb LINE:277?(_LAToPoliceStationa83eb): Possible candidates are...?(_LAToPoliceStationa83eb): filename       line:size busy function type and name  ?(_LAToPoliceStationa83eb): ?(_LAToPoliceStationa83eb): !!!Dictionary position rewound... ?(_LAToPoliceStationa83eb): !!!Error recovered!!!
Link to comment
Share on other sites

I made a mistake...It's supposed to be Mission::PlayHint()

//Debug L1f(l1.GetNumActors() > 0)	Mission::PlayHint("L1 is good!");else if(l1.GetNumActors() == 0)        Mission::PlayHint("L1 is equal to 0");else        Mission::PlayHint("Impossible...this is worse than dividing by 0 (L1)");//Debug L2if(l2.GetNumActors() > 0)	Mission::PlayHint("L2 is good!");else if(l2.GetNumActors() == 0)        Mission::PlayHint("L2 is equal to 0");else        Mission::PlayHint("Impossible...this is worse than dividing by 0 (L2)");/*Audio::PlaySample3D(SND_TOSTATION, Caller->GetPosition());v.PushActionMove(ACTION_NEWLIST, FirstPoint);v.PushActionTurnTo(ACTION_APPEND, TurnTo);*/

Anyway...now that my theory is confirmed lets try the obvious. Ensure that your VOs are named properly in the editor and that their names are correct in your script. The error is most likely that your VO is named wrong. that's why it's == 0

Link to comment
Share on other sites

Anyway...now that my theory is confirmed lets try the obvious. Ensure that your VOs are named properly in the editor and that their names are correct in your script. The error is most likely that your VO is named wrong. that's why it's == 0
 

Shouldn't that limit the error to 1 parking space? Unles it's a structural error though.

I'll have a look.

Link to comment
Share on other sites

I've got another script spawning the vehicles that are assigned to the parking spaces in the correct position. I'm testing it using the VAN, but I believe all other cars give the same result. Let me test

 

------

 

So when using the VAN or SUV, I get the error saying L1 is 0, L2 is good.

While using the CRUISER04 though, I get an error saying: Error: Symbol l97 is not defined in current scope

 

PS. I slightly modified the script, since all L parameters (gameobjectlists) were l99.

New link: Click

Link to comment
Share on other sites

Lets see if it's even making it into VAN specific portion:

 

Find:

else if(StrCompare(v.GetPrototypeFileName(), OBJ_VAN) == 0)			{				GameObjectList l99;				Game::CollectObstaclesOnVirtualObject(VO_BACK03, l99, ACTOR_VEHICLE);				if(l99.GetNumObjects() > 0)				{					v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);					return;				} else				{					ActorList l1 = Game::GetActors(VO_TT_BACK03);					ActorList l2 = Game::GetActors(VO_BACK03);				}			}

Replace with:

else if(StrCompare(v.GetPrototypeFileName(), OBJ_VAN) == 0)			{				GameObjectList l99;				Game::CollectObstaclesOnVirtualObject(VO_BACK03, l99, ACTOR_VEHICLE);				if(l99.GetNumObjects() > 0)				{					v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);					return;				} else				{					ActorList l1 = Game::GetActors(VO_TT_BACK03);					ActorList l2 = Game::GetActors(VO_BACK03);                                         Mission::PlayHint("I MADE IT");				}			}

using the van, send it to station. If the Hint plays...its making it and i've hit another dead end. If it doesn't play, it's because the program never reaches that portion of the code

Link to comment
Share on other sites

I have two more things up my sleeve.
 
Looking at the script before I started adding a bunch of stuff, I just noticed line 249 is missing a semi-colon. Try adding it and see if that fixes things.

GameObjectlist l99;

 

 

Otherwise replace starting at "} else if(StrCompare(v.GetPrototypeFileName(), OBJ_VAN) == 0)" until the end of the childID == 1 statement.

            } else if(StrCompare(v.GetPrototypeFileName(), OBJ_VAN) == 0)            {                GameObjectList l99;                Game::CollectObstaclesOnVirtualObject(VO_BACK03, l99, ACTOR_VEHICLE);                if(l99.GetNumObjects() > 0)                {                    v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);                    return;                } else                {                    ActorList aList1 = Game::GetActors(VO_TT_BACK03);                    ActorList aList2 = Game::GetActors(VO_BACK03);                }            }            else if(StrCompare(v.GetPrototypeFileName(), OBJ_SUV) == 0)            {                    GameObjectList l99;                Game::CollectObstaclesOnVirtualObject(VO_BACK04, l99, ACTOR_VEHICLE);                if(l99.GetNumObjects() > 0)                {                    v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);                    return;                } else                {                    ActorList aList1 = Game::GetActors(VO_TT_BACK04);                    ActorList aList2 = Game::GetActors(VO_BACK04);                }            }            else if(StrCompare(v.GetPrototypeFileName(), OBJ_CRUISER04) == 0)            {                GameObjectlist l99                Game::CollectObstaclesOnVirtualObject(VO_BACK01, l99, ACTOR_VEHICLE);                if(l99.GetNumObjects() > 0)                {                    GameObjectlist l99;                    Game::CollectObstaclesOnVirtualObject(VO_BACK02, l99, ACTOR_VEHICLE);                    if(l99.GetNumObjects() > 0)                    {                        v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);                        return;                    }                    else                    {                        ActorList aList1 = Game::GetActors(VO_TT_BACK02);                        ActorList aList2 = Game::GetActors(VO_BACK02);                    }                }                else                {                    ActorList aList1 = Game::GetActors(VO_TT_BACK01);                    ActorList aList2 = Game::GetActors(VO_BACK01);                }                } else            {                Mission::PlayHint(HINT_NOTVALID);                return;            }                        if(aList1.GetNumActors() > 0)                Vector TurnTo = aList1.GetActor(0)->GetPosition();                        if(aList2.GetNumActors() > 0)                Vector Park = aList2.GetActor(0)->GetPosition();                        Audio::PlaySample3D(SND_TOSTATION, Caller->GetPosition());            v.PushActionMove(ACTION_NEWLIST, Park);            v.PushActionTurnTo(ACTION_APPEND, TurnTo);            v.PushActionWait(ACTION_APPEND, 1.0f);        }

The only other thing i can think of is that the l1 variable is getting overwritten at some point (since its being used elsewhere). This will prevent that.

Link to comment
Share on other sites

Hmm, weird.

I found the one you noticed, and i noticed one missing at 245 too. Added those.

For the VAN and SUV, still the same. L1 == 0, L2 is good.

 

Although, for the CRUISER04 I get a different error now. It states:

 

?(_LAToPoliceStationa8343): Error: Symbol GameObjectlistl97 is not defined in current scope 
?(_LAToPoliceStationa8343):  FILE:mod:/scripts/game/command/LAToPoliceStation.scripta8343 LINE:245
 
Now is this getting weirder with every edit or what?
Link to comment
Share on other sites

I'm not quite sure I get it right now. You are looking in the script that uses L99 till L96, and not the one with 4 times L99 right?

 

Should it look like this then?

			else if(StrCompare(v.GetPrototypeFileName(), OBJ_CRUISER04) == 0)			{				GameObjectlist l97				Game::CollectObstaclesOnVirtualObject(VO_BACK01, l97, ACTOR_VEHICLE);				if(l97.GetNumObjects() > 0)				{					Game::CollectObstaclesOnVirtualObject(VO_BACK02, l99, ACTOR_VEHICLE);					if(l99.GetNumObjects() > 0)					{						v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);						return;					}					else					{						ActorList l1 = Game::GetActors(VO_TT_BACK02);						ActorList l2 = Game::GetActors(VO_BACK02);					}				}				else				{					ActorList l1 = Game::GetActors(VO_TT_BACK01);					ActorList l2 = Game::GetActors(VO_BACK01);				}				} else			{				Mission::PlayHint(HINT_NOTVALID);				return;			}
Link to comment
Share on other sites

I was talking about lines 243-266

Yours will not work because in the post above, l99 is not initialized, only l97 is.

                        else if(StrCompare(v.GetPrototypeFileName(), OBJ_CRUISER04) == 0)			{				GameObjectlist l99;				Game::CollectObstaclesOnVirtualObject(VO_BACK01, l99, ACTOR_VEHICLE);				if(l99.GetNumObjects() > 0)				{					Game::CollectObstaclesOnVirtualObject(VO_BACK02, l99, ACTOR_VEHICLE); //Reuse l99, no need for a new variable					if(l99.GetNumObjects() > 0)					{						v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);						return;					}					else					{						ActorList l1 = Game::GetActors(VO_TT_BACK02);						ActorList l2 = Game::GetActors(VO_BACK02);					}				}				else				{					ActorList l1 = Game::GetActors(VO_TT_BACK01);					ActorList l2 = Game::GetActors(VO_BACK01);				}				} else			{				Mission::PlayHint(HINT_NOTVALID);				return;			}
Link to comment
Share on other sites

Aha. After correcting everything, the cruiser no longer gives an error, but gives the same result as the VAN and SUV, saying L1 == 0, L2 is good.

 

Edit: Something I just noticed, when I get the L1==0 and L2 is good, the vehicles don't move, but the biggest thing: The bluelights stay on. This must have a hint in it somewhere, but I can't figure out how.

 

Edit2: Never mind that dumb notice, that's just a scripting error on my behalf  :laugh:

 

Another thing I found:

The to policestation script has a command to set Priority to 110 when transporting criminals, and set it to 0 when not. This should't have anything to do with it, but it raised my suspicion. 

 

 

 

------------------

 

Allright, so I've made some changes to the script to test some things, like changing l1 and l2 to l11 and l12, since l1 was already in use.

 

Here's the new version: Click, or below.

 

//******************************************************************************************
// #Version 1.5#
//
// Includes: To police station command.
//
// - VcmdToPoliceStation
//
// Script by Hoppah
//
// Usage of this script in other mods is NOT allowed without permission of Hoppah
//
//******************************************************************************************

const char CMD_SIREN[] = "VcmdSiren";
const char CMD_AUTOSIREN_OFF[] = "VcmdAutoSirenOff";
const char CMD_WARNINGLIGHTS_OFF[] = "VcmdWarningLightsOff";
const char CMD_WARNINGLIGHTS_ON[] = "VcmdWarningLightsOn";
const char CMD_FLOODLIGHTS_OFF[] = "VcmdFloodLightsOff";
const char CMD_FLOODLIGHTS_ON[] = "VcmdFloodLightsOn";
const char CMD_GOHOME[] = "GoHome";
const char CMD_TOPOLICESTATION[] = "VcmdToPoliceStation";
const char CMD_PATROL[] = "VcmdPatrol";
const char CMD_STANDBY_ON[] = "VcmdStandbyOn";
const char CMD_STANDBY_OFF[] = "VcmdStandbyOff";

const char OBJ_VAN[] = "mod:Prototypes/Vehicles/03 LA Police/lasd_van.e4p";
const char OBJ_SUV[] = "mod:Prototypes/Vehicles/03 LA Police/suv_lapd.e4p";
const char OBJ_CRUISER01[] = "mod:Prototypes/Vehicles/03 LA Police/cv_lapd.e4p";
const char OBJ_CRUISER04[] = "mod:Prototypes/Vehicles/03 LA Police/dodge_charger_chp.e4p";

const char DUMMY_DISABLE[] = "DummyDisableSiren";
const char DUMMY_HASSIREN[] = "DummyHasSiren";
const char DUMMY_GOHOME[] = "DummyGoHome";
const char DUMMY_PATROL[] = "DummyPatrol";

const char OBJ_HELIPAD[] = "policestation_helipad";

const char VO_ENTRY[] = "policestation_entry";
const char VO_ENTRY_HELIPAD[] = "policestation_entry2";
const char VO_TURNTO[] = "policestation_turnto";
const char VO_FRONT01[] = "policestation_park01";
const char VO_FRONT02[] = "policestation_park02";
const char VO_FRONT03[] = "policestation_park03";
const char VO_BACK01[] = "policestation_park04";
const char VO_BACK02[] = "policestation_park05";
const char VO_BACK03[] = "policestation_park06";
const char VO_BACK04[] = "policestation_park07";
const char VO_DONUT01[] = "policestation_donut01";
const char VO_DONUT02[] = "policestation_donut02";
const char VO_HELI[] = "policestation_heli";
const char VO_SPAWN[] = "policestation_spawn";

const char VO_SPAWN_FRONT[] = "policestation_spawn";
const char VO_SPAWN_BACK[] = "spawn_police1";
const char VO_SPAWN_DONUT[] = "policestation_spawn2";

const char VO_MOVETO_FRONT[] = "policestation_moveto1";
const char VO_MOVETO_BACK[] = "spawn_police1r";
const char VO_MOVETO_DONUT[] = "policestation_moveto2";

const char VO_SQUAD01[] = "police_squad01";
const char VO_SQUAD02[] = "police_squad02";
const char VO_SQUAD03[] = "police_squad03";

const char VO_BACK01TT[] = "policestation_back04tt";
const char VO_BACK02TT[] = "policestation_back05tt";
const char VO_BACK03TT[] = "policestation_back06tt";
const char VO_BACK04TT[] = "policestation_back07tt";
const char VO_DONUT01TT[] = "policestation_donut01tt";
const char VO_DONUT02TT[] = "policestation_donut02tt";

const char SND_TOSTATION[] = "mod:Audio/FX/radio/1019.wav";

const char HINT_HELICOPTER[] = "Another helicopter is blocking the helipad! The helicopter will return to base!";
const char HINT_NOTVALID[] = "This vehicle doesn't belong in the police station!";
const char HINT_NOSPACE[] = "No space at the police station, vehicle starts a patrol.";

const char PROTO_CV_LAPD[] = "mod:Prototypes/Vehicles/03 LA Police/cv_lapd.e4p";

int DummyGroup = 32;

object VcmdToPoliceStation : CommandScript
{
VcmdToPoliceStation()
{
SetCursor("topolicestation");
SetIcon("topolicestation");
SetGroupID(DummyGroup);
SetGroupLeader(true);
SetRestrictions(RESTRICT_SELFEXECUTE);
}

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

if (!Game::IsFreeplay() && !Game::IsMultiplayer())
return false;

Vehicle v(Caller);
if (v.IsCollidingWithVirtualObject(VO_HELI) || v.IsCollidingWithVirtualObject(VO_BACK01) || v.IsCollidingWithVirtualObject(VO_BACK02) || v.IsCollidingWithVirtualObject(VO_BACK03) || v.IsCollidingWithVirtualObject(VO_BACK04))
return false;

ActorList l1 = Game::GetActors(VO_FRONT01);
if (l1.GetNumActors() == 0)
return false;

return true;
}

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

Vehicle v(Caller);
SetPriority(0);
if (v.GetNumTransported() > 0)
SetPriority(110);

return true;
}

void PushActions(GameObject *Caller, Actor *Target, int ChildID)
{
Vehicle v(Caller);
if(ChildID == 0)
{
if (v.IsBlueLightEnabled())
v.EnableBlueLights(false);
if (v.HasCommand("DummyFollow"))
v.RemoveCommand("DummyFollow");
if (v.HasCommand(CMD_STANDBY_OFF))
{
v.RemoveCommand(CMD_STANDBY_OFF);
v.AssignCommand(CMD_STANDBY_ON);
}
if (v.HasCommand(CMD_WARNINGLIGHTS_OFF))
{
v.EnableBlinker(BLT_NONE);
v.RemoveCommand(CMD_WARNINGLIGHTS_OFF);
v.AssignCommand(CMD_WARNINGLIGHTS_ON);
}
if (v.HasCommand(CMD_FLOODLIGHTS_OFF))
{
v.EnableSpecialLights(false);
v.RemoveCommand(CMD_FLOODLIGHTS_OFF);
v.AssignCommand(CMD_FLOODLIGHTS_ON);
}
if (v.HasObjectPath(NULL))
Game::ExecuteCommand(DUMMY_PATROL, &v, &v);
if (v.HasCommand(DUMMY_HASSIREN) && v.HasCommand(CMD_AUTOSIREN_OFF))
Game::ExecuteCommand(DUMMY_DISABLE, &v, &v);

if (v.GetVehicleType() != VT_POLICE_PHC && v.GetPrototypeFileName() != OBJ_VAN && v.GetPrototypeFileName() != OBJ_SUV && v.GetPrototypeFileName() != OBJ_CRUISER04 && v.GetPrototypeFileName() != OBJ_CRUISER01)
{

bool ParkinglotFound = false;
ActorList l1;
if (!ParkinglotFound)
{
GameObjectList l2;
Game::CollectObstaclesOnVirtualObject(VO_FRONT01, l2, ACTOR_VEHICLE);
if(l2.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_FRONT01);
ParkinglotFound = true;
}
}
if (!ParkinglotFound)
{
GameObjectList l3;
Game::CollectObstaclesOnVirtualObject(VO_FRONT02, l3, ACTOR_VEHICLE);
if(l3.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_FRONT02);
ParkinglotFound = true;
}
}
if (!ParkinglotFound)
{
GameObjectList l4;
Game::CollectObstaclesOnVirtualObject(VO_FRONT03, l4, ACTOR_VEHICLE);
if(l4.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_FRONT03);
ParkinglotFound = true;
}
}
if (!ParkinglotFound)
{
v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);
return;
}
else
{
Vector PD = l1.GetActor(0)->GetPosition();
Vector PD2 = l1.GetActor(0)->GetPosition() + Vector(280,-280,0);

ActorList l8 = Game::GetActors(VO_TURNTO);
Vector TurnTo = l8.GetActor(0)->GetPosition();

Game::FindFreePosition(Caller, PD);
Audio::PlaySample3D(SND_TOSTATION, v.GetPosition());

v.PushActionMove(ACTION_NEWLIST, PD);
v.PushActionTurnTo(ACTION_APPEND, TurnTo);
v.PushActionWait(ACTION_APPEND, 1.5f);
v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 2, false);
PersonList transports = v.GetTransports();
if (transports.GetNumPersons() > 0)
v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);
}
} else if(StrCompare(v.GetPrototypeFileName(), OBJ_VAN) == 0)
{
GameObjectList l99;
Game::CollectObstaclesOnVirtualObject(VO_BACK03, l99, ACTOR_VEHICLE);
if(l99.GetNumObjects() > 0)
{
v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);
return;
} else
{
ActorList l11 = Game::GetActors(VO_BACK03TT);
ActorList l12 = Game::GetActors(VO_BACK03);
}
}
else if(StrCompare(v.GetPrototypeFileName(), OBJ_SUV) == 0)
{
GameObjectList l99;
Game::CollectObstaclesOnVirtualObject(VO_BACK04, l99, ACTOR_VEHICLE);
if(l99.GetNumObjects() > 0)
{
v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);
return;
} else
{
ActorList l11 = Game::GetActors(VO_BACK04TT);
ActorList l12 = Game::GetActors(VO_BACK04);
}
}
else if(StrCompare(v.GetPrototypeFileName(), OBJ_CRUISER01) == 0)
{
GameObjectList l99;
Game::CollectObstaclesOnVirtualObject(VO_DONUT01, l99, ACTOR_VEHICLE);
if(l99.GetNumObjects() > 0)
{
Game::CollectObstaclesOnVirtualObject(VO_DONUT02, l99, ACTOR_VEHICLE);
if(l99.GetNumObjects() > 0)
{
v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);
return;
}
else
{
ActorList l11 = Game::GetActors(VO_DONUT02TT);
ActorList l12 = Game::GetActors(VO_DONUT02);
}
}
else
{
ActorList l11 = Game::GetActors(VO_DONUT01TT);
ActorList l12 = Game::GetActors(VO_DONUT01);
}
}
else if(StrCompare(v.GetPrototypeFileName(), OBJ_CRUISER04) == 0)
{
GameObjectList l99;
Game::CollectObstaclesOnVirtualObject(VO_BACK01, l99, ACTOR_VEHICLE);
if(l99.GetNumObjects() > 0)
{
Game::CollectObstaclesOnVirtualObject(VO_BACK02, l99, ACTOR_VEHICLE);
if(l99.GetNumObjects() > 0)
{
v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false);
return;
}
else
{
ActorList l11 = Game::GetActors(VO_BACK02TT);
ActorList l12 = Game::GetActors(VO_BACK02);
}
}
else
{
ActorList l11 = Game::GetActors(VO_BACK01TT);
ActorList l12 = Game::GetActors(VO_BACK01);
}
} else
{
Mission::PlayHint(HINT_NOTVALID);
return;
}


if(l11.GetNumActors() > 0)
{
Vector TurnTo = l11.GetActor(0)->GetPosition();
Mission::PlayHint("L11 is good!");
} else
{
Mission::PlayHint("L11 is bad!");
return;
}
if(l12.GetNumActors() > 0)
{
Vector Park = l12.GetActor(0)->GetPosition();
Mission::PlayHint("L12 is good!");
} else
{
Mission::PlayHint("L2 is bad!");
return;
}

Audio::PlaySample3D(SND_TOSTATION, Caller->GetPosition());
v.PushActionMove(ACTION_NEWLIST, TurnTo);
v.PushActionTurnTo(ACTION_APPEND, Park);
v.PushActionWait(ACTION_APPEND, 1.0f);
v.PushActionMove(ACTION_APPEND, Park);
v.PushActionTurnTo(ACTION_APPEND, TurnTo);
Mission::PlayHint("Going to park bitches!")
}

if(ChildID == 1)
{
if (v.GetVehicleType() != VT_POLICE_PHC)
{
ActorList l1 = Game::GetActors(VO_SPAWN_FRONT);
if (l1.GetNumActors() > 0)
Vector TargetPos = l1.GetActor(0)->GetPosition();
PersonList transports = v.GetTransports();
for(int i = 0; i < transports.GetNumPersons(); i++)
{
transports.GetPerson(i)->PushActionLeaveCar(ACTION_NEWLIST, Caller);
if(transports.GetPerson(i)->GetRole() == ROLE_GANGSTER)
{
transports.GetPerson(i)->SetRole(ROLE_CIVILIAN);
transports.GetPerson(i)->SetBehaviour(BEHAVIOUR_CIVILIAN_NORMAL);
}
transports.GetPerson(i)->PushActionWait(ACTION_APPEND, 0.5f);
transports.GetPerson(i)->PushActionMove(ACTION_APPEND, TargetPos, true);
transports.GetPerson(i)->PushActionDeleteOwner(ACTION_APPEND);
}
} else
{
ActorList l1 = Game::GetActors(VO_ENTRY_HELIPAD);
if (l1.GetNumActors() > 0)
Vector TargetPos = l1.GetActor(0)->GetPosition();
PersonList transports = v.GetTransports();
for(int i = 0; i < transports.GetNumPersons(); i++)
{
transports.GetPerson(i)->PushActionLeaveCar(ACTION_NEWLIST, Caller);
if(transports.GetPerson(i)->GetRole() == ROLE_GANGSTER)
{
transports.GetPerson(i)->SetRole(ROLE_CIVILIAN);
transports.GetPerson(i)->SetBehaviour(BEHAVIOUR_CIVILIAN_NORMAL);
}
transports.GetPerson(i)->PushActionWait(ACTION_APPEND, 0.5f);
transports.GetPerson(i)->PushActionMove(ACTION_APPEND, TargetPos, true);
transports.GetPerson(i)->PushActionDeleteOwner(ACTION_APPEND);
}
}
}
if(ChildID == 2)
{
Vehicle v(Caller);
v.EnableBlinker(BLT_NONE);
bool ToPoliceStation = false;
if (v.IsCollidingWithVirtualObject(VO_FRONT01))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_FRONT02))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_FRONT03))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_BACK01))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_BACK02))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_BACK03))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_BACK04))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_DONUT01))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_DONUT02))
return;
else
ToPoliceStation = true;

if(ToPoliceStation)
v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_TOPOLICESTATION, Caller, 0, false);
}
}
};

 

 

Of course, with new scripting, there's new errors:

?(_LAToPoliceStationa8392): Error: Symbol l11 is not defined in current scope ?(_LAToPoliceStationa8392):  FILE:mod:/scripts/game/command/LAToPoliceStation.scripta8392 LINE:297?(_LAToPoliceStationa8392): Error: Failed to evaluate l11.GetNumActors()?(_LAToPoliceStationa8392): Possible candidates are...?(_LAToPoliceStationa8392): filename       line:size busy function type and name  

I don't get why symbol l11 wouldn't be defined at that point.. any idea's?

 

 

 

---------------------

 

 

Breaktrough!

 

The CRUISER01 just parked, in its own parking space, saying l1 and l2 are good! Going to check what's going on!

 

Edit:

 

Well, I'm really stumped.

CRUISER01 works fine, every single time, parks like a charm, but the VAN, SUV and CRUISER04 just don't work. They still give an L11 error.

The only difference between those point that I can think of, is that the turnto vo's of the CRUISER01 are outside of the "squad" VO that is used in the PSStart script, and the turnto vo's of the other cars are inside their own squad vo.

Could this be of any influence? I can barely imagine that it would be, but it's all I can think of.

 

Edit2:

So I just ran a test.. That's the problem. The turnto VO's inside the other VO.

Not very logical, since the logic states 'more than 0'. Two is more then zero right?

But at least I know how to fix it now. Thank god.

 

----------------------

 

Alright, some final questions so I can finish this:

 

v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);
 
Above statement should direct to the command ToPoliceStation, ChildID==1 right?
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...