wisechild1 Posted April 9, 2011 Report Share Posted April 9, 2011 object EmptyCar : CommandScript{ EmptyCar() { SetValidTargets(ACTOR_VEHICLE); SetDoubleClickable(true); SetRestrictions(RESTRICT_SELFEXECUTE); SetPriority(100); } bool CheckPossible(GameObject *Caller) { if (!Caller->IsValid() || Caller->GetType() != ACTOR_VEHICLE) return false; Vehicle v(Caller); if(v.HasCommand("FlyTo") && !v.IsOnGround()) return false; return v.GetNumPassengers() > 0; } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { if(!Caller->IsValid() || !Target->IsValid()) return false; if(Caller->GetType()==ACTOR_VEHICLE && Target->GetType()==ACTOR_VEHICLE && Caller->GetID()==Target->GetID()) { Vehicle v(Caller); if (!v.IsValid() || v.IsDestroyed()) return false; if(v.HasCommand("FlyTo") && !v.IsOnGround()) return false; if(v.GetNumPassengers() > 0) return true; } return false; Vehicle v(Caller); if (v.IsFirefighter()) childID = 0; else if (v.IsAmbulance()) childID = 1; else if (v.IsPolice() || v.IsThw()) childID = 2; } void PushActions(GameObject *Caller, Actor *Target, int childID) { Vehicle v(Caller); if (childID == 0) { if (!v.IsCurrentAction("EActionCool") && !v.IsCurrentAction("EActionExtinguish")) v.PushActionWait(ACTION_NEWLIST, 0.05f); v.PlayAnimOpenDoor(DAT_SPECIAL, 0.6f); v.PushActionExecuteCommand(ACTION_NEWLIST, "EmptyCar", Caller, 2, false); } else if (childID == 1) { v.PushActionExecuteCommand(ACTION_NEWLIST, "EmptyCar", Caller, 2, false); v.PushActionExecuteCommand(ACTION_NEWLIST, "EmptyCar", Caller, 3, false); } else if (childID == 2) { PersonList l = v.GetPassengers(); for(int i=0; i<l.GetNumPersons(); i++) if (!l.GetPerson(i)->HasAnimation("bark")) l.GetPerson(i)->PushActionLeaveCar(ACTION_NEWLIST, Target); v.EnableBlinker(BLT_BOTH); v.AssignCommand("DummyBLight"); v.PushActionExecuteCommand(ACTION_APPEND, "DUMMYDisableSiren", Caller, 2, false); } else if (childID == 3) { v.PlayAnimOpenDoor(DAT_SPECIAL, 0.6f); } if (v.GetVehicleType() == VT_THW_FGRT_BH) { PersonList l2 = v.GetTransports(); for(int i=0; i<l2.GetNumPersons(); i++) if (!l2.GetPerson(i)->HasAnimation("bark")) l2.GetPerson(i)->PushActionLeaveCar(ACTION_NEWLIST, Target); } }};object DummyBLight : CommandScript{ DummyBLight() { SetGroupID(20); } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { return false; } void PushActions(GameObject *Caller, Actor *Target, int childID) { }};I want to keep ambulance's rear door keep open after person leaved car.I tried defining name, changing action type, chaging group, but doesn't work!I really needs help(I have been thinking about this more than 1 week!)!!Thank you! Quote Link to comment Share on other sites More sharing options...