Jump to content


Photo

New Cool


  • Please log in to reply
No replies to this topic

#1 paulo ve

paulo ve

    Captain

  • Members
  • 205 posts

Posted 12 January 2016 - 01:41 AM

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");
 }
}
};