Jump to content
soulbody

Script Error

Recommended Posts

?(_LACenterCamera8c534): Error: Unexpected EOF G__exec_statement()

?(_LACenterCamera8c534): FILE:mod:/scripts/game/command/LACenterCamera.script8c534 LINE:75

?(_LACenterCamera8c534): Advice: You may need to use +P or -p option

?Could not load script mod:/scripts/game/command/LACenterCamera.script

?(_LACenterCamera8c534): Error: Symbol this_definitely_is_an_evil_workaround_1505_6713 is not defined in current scope

?(_LACenterCamera8c534): FILE: LINE:0

?(_LACenterCamera8c534): !!!Dictionary position rewound...

?(_LACenterCamera8c534): !!!Error recovered!!!

i just made a script and get this message in the log file.

the script is:

//******************************************************************************************
// #Version 1.0#
//
// Includes: Command to center the camera on a moving unit
//
// - VcmdCenterCamera
//
// Script by Soulbody
//
// Usage of this script in other mods is NOT allowed without permission of Soulbody
//
//******************************************************************************************

object VcmdCenterCamera : CommandScript
(
VcmdCenterCamera()
{
SetIcon("scoutmine");
SetCursor("scoutmine");
SetValidTargets(ACTOR_VEHICLE);
SetRestructions(RESTRICT_NOTDESTROYED);
SetPriority(998);
SetSelfClickActivation(true);
SetHighlightingEnabled(false);
}

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

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

Vehicle v(Caller);
if (v.IsCollidingWithVirtualObject(VO_SQUAD01))
return false;

return true;
}

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

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

return true;
}

void PushActions(GameObject *Caller, Actor *Target, int ChildID)
{
Vector Pos = Caller->GetPosition();

Vehicle v(Caller);
void SetCameraToLocation(Const char *Target);
void FollowTarget(const GameObject *Target, const Vector &Pos, bool useCurrentCamPos = false);
void LookAtTarget(const GameObject *Target, bool smoothTransition = false, float zoomspeed = 0.0f, float zoomDuration = 1.0f);
}
};

the script supposed to center the camera at any vehicle, so when you hit the icon it automaticly follows that unit...

Link to comment
Share on other sites

void SetCameraToLocation(Const char *Target);
void FollowTarget(const GameObject *Target, const Vector &Pos, bool useCurrentCamPos = false);
void LookAtTarget(const GameObject *Target, bool smoothTransition = false, float zoomspeed = 0.0f, float zoomDuration = 1.0f);

This doesn't work that way. You need to define target and pos first. Look at other scripts to find examples.

GameObject t(Target);
Vector pos;
Camera::SetCameraToLocation(&t);
Camera::FollowTarget(&t, pos, false);
Camera::LookAtTarget(&t, false, 0.0f, 1.0f);

Try this instead, but I don't know if it works correctly. You apparently used the wikipage and just copied the codes. That's not how scripting works! The codes on that site do not show you how to use the codes, but what each part means. You have to compare your script with other scripts to see if you did it the right way. In this example I used lamod03.script where I did about the same thing.

Link to comment
Share on other sites

void SetCameraToLocation(Const char *Target);
void FollowTarget(const GameObject *Target, const Vector &Pos, bool useCurrentCamPos = false);
void LookAtTarget(const GameObject *Target, bool smoothTransition = false, float zoomspeed = 0.0f, float zoomDuration = 1.0f);

This doesn't work that way. You need to define target and pos first. Look at other scripts to find examples.

GameObject t(Target);
Vector pos;
Camera::SetCameraToLocation(&t);
Camera::FollowTarget(&t, pos, false);
Camera::LookAtTarget(&t, false, 0.0f, 1.0f);

Try this instead, but I don't know if it works correctly. You apparently used the wikipage and just copied the codes. That's not how scripting works! The codes on that site do not show you how to use the codes, but what each part means. You have to compare your script with other scripts to see if you did it the right way. In this example I used lamod03.script where I did about the same thing.

thanks for codes this part is atleast what the game doesn't make crash, i tried it as far i fixed crashes from other message either.

the new script is posted in the spoiler. there is only one thing i couldn't fix the command seems to want to select a vehicle and not automaticly operate on the caller. i compare the script with scripts as:

VcmdToPoliceStation, Sirens, VcmdPatrol but couldn't find anything which would make the command get on the caller. also with the help of the wikipage i couldn't find anything usefull

New Script

//******************************************************************************************
// #Version 1.0#
//
// Includes: Command to center the camera on a moving unit
//
// - VcmdCenterCamera
//
// Script by Soulbody
//
// Usage of this script in other mods is NOT allowed without permission of Soulbody
//
//******************************************************************************************

const char VO_SQUAD01[] = "SQUAD01";

object VcmdCenterCamera : CommandScript
{
VcmdCenterCamera()
{
SetIcon("scoutmine");
SetCursor("scoutmine");
SetPriority(998);
SetSelfClickActivation(true);
SetRestrictions(RESTRICT_SELFEXECUTE);
SetValidTargets(ACTOR_VEHICLE);
}

bool CheckPossible(GameObject *Caller)
{
if (!Game::IsFreeplay() && !Game::IsMultiplayer())
return false;

Vehicle v(Caller);
if (v.IsCollidingWithVirtualObject(VO_SQUAD01))
return false;

return true;
}

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

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

return true;
}

void PushActions(GameObject *Caller, Actor *Target, int ChildID)
{
Vehicle v(Caller);
GameObject t(Target);
Vector Pos = t.GetPosition();
Camera::SetCameraToLocation(&t);
Camera::LookAtTarget(&t, false, 0.0f, 1.0f);
Camera::FollowTarget(&t, pos, false);
}
};

Link to comment
Share on other sites

Get rid of this line in the code:

Vector pos;

And You Need to move and edit this line:

Vector Pos = Caller->GetPosition();

This code should work:



//******************************************************************************************
// #Version 1.0#
//
// Includes: Command to center the camera on a moving unit
//
// - VcmdCenterCamera
//
// Script by Soulbody
//
// Usage of this script in other mods is NOT allowed without permission of Soulbody
//
//******************************************************************************************

const char VO_SQUAD01[] = "SQUAD01";

object VcmdCenterCamera : CommandScript
{
VcmdCenterCamera()
{
SetIcon("scoutmine");
SetCursor("scoutmine");
SetPriority(998);
SetSelfClickActivation(true);
SetRestrictions(RESTRICT_SELFEXECUTE);
SetValidTargets(ACTOR_VEHICLE);
}

bool CheckPossible(GameObject *Caller)
{
if (!Game::IsFreeplay() && !Game::IsMultiplayer())
return false;

Vehicle v(Caller);
if (v.IsCollidingWithVirtualObject(VO_SQUAD01))
return false;

return true;
}

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

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

return true;
}

void PushActions(GameObject *Caller, Actor *Target, int ChildID)
{
Vehicle v(Caller);
GameObject t(Target);
Vector Pos = t.GetPosition();
Camera::SetCameraToLocation(&t);
Camera::LookAtTarget(&t, false, 0.0f, 1.0f);
Camera::FollowTarget(&t, Pos, false);
}
};

That should work, but I would be careful with this script, I can see it having issues when you use it as a command script.

Test it and let me know what happens.

Regards

James

Link to comment
Share on other sites

still the same, i have to select a target but i can't nothing is called able to follow with the camera, everything got the disabled icon while the command is operate able...

i will try to make a video if possible

Additional info 1:

I was testing again some parts adding and remove but the still didn't work

i tried either this " Vehicle v(caller) = GameObject t(target);"

this got the same result i still got to select a target, even the unit where i try it on (LAPD Motercycle) lights up but when i click the unit to select it as target the command close down as like the click on the cross when you want to stop operating the a command...

Link to comment
Share on other sites

Can you describe to me what you want the script to do?

The script should let the camera center on a moving unit and follow until he stops.

That last part will u do myself later to obtain some experiance but atleast i need to let script follow the unit which operate the command.

Link to comment
Share on other sites

Is the command button to center the camera on the vehicle you wish it to center on?

Yes, when you hit the icon it should automaticly center the camera on the unit you got selected and follow it...

like this:

''i got the dodge charger selected, hit the icon for the center camera and the camera center and follow my dodge charger''

Link to comment
Share on other sites

 

//******************************************************************************************
// #Version 1.0#
//
// Includes: Command to center the camera on a moving unit
//
// - VcmdCenterCamera
//
// Script by Soulbody
//
// Usage of this script in other mods is NOT allowed without permission of Soulbody
//
//******************************************************************************************

const char VO_SQUAD01[] = "SQUAD01";

object VcmdCenterCamera : CommandScript
{
VcmdCenterCamera()
{
SetIcon("scoutmine");
SetCursor("scoutmine");
SetPriority(998);
SetSelfClickActivation(true);
SetRestrictions(RESTRICT_SELFEXECUTE);
SetValidTargets(ACTOR_VEHICLE);
}

bool CheckPossible(GameObject *Caller)
{
if (!Game::IsFreeplay() && !Game::IsMultiplayer())
return false;

Vehicle v(Caller);
if (v.IsCollidingWithVirtualObject(VO_SQUAD01))
return false;

return true;
}

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

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

return true;
}

void PushActions(GameObject *Caller, Actor *Target, int ChildID)
{
Vehicle v(Caller);
Vector Pos = v.GetPosition();
Camera::SetCameraToLocation(&v);
Camera::LookAtTarget(&v, false, 0.0f, 1.0f);
Camera::FollowTarget(&v, Pos, false);
}
};




Try that

Link to comment
Share on other sites

Guest Francis

Try that one first.

//******************************************************************************************
// #Version 1.0#
//
// Includes: Command to center the camera on a moving unit
//
// - VcmdCenterCamera
//
// Script by Soulbody
//
// Usage of this script in other mods is NOT allowed without permission of Soulbody
//
//******************************************************************************************

const char VO_SQUAD01[] = "SQUAD01";

object VcmdCenterCamera : CommandScript
{
VcmdCenterCamera()
{
SetIcon("scoutmine");
SetCursor("scoutmine");
SetPriority(998);
SetSelfClickActivation(true);
SetRestrictions(RESTRICT_SELFEXECUTE);
SetValidTargets(ACTOR_VEHICLE);
}

bool CheckPossible(GameObject *Caller)
{
if (!Game::IsFreeplay() && !Game::IsMultiplayer())
return false;

Vehicle v(Caller);
if (v.IsCollidingWithVirtualObject(VO_SQUAD01))
return false;

return true;
}

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

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

return true;
}

void PushActions(GameObject *Caller, Actor *Target, int ChildID)
{
Vector Pos = Caller->GetPosition();
Camera::FollowTarget(&Caller, Pos); // No need to LookAtTarget since the camera will be auto-centered on the caller, (last parameter = false)
}
};

Link to comment
Share on other sites

thanks but got the same result, at least i want to say something need to be changed either:


Vehicle v(Caller);
if (v.IsCollidingWithVirtualObject(VO_SQUAD01))
return false;

(don't get mad, i deleted this in previous version either)

this code was meaned to prevent the usage of code while the vehicle was standing into the firestation but according to

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

i noticed (even in the begin) that this will only allow it when the vehicle is in the virtual object.

even when i translate is this code a blocker:

		SetRestrictions(RESTRICT_SELFEXECUTE);

strange enough i have seen several codes that use self execute, like the deploy swat command.

i tried several changes but nothing seems to work. or the command get disabled (when i removed the hole target section) or i need to select a target, strange enough the Caller vehicle is the only vehicle that lights up and when you move the mouse on the vehicle you get the scoutmine icon (as requested) but when you click then instead of following the vehicle the command get destroyed is it would when you hit the cross...WTF.gif

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