Jump to content
Guest Dakati

Script Crash

Recommended Posts

Hi.

I made a script for the LA Mod, so i can manualy control some Trafficlights.

This is the script

const char CMD_PUTRED[] = "OcmdPutRed";
const char CMD_PUTAUTO[] = "OcmdPutAuto";

object OcmdPutRed : CommandScript
{
OcmdPutRed()
{
SetIcon("lighton");
SetCursor("lighton");
SetRestrictions(RESTRICT_SELFEXECUTE);
SetPriority(50);
}

bool CheckGroupVisibility(GameObject *Caller)
{
if(!Caller->IsValid() || Caller->GetType() != ACTOR_OBJECT)
return false;
Object o(Caller);
return !o.IsLightOn();
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Object o(Caller);
o.TrafficLightType(TLT_RED);
o.AssignCommand(CMD_PUTAUTO);
o.RemoveCommand(CMD_PUTRED);
}
};

object PutAuto : CommandScript
{
OcmdPutAuto()
{
SetIcon("lightoff");
SetCursor("lightoff");
SetRestrictions(RESTRICT_SELFEXECUTE);
SetPriority(49);
}

bool CheckGroupVisibility(GameObject *Caller)
{
if(!Caller->IsValid() || Caller->GetType() != ACTOR_OBJECT)
return false;


return true;
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Object o(Caller);
o.TrafficLightType(TLT_NONE);
o.AssignCommand(CMD_PUTRED);
o.RemoveCommand(CMD_PUTAUTO);
}
};

If I load the LA Mod, I have a CTD.

Thats only happening with the LA Mod, and if i have that script in the commands folder.

Any sugestions?

Btw, I think you already saw, im a noob scripter. Nvm

Link to comment
Share on other sites

Object Command.

I First wanted to add the command to the trafficlight itself, but that dont work.

Does anybody know, how to put a Trafficlight at Red from an other Object, eg. a Switch box

Link to comment
Share on other sites

I have changed the script a bit, but it still dont work:

const char CMD_PUTRED[] = "OcmdPutRed";
const char CMD_PUTAUTO[] = "OcmdPutAuto";

object OcmdPutRed : CommandScript
{
OcmdPutRed()
{
SetIcon("lighton");
SetCursor("lighton");
SetRestrictions(RESTRICT_SELFEXECUTE);
SetPriority(50);
}

bool CheckGroupVisibility(GameObject *Caller)
{
if(!Caller->IsValid() || Caller->GetType() != ACTOR_OBJECT)
{
return false;
} else {
return true;
}
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Object o(Caller);
o.TrafficLightType(TLT_RED);
o.AssignCommand(CMD_PUTAUTO);
o.RemoveCommand(CMD_PUTRED);
}
};

object PutAuto : CommandScript
{
OcmdPutAuto()
{
SetIcon("lightoff");
SetCursor("lightoff");
SetRestrictions(RESTRICT_SELFEXECUTE);
SetPriority(49);
}

bool CheckGroupVisibility(GameObject *Caller)
{
if(!Caller->IsValid() || Caller->GetType() != ACTOR_OBJECT)
{
return false;
} else {
return true;
}
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Object o(Caller);
o.TrafficLightType(TLT_NONE);
o.AssignCommand(CMD_PUTRED);
o.RemoveCommand(CMD_PUTAUTO);
}
};

The strange is, id ont get a script error!

Link to comment
Share on other sites

I have changed the script a bit, but it still dont work:

const char CMD_PUTRED[] = "OcmdPutRed";
const char CMD_PUTAUTO[] = "OcmdPutAuto";

object OcmdPutRed : CommandScript
{
OcmdPutRed()
{
SetIcon("lighton");
SetCursor("lighton");
SetRestrictions(RESTRICT_SELFEXECUTE);
SetPriority(50);
}

bool CheckGroupVisibility(GameObject *Caller)
{
if(!Caller->IsValid() || Caller->GetType() != ACTOR_OBJECT)
{
return false;
} else {
return true;
}
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Object o(Caller);
o.TrafficLightType(TLT_RED);
o.AssignCommand(CMD_PUTAUTO);
o.RemoveCommand(CMD_PUTRED);
}
};

object PutAuto : CommandScript
{
OcmdPutAuto()
{
SetIcon("lightoff");
SetCursor("lightoff");
SetRestrictions(RESTRICT_SELFEXECUTE);
SetPriority(49);
}

bool CheckGroupVisibility(GameObject *Caller)
{
if(!Caller->IsValid() || Caller->GetType() != ACTOR_OBJECT)
{
return false;
} else {
return true;
}
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Object o(Caller);
o.TrafficLightType(TLT_NONE);
o.AssignCommand(CMD_PUTRED);
o.RemoveCommand(CMD_PUTAUTO);
}
};

The strange is, id ont get a script error!

Could it be another file in the game is messed up? It looks like a cool script, but, i'm not sure so i'm not going to try it. lol. Hope you can fix it ^^

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