Hallo zusammen,
ich hab mal paar fragen zum VCmdInstallCrane von BFE was müsste man da alles ändern das man es für eine DLK benutzen könnte ls für ein Kran.
MfG
Code
//
// InstallCrane (Auf-/Abbau RW-Kran)
//
object VCmdInstallCrane : CommandScript
{
VCmdInstallCrane()
{
SetIcon("Install");
SetCursor("Install");
SetRestrictions(RESTRICT_SELFEXECUTE);
}
bool CheckPossible(GameObject *Caller)
{
Vehicle v(Caller);
if (v.GetNumPassengers() == 0) return false;
if (Caller->GetType() != ACTOR_VEHICLE || !Caller->HasCommand("ALARM_DUMMY")) return false;
return true;
}
bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
return true;
}
void PushActions(GameObject *Caller, Actor *Target, int childID)
{
float r[9]; Vehicle v(Caller);
switch (childID)
{
case 0:
if (!v.IsSpecialLightEnabled()) v.PushActionExecuteCommand(ACTION_APPEND, "VCmdWarning", &v, 0, false);
if (v.HasCommand("DummyHasSiren")) v.PushActionExecuteCommand(ACTION_APPEND, "VcmdSiren", &v, 0, false);
v.SetCommandable(false);
v.PushActionSwitchAnim(ACTION_NEWLIST, "aufbau");
v.PushActionWait(ACTION_APPEND, 8.0f);
v.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
v.PushActionExecuteCommand(ACTION_APPEND, "VCmdInstallCrane", Target, 1, false);
break;
case 1:
Vehicle k = Game::CreateVehicle("mod:Prototypes/Vehicles/__FF_Wolfshain/04_36_02.e4p", v.GetName());
k.SetMaxPassengers(3);
PersonList l = v.GetPassengers();
for(int i=0; i<l.GetNumPersons(); i++) {
Person p = Game::CreatePerson(l.GetPerson(i)->GetPrototypeFileName(), l.GetPerson(i)->GetName());
p.SetPlayerMP(v.GetPlayerMP());
k.AddPassenger(&p);
}
k.SetPlayerMP(v.GetPlayerMP());
if (v.IsSelected()) k.Select();
v.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
k.SetPlayerMP(v.GetPlayerMP());
k.SetSpeed(v.GetSpeed());
k.SetPosition(v.GetPosition());
k.SetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
k.EnableTrafficLight(TLT_NONE);
k.EnableBlinker(BLT_NONE);
k.PushActionExecuteCommand(ACTION_APPEND, "VCmdWarning", &k, 0, false);
k.EnableHeadLights(true);
if (!k.IsBlueLightEnabled()) k.PushActionExecuteCommand(ACTION_APPEND, "VCmdBlue", &k, 0, false);
k.RemoveCommand("GoHome");
k.RemoveCommand("VCmdInit");
if (k.HasCommand("MoveTo")) k.RemoveCommand("MoveTo");
k.AssignCommand("DUMMY_INIT");
k.AssignCommand("VCmdDebug");
k.AssignCommand("VCmdWarning");
k.AssignCommand("VCmdBlue");
k.AssignCommand("VCmdLiMa");
if (!k.HasCommand("ALARM_DUMMY")) k.AssignCommand("ALARM_DUMMY");
if (k.HasCommand("VCmdInstallCrane")) k.RemoveCommand("VCmdInstallCrane");
if (!k.HasCommand("VCmdUninstallCrane")) k.AssignCommand("VCmdUninstallCrane");
v.PushActionWait(ACTION_APPEND, 0.1f);
v.PushActionDeleteOwner(ACTION_APPEND);
break;
}
}
};
object VCmdUninstallCrane : CommandScript
{
VCmdUninstallCrane()
{
SetIcon("Deinstall");
SetCursor("Deinstall");
SetRestrictions(RESTRICT_SELFEXECUTE);
}
bool CheckPossible(GameObject *Caller)
{
Vehicle v(Caller);
if (v.GetNumPassengers() == 0) return false;
if (Caller->GetType() != ACTOR_VEHICLE || !Caller->HasCommand("ALARM_DUMMY")) return false;
GameObjectList ol = Caller->GetCarriedObjects();
if(ol.GetNumObjects() > 0) return false;
return true;
}
bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
return true;
}
void PushActions(GameObject *Caller, Actor *Target, int childID)
{
float r[9]; Vehicle v(Caller);
switch (childID)
{
case 0:
if (!v.IsSpecialLightEnabled()) v.PushActionExecuteCommand(ACTION_APPEND, "VCmdWarning", &v, 0, false);
if (v.HasCommand("DummyHasSiren")) v.PushActionExecuteCommand(ACTION_APPEND, "VcmdSiren", &v, 0, false);
v.SetCommandable(false);
v.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
v.PushActionExecuteCommand(ACTION_APPEND, "VCmdUninstallCrane", Target, 1, false);
break;
case 1:
Vehicle k = Game::CreateVehicle("mod:Prototypes/Vehicles/__FF_Wolfshain/04_36_01.e4p", v.GetName());
k.SetMaxPassengers(3);
PersonList l = v.GetPassengers();
for(int i=0; i<l.GetNumPersons(); i++) {
Person p = Game::CreatePerson(l.GetPerson(i)->GetPrototypeFileName(), l.GetPerson(i)->GetName());
p.SetPlayerMP(v.GetPlayerMP());
k.AddPassenger(&p);
}
k.SetPlayerMP(v.GetPlayerMP());
if (v.IsSelected()) k.Select();
v.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
k.SetPlayerMP(v.GetPlayerMP());
k.SetSpeed(v.GetSpeed());
k.SetPosition(v.GetPosition());
k.SetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
k.EnableTrafficLight(TLT_NONE);
k.EnableBlinker(BLT_NONE);
k.PushActionExecuteCommand(ACTION_APPEND, "VCmdWarning", &k, 0, false);
k.PushActionSwitchAnim(ACTION_NEWLIST, "abbau");
k.PushActionWait(ACTION_APPEND, 8.0f);
k.EnableHeadLights(true);
if (!k.IsBlueLightEnabled()) k.PushActionExecuteCommand(ACTION_APPEND, "VCmdBlue", &k, 0, false);
k.RemoveCommand("GoHome");
k.RemoveCommand("VCmdInit");
k.AssignCommand("MoveTo");
k.AssignCommand("DUMMY_INIT");
k.AssignCommand("VCmdDebug");
k.AssignCommand("VCmdWarning");
k.AssignCommand("VCmdBlue");
k.AssignCommand("VCmdAlarm");
k.AssignCommand("VCmdParking");
k.AssignCommand("VcmdEinsteigen");
k.AssignCommand("VCmdLiMa");
k.AssignCommand("FahrzeugPosition");
k.AssignCommand("DummyHasBesen");
if (!k.HasCommand("ALARM_DUMMY")) k.AssignCommand("ALARM_DUMMY");
if (!k.HasCommand("VCmdInstallCrane")) k.AssignCommand("VCmdInstallCrane");
if (k.HasCommand("VCmdUninstallCrane")) k.RemoveCommand("VCmdUninstallCrane");
v.PushActionWait(ACTION_APPEND, 0.1f);
v.PushActionDeleteOwner(ACTION_APPEND);
break;
}
}
};
Alles anzeigen