Jump to content
wisechild1

Keeping ambulance door keep open

Recommended Posts

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!

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