Jump to content
Guest kondor

entercar.script

Recommended Posts

Hello.

I am working in my own mod during my holidays.

I make a MOD with 4 new vehicles. One of their are a police car cloned by STW original.

In /Units I wrote 3 crew (policeman, shooter and phsycologist) and 2 loadspace and firsttime this go on ok, but when I empty car, SHOOTER cannot enter another time in this car.

Could you help me?

Thanks

Link to comment
Share on other sites

Open entercar.script

Change this:

case VT_POLICE_STW :
if(!p.HasCommand("Arrest") && !p.HasCommand("Negotiate") || p.HasCommand("GetFlashgrenade"))
return false;
if (p.IsLinkedWithPerson())
return false;
break;

to this

case VT_POLICE_STW :
if(!p.HasCommand("Arrest") && !p.HasCommand("Negotiate"))
return false;
if (p.IsLinkedWithPerson())
return false;
break;

Meaning: Units with command "GetFlashgrenade", like the shooter, couldn't enter STW type vehicles, so remove that code from the script to make that possible.

Link to comment
Share on other sites

Thanks Hoppah, but I try this command line before you say me it and I found a problem:

Shooter only can enter car like STW if a MTW or SW or PHC is on street. If MTW or SW or PHC is not on street, SHOTTER can not enter STW car.

For this reason I wrote in this forum. I only find a solution: Modify type STW to MTW, but in this case Scout can enter in STW car, and I do not want that

Any Idea?

Link to comment
Share on other sites

I only find a solution:

- I have erased the lines commented (/* */) under: bool CheckPossible(GameObject *Caller)

- in case PT_SHOOTER: i add VT_POLICE_STW

- in case VT_POLICE_STW: I have modified the line as Hoppah said to me

Result:

object EnterCar : CommandScript
{
Vector TargetPos;
bool NotInLandingStage;

EnterCar()
{
SetValidTargets(ACTOR_VEHICLE);
SetRestrictions(RESTRICT_NOTDESTROYED);
SetNeedsConnectedHose(CFN_FAIL);
SetPriority(200);
SetSelfClickActivation(true);
}

bool CheckPossible(GameObject *Caller)
{
if (!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON)
return false;
Person p(Caller);
if (p.GetRole() == ROLE_SQUAD && p.IsContaminated())
{
if ((p.IsLinkedWithPerson() || p.IsCarryingPerson()) && Game::ExistsFreeVehicle(VT_FIREFIGHTERS_DEKONP, 0, 2))
return true;
else if (!p.IsLinkedWithPerson() && !p.IsCarryingPerson() && Game::ExistsFreeVehicle(VT_FIREFIGHTERS_DEKONP, 0, 1))
return true;
return false;
}
else if (p.GetRole() == ROLE_SQUAD && (p.IsLinkedWithContaminatedPerson() || p.IsCarryingContaminatedPerson()))
return Game::ExistsFreeVehicle(VT_FIREFIGHTERS_DEKONP, 0, 2);
if (Game::ExistsFreeVehicle(VT_FIREFIGHTERS_FMB, 1, (p.IsLinkedWithPerson() || p.IsCarryingPerson()) ? 1 : 0))
return true;
switch(p.GetPersonType())
{
case PT_ENGINEER:
return Game::ExistsFreeVehicle(VT_THW_FGRI_EKW, VT_THW_FGRT_BH, 1, 0);
break;
case PT_LEADERRESCUEDOG:
if (p.IsLinkedWithPerson())
return Game::ExistsFreeVehicle(VT_AMBULANCE_RHF, 1, 1);
return Game::ExistsFreeVehicle(VT_AMBULANCE_RHF, 1, 0);
break;
case PT_SHOOTER:
return !p.IsLinkedWithPerson() && Game::ExistsFreeVehicle(VT_POLICE_SW, VT_POLICE_MTW, VT_POLICE_PHC, VT_POLICE_STW, 1, 0);
break;
case PT_SHARPSHOOTER:
return Game::ExistsFreeVehicle(VT_POLICE_SW, VT_POLICE_PHC, 1, 0);
break;
case PT_POLICEMEN:
case PT_PSYCHOLOGIST:
return Game::ExistsFreeVehicle(VT_POLICE_SW, VT_POLICE_MTW, VT_POLICE_PHC, VT_POLICE_STW, 1, 0);
break;
case PT_SCOUT:
return Game::ExistsFreeVehicle(VT_POLICE_SW, VT_POLICE_MTW, VT_POLICE_PHC, 1, 0);
break;
case PT_DOCTOR:
return Game::ExistsFreeVehicle(VT_AMBULANCE_ITW, VT_AMBULANCE_NEF, VT_AMBULANCE_RHC, VT_AMBULANCE_RTW, 1, 0);
break;
case PT_PARAMEDIC:
if (p.IsCarryingPerson())
{
return Game::ExistsFreeVehicle(VT_AMBULANCE_RHC, VT_AMBULANCE_RTW, 1, 1);
}
return Game::ExistsFreeVehicle(VT_AMBULANCE_ITW, VT_AMBULANCE_RHC, VT_AMBULANCE_RTW, 1, 0);
break;
case PT_FIREFIGHTER_NORMAL:
case PT_FIREFIGHTER_MASK:
if (p.IsLinkedWithPerson() || p.IsCarryingPerson())
return false;
if (Game::ExistsFreeVehicle(VT_FIREFIGHTERS_GTF, 1, 0))
return true;
case PT_FIREFIGHTER_ABC:
if (p.IsLinkedWithPerson() || p.IsCarryingPerson())
return false;
if (Game::ExistsFreeVehicle(VT_FIREFIGHTERS_DEKONP, 1, 0))
return true;
// kein break
case PT_DIVER:
if (p.IsLinkedWithPerson() || p.IsCarryingPerson())
return false;
return Game::ExistsFreeVehicle(VT_FIREFIGHTERS_DLK, VT_FIREFIGHTERS_RW, VT_FIREFIGHTERS_TLF, VT_FIREFIGHTERS_LPF, 1, 0);
break;
}
return false;
return Commands::IsEnterCarPossible(Caller);
}

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

SetPriority(200);
if (Input::PriorityKeyPressed())
SetPriority(2000);

Vehicle v(Target);
if (v.GetEnergy() < = 0.1f * v.GetMaxEnergy())
return false;
if(Caller->GetObjectType()==TYPE_PERSON/* && v.IsFlagSet(OF_ACCESSIBLE)*/)
{
Person p(Caller);

if (p.GetEnteredCarID() != -1)
return false;

if (v.GetVehicleType() == VT_FIREFIGHTERS_DEKONP)
{
if (!p.IsLinkedWithPerson() && !p.IsCarryingPerson() && v.GetFreePassengers()==0 && !p.IsContaminated())
return false;
else if (!p.IsLinkedWithPerson() && !p.IsCarryingPerson() && p.IsContaminated() && v.GetFreeTransports() < 1)
return false;
else if ((p.IsLinkedWithPerson() || p.IsCarryingPerson()) && v.GetFreeTransports() < 2)
return false;
}
else
if(v.GetFreePassengers()==0 && !(p.IsLinkedWithPerson() || p.IsCarryingPerson()))
return false;

if (p.IsCarryingPerson() && v.GetFreeTransports() == 0)
return false;
else if (p.IsLinkedWithPerson() && v.GetFreeTransports() == 0)
return false;

if(v.HasCommand("FlyTo") && !v.IsOnGround())
return false;

if(p.IsPulling() || (p.GetEquipment() == EQUIP_FIREHOSE && p.GetFirehoseID() > 0))
return false;

switch(v.GetVehicleType())
{
case VT_NOSQUAD :
case VT_TAXI :
case VT_BUS :
case VT_DRIVERCAR :
case VT_POLICE_GTW:
case VT_POLICE_WAW :
return false;
break;

case VT_THW_FGRR_BKF :
case VT_THW_FGRB_BLF :
return false;
break;
case VT_THW_FGRI_EKW :
case VT_THW_FGRT_BH:
if(!p.HasCommand("Repair"))
return false;
break;

/*case VT_FIREFIGHTERS_GTF:
if(!p.HasCommand("Extinguish") || !p.HasCommand("GetShears"))
return false;
break;*/
case VT_FIREFIGHTERS_ASF :
case VT_FIREFIGHTERS_DLK :
case VT_FIREFIGHTERS_RW :
case VT_FIREFIGHTERS_TLF :
case VT_FIREFIGHTERS_LF :
case VT_FIREFIGHTERS_FLB :
case VT_FIREFIGHTERS_LPF :
case VT_FIREFIGHTERS_TFMB :
case VT_FIREFIGHTERS_GTF :
if(!p.HasCommand("Extinguish") && !p.HasCommand("GetShears") && !p.HasCommand("Dive"))
return false;
break;

case VT_FIREFIGHTERS_DEKONP :
if (!p.HasCommand("DriveAwayPerson") && !p.IsContaminated())
return false;
if(!p.CanEnterDekonP())
return false;
break;

case VT_FIREFIGHTERS_FMB:
{
// FMB in LStage ? - Liefere Zielpunkt an Land < 0 (=-0.2f)
if (v.IsInLandingStage(false, TargetPos, -0.2f) >= 0)
{
NotInLandingStage = false;
return true;
}
if (v.IsInLandingStage(true, TargetPos, -0.2f) >= 0)
{
NotInLandingStage = false;
return true;
};
NotInLandingStage = true;
// Taucher kann immer rein
if (!p.HasCommand("Dive"))
return false;
break;
}

case VT_POLICE_SW :
if(!p.HasCommand("Aim") && !p.HasCommand("Arrest") && !p.HasCommand("GetFlashgrenade") && !p.HasCommand("Negotiate") && !p.HasCommand("ScoutHouse"))
return false;
if (p.IsLinkedWithPerson())
return false;
break;
case VT_POLICE_PHC :
if(!p.HasCommand("Aim") && !p.HasCommand("Arrest") && !p.HasCommand("GetFlashgrenade") && !p.HasCommand("Negotiate") && !p.HasCommand("ScoutHouse"))
return false;
if (p.IsLinkedWithPerson())
return false;
break;

case VT_POLICE_STW :
if(!p.HasCommand("Arrest") && !p.HasCommand("Negotiate"))
return false;
if (p.IsLinkedWithPerson())
return false;
break;

case VT_POLICE_MTW :
if(!p.HasCommand("Arrest") && !p.HasCommand("GetFlashgrenade") && !p.HasCommand("Negotiate") && !p.HasCommand("ScoutHouse"))
return false;
if (p.IsLinkedWithPerson())
return false;
break;

case VT_POLICE_GETAWAY : return false; break;

case VT_AMBULANCE_RHF :
if(!p.HasCommand("SendDog") && !p.HasCommand("CallDog"))
return false;
break;

case VT_AMBULANCE_ITW :
if(p.IsCarryingPerson())
return false;
if(!p.HasCommand("Heal") && !p.HasCommand("UnloadPerson") && !p.HasCommand("PutInCar"))
return false;
if(p.HasCommand("Extinguish") || p.HasCommand("GetRoadBlock"))
return false;
break;

case VT_AMBULANCE_NEF :
if(!p.HasCommand("Heal"))
return false;

case VT_AMBULANCE_RHC :
case VT_AMBULANCE_RTW :
if (v.GetFreePassengers() == 0)
return false;
if(!p.HasCommand("Heal") && !p.IsParamedicTeam() )
return false;
break;

default : return false;
}

if((p.HasCommand("extinguish") && (p.IsCarryingPerson() || p.IsLinkedWithPerson())) || p.IsContaminated())
{
if (v.GetVehicleType() == VT_FIREFIGHTERS_DEKONP)
return true;
else
return false;
}


return true;
}

return false;
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Person p(Caller);
Vehicle v(Target);

if (p.IsCarryingPerson())
{
Person carried = p.GetCarried();
bool carriedClassified = false;
if (carried.IsClassified())
carriedClassified = true;
if(!carriedClassified && (v.GetVehicleType() == VT_AMBULANCE_ITW || v.GetVehicleType() == VT_AMBULANCE_RTW || v.GetVehicleType() == VT_AMBULANCE_RHC))
{
ScriptInterface::ShowMessageTickerTextForSinglePlayer(Caller, "ALLM_CLASSIFY_FIRST");
return;
}
}

TargetPoint targetPoint;
if (v.GetVehicleType() == VT_AMBULANCE_ITW)
targetPoint = TARGET_PASSENGERDOOR;
else if (v.GetVehicleType() == VT_THW_FGRT_BH)
targetPoint = TARGET_REARDOOR;
else if (v.GetVehicleType() == VT_FIREFIGHTERS_FMB)
{
if (NotInLandingStage)
targetPoint = TARGET_OBJECTSURFACE;
else
{
Caller->PushActionMove(ACTION_NEWLIST, TargetPos);
Caller->PushActionTurnTo(ACTION_APPEND, Target);
Caller->PushActionEnterCar(ACTION_APPEND, Target);
return;
}
}
// diese Abfrage auf jeden Fall erst nach ITW und FMB
else if (p.IsParamedicTeam() ||
(p.HasCommand("Heal") && (v.GetNumTransported()>0 || Game::IsParamedicWithInjuredInSelection(Caller))))
targetPoint = TARGET_REARDOOR;
else
targetPoint = TARGET_PASSENGERDOOR;

if((p.HasCommand("extinguish") && (p.IsCarryingPerson() || p.IsLinkedWithPerson())) || p.IsContaminated())
{
if (v.GetVehicleType() == VT_FIREFIGHTERS_DEKONP)
targetPoint = TARGET_REARDOOR;
}

if (p.HasCommand("SendDog") && p.GetArrestedID() != -1)
{
targetPoint = TARGET_REARDOOR;
Caller->PushActionMove(ACTION_NEWLIST, Target, targetPoint);
Caller->PushActionTurnTo(ACTION_APPEND, Target);
Caller->PushActionPutInCar(ACTION_APPEND, Target);
targetPoint = TARGET_PASSENGERDOOR;
Caller->PushActionMove(ACTION_APPEND, Target, targetPoint);
Caller->PushActionTurnTo(ACTION_APPEND, Target);
Caller->PushActionEnterCar(ACTION_APPEND, Target);
}
else
{
Caller->PushActionMove(ACTION_NEWLIST, Target, targetPoint);
Caller->PushActionTurnTo(ACTION_APPEND, Target);
Caller->PushActionEnterCar(ACTION_APPEND, Target);
}
}
};

Could you say me some other suggestion to make this?

Link to comment
Share on other sites

First, explain to what you meant with: If MTW or SW or PHC is not on street

ok

I want to say that:

If I only apply the moficacion that Hoppah indicated me, Shooter can not access the vehicle type STW unless there are a vehicle of the type SW, PHP or MTW activated (outside the garages).

Can you understand me now?

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