Jump to content
paulo ve

New Cool

Recommended Posts


help with script

how to make the nozzle truck according foam.

make a foam truck!!


 

object Cool : CommandScript

{

bool useDLKlogic;

 

Cool()

{

SetValidTargets(ACTOR_VEHICLE | ACTOR_OBJECT | ACTOR_HOUSE | ACTOR_OPEN_HOUSE);

SetRestrictions(RESTRICT_COOLABLE | RESTRICT_NOTBURNING);

SetKeepAsCurrentCommand(true);

SetPossibleCallers(ACTOR_PERSON | ACTOR_VEHICLE);

SetPossibleEquipment(EQUIP_FIRE_EXTINGUISHER | EQUIP_FIREHOSE);

SetPossibleExists(CPE_COOLABLE_OBJECTS);

SetNeedsConnectedHose(CFN_NEEDED);

}

 

/*bool CheckPossible(GameObject *Caller)

{

if(!Caller->IsValid())

return false;

if (Caller->GetType() == ACTOR_VEHICLE || Caller->GetEquipment()==EQUIP_FIRE_EXTINGUISHER || (Caller->GetEquipment()== EQUIP_FIREHOSE && Caller->GetFirehoseID() != 0))

return Game::ExistsCoolableobject();

return false;

}*/

 

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)

{

if(!Caller->IsValid() || !Target || !Target->IsValid() || Caller->GetID() == Target->GetID())

return false;

 

if(Target->GetType() == ACTOR_PERSON)

return false;

 

GameObject o(Target);

if (!o.IsValid() || o.GetNumActiveFireChilds() == 0)

return false;

 

if (o.GetType() == ACTOR_VEHICLE)

{

Vehicle v(Target);

if ((v.GetVehicleType() == VT_POLICE_PHC || v.GetVehicleType() == VT_AMBULANCE_RHC) && !v.IsOnGround())

  return false;

}

 

if (Caller->GetType() == ACTOR_PERSON )

{

Person p(Caller);

if (p.GetEquipment() == EQUIP_FIREHOSE && o.GetParentHouseID() > -1)

return false;

if (p.CanUseDLKCannon())

{

useDLKlogic = true;

if (o.GetNumActiveFireChilds() == 0)

return false;

if (p.GetEnteredCarTargetID() != -1 && p.GetEnteredCarTargetID() != Target->GetID())

return false;

if (p.GetEnteredCarID() == Target->GetID())

return false;

 

if (!p.CheckDLKExtinguishDistance(Target))

return false;

 

if (p.GetEnteredCarTargetID() != -1/* && o.IsBurningInside()*/)

return false;

else if (p.GetEnteredCarTargetID() == -1 && o.IsBurningOutside())

return false;

 

return true;

}

if (p.GetEnteredCarID() != -1)

  return false;

}

 

useDLKlogic = false;

 

if (Caller->GetType() == ACTOR_VEHICLE || Caller->GetEquipment()==EQUIP_FIRE_EXTINGUISHER || Caller->GetEquipment()== EQUIP_FIREHOSE)

{

if (Caller->GetEquipment() == EQUIP_FIREHOSE && Caller->GetFirehoseID() == 0)

return false;

return true;

}

return false;

}

 

void PushActions(GameObject *Caller, Actor *Target, int childID)

{

if (!Target)

return;

 

if (useDLKlogic)

{

Person p(Caller);

 

if (p.GetEnteredCarTargetID() != -1)

{

Caller->PushActionCannonExtinguish(ACTION_NEWLIST, Target, 100.f, true);

}

else

{

Caller->PushActionTurnBase(ACTION_NEWLIST, Target);

Caller->PushActionCannonExtinguish(ACTION_APPEND, Target, 100.f, true);

}

return;

}

 

if (Caller->GetType() == ACTOR_VEHICLE)

{

GameObject o(Target);

Vehicle v(Caller);

if (!v.CheckExtinguishDistance(o))

{

if (Target->GetType() == ACTOR_VEHICLE)

Caller->PushActionMove(ACTION_NEWLIST, Target, TARGET_ENGINE_EXTINGUISH);

else

Caller->PushActionMove(ACTION_NEWLIST, Target, TARGET_EXTINGUISH);

Caller->PushActionCool(ACTION_APPEND, Target);

                                                        o.PushActionExecuteCommand(ACTION_APPEND, "Schaum", Target, 1, false);

}

else

    Caller->PushActionCool(ACTION_NEWLIST, Target);

                                                        o.PushActionExecuteCommand(ACTION_APPEND, "Schaum", Target, 2, false);

}

else if (Caller->GetType() == ACTOR_PERSON)

{

if (Target->GetType()==ACTOR_VEHICLE)

{

Caller->PushActionMove(ACTION_NEWLIST, Target, TARGET_ENGINE_EXTINGUISH);

Vector Pos = Target->GetTargetPoint(Caller, TARGET_ENGINE);

                                                        Caller->PushActionTurnTo(ACTION_APPEND, Pos);

}

else

{

Caller->PushActionMove(ACTION_NEWLIST, Target, TARGET_EXTINGUISH);

Caller->PushActionTurnTo(ACTION_APPEND, Target);

}

}

Caller->PushActionCool(ACTION_NEWLIST, Target);

                            Caller->PushActionExecuteCommand(ACTION_APPEND, "Schaum", Target, 1, false);

}

 

};

 

object Schaum : CommandScript

{

Schaum()

{

           SetGroupID(120);

}

 

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)

{

           return true;

}

 

void PushActions(GameObject *Caller, Actor *Target, int childID)

               {

 Vehicle v(Caller);

 if (childID == 0)

 {

  Vector Posi = v.GetPosition();

  GameObject Schaum = Game::CreateObject("mod:Prototypes/Objects/Schaum/Schaum.e4p", "Bauschaum");

       Schaum.SetPosition(Posi);   

       Schaum.PushActionSwitchAnim(ACTION_NEWLIST, "open");

      Schaum.PushActionWait(ACTION_APPEND, 30.0f);

      Schaum.PushActionExecuteCommand(ACTION_APPEND, "Schaum", Target, 3, false);

       v.PushActionExecuteCommand(ACTION_APPEND, "Schaum", Target, 2, false);

 }

 if(childID == 1)

 {

                 Vehicle v(Caller);

                 GameObject o(Target);

 Vector Poso = o.GetPosition();

 GameObject Schaum = Game::CreateObject("mod:Prototypes/Objects/Schaum/Schaum.e4p", "Bauschaum");

      Schaum.SetPosition(Poso);

      Schaum.PushActionSwitchAnim(ACTION_NEWLIST, "open");

      Schaum.PushActionWait(ACTION_APPEND, 30.0f);

      Schaum.PushActionExecuteCommand(ACTION_APPEND, "Schaum", Target, 3, false);

      v.PushActionExecuteCommand(ACTION_APPEND, "Schaum", Target, 2, false);

 }

 if(childID == 2)

 {

  v.PushActionCool(ACTION_APPEND, Target);               

 }

 if(childID == 3)

 {

  Caller->PushActionSwitchAnim(ACTION_NEWLIST, "close");

 }

}

};

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