Jump to content
EmC-Unit

"Haspel" script help

Recommended Posts

Hey guys! Just today founded this error in script, when you get a 2nd fire drum the car where it was placed just disappear.

 

 

Can anybody help me solve it?

 

 

// Alle Scripts wurden mit Scriptteilen von THW Teufel,Boogie-Man,GoKa,a-rescue,GrisuStefan,Hoppah erstellt// Script by Hoppah// Verдndert by THW Teufel// Scriptteile by GoKa,a-rescue,THW Teufel// Nutzung laut Em Forum erlaubtobject PickUpHaspel: CommandScript{Vector pos;PickUpHaspel(){SetCursor("install");SetIcon("install");SetValidTargets(ACTOR_VEHICLE);SetGroupID(CGROUP_GETEQUIPMENT);//SetRestrictions(RESTRICT_NOTDESTROYED | RESTRICT_NOTBURNING );}bool CheckTarget(GameObject *Caller, Actor *Target, int childID){if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID()==Target->GetID()))return false;Vehicle vec(Target);if (Caller->GetObjectType()==TYPE_PERSON && Caller->GetEquipment()!=EQUIP_EMERGENCY_CASE &&vec.IsValid() && (vec.GetVehicleType() == VT_FIREFIGHTERS_GTF || vec.GetVehicleType() == VT_NOSQUAD )){Person p(Caller);if(p.IsValid() && (p.IsCarryingPerson()||p.IsLinkedWithPerson()|| p.GetFirehoseID()!=0 || p.IsPulling() || p.GetEnteredCarID() != -1))return false;return true;}return false;}void PushActions(GameObject *Caller, Actor *Target, int childID){Person p(Caller);Vehicle v(Target);Vector TargetPos = Target->GetTargetPoint(Caller, TARGET_EQUIPMENTDOOR);if(StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/Vehicles Objects/Firehose Reel.e4p") == 0){Person p(Caller);p.PushActionMove(ACTION_NEWLIST, TargetPos);p.PushActionTurnTo(ACTION_APPEND, Target);}p.PushActionExecuteCommand(ACTION_APPEND, "PickUpHaspel", Target, 1, false);if (childID == 1){v.PushActionDeleteOwner(ACTION_APPEND);p.RemoveCommand("Haspelstellen");p.RemoveCommand("PickUpHaspel");p.RemoveCommand("GetHaspel");p.RemoveCommand("GetExtinguisher");p.RemoveCommand("GetFireHose");p.RemoveCommand("GetShears");p.RemoveCommand("GetJumppad");p.RemoveCommand("GetChainsaw");p.RemoveCommand("GetAxe");p.RemoveCommand("Verteiler");p.RemoveCommand("Extinguish");p.RemoveCommand("Cool");p.RemoveCommand("AttachFireHose");p.RemoveCommand("RemoveFirehose");p.RemoveCommand("UseShears");p.RemoveCommand("UseJumppad");p.RemoveCommand("UseChainSaw");p.RemoveCommand("UseAxe");p.RemoveCommand("RemoveEquipment");p.RemoveCommand("PickUp");p.RemoveCommand("SendPeople");p.RemoveCommand("DriveAwayPerson");p.RemoveCommand("PutInCar");p.RemoveCommand("ReleaseArrested");p.RemoveCommand("Lift");p.RemoveCommand("UnloadPerson");p.RemoveCommand("Pull");p.RemoveCommand("StopPull");p.RemoveCommand("EnterBasket");p.RemoveCommand("BasketDown");p.RemoveCommand("StopUseCannon");p.RemoveCommand("EnterCar");p.RemoveCommand("EnterHouse");p.SetChildEnabled("Haspel", true);p.AssignCommand("DeleteHaspel");p.AssignCommand("Haspelstellen");}}};// by GoKa | modified by a-rescue & GrisuStefan// Verдndert by THW Teufelobject GetHaspel : CommandScript{Vector pos;GetHaspel(){SetCursor("install");SetIcon("install");SetValidTargets(ACTOR_VEHICLE);SetGroupID(CGROUP_GETEQUIPMENT);//SetRestrictions(RESTRICT_NOTDESTROYED | RESTRICT_NOTBURNING );}bool CheckTarget(GameObject *Caller, Actor *Target, int childID){if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID()==Target->GetID()))return false;Vehicle vec(Target);if (Caller->GetObjectType()==TYPE_PERSON && Caller->GetEquipment()!=EQUIP_EMERGENCY_CASE &&vec.IsValid() && (vec.GetVehicleType() == VT_FIREFIGHTERS_GTF )){Person p(Caller);if(p.IsValid() && (p.IsCarryingPerson()||p.IsLinkedWithPerson()|| p.GetFirehoseID()!=0 || p.IsPulling() || p.GetEnteredCarID() != -1))return false;return true;}return false;}void PushActions(GameObject *Caller, Actor *Target, int childID){Person p(Caller);Vehicle v(Target);if (childID == 0){Vehicle v(Target);Vector ChildPos = v.GetChildPosition("Haspel1");p.PushActionMove(ACTION_APPEND, ChildPos);p.PushActionExecuteCommand(ACTION_APPEND, "GetHaspel", Target, 1, false);}if (childID == 1){v.PlayAnimOpenDoor(DAT_SPECIAL, 0.6f, 0);p.PushActionWait(ACTION_APPEND, 0.6f);p.PushActionExecuteCommand(ACTION_APPEND, "GetHaspel", Target, 2, false);}if (childID == 2){p.SetChildEnabled("Haspel", true);v.SetChildEnabled("Haspel1", false);p.AssignCommand("DeleteHaspel");p.AssignCommand("Haspelstellen");p.RemoveCommand("GetHaspel");p.RemoveCommand("GetExtinguisher");p.RemoveCommand("GetFireHose");p.RemoveCommand("GetShears");p.RemoveCommand("GetJumppad");p.RemoveCommand("GetChainsaw");p.RemoveCommand("GetAxe");p.RemoveCommand("Verteiler");p.RemoveCommand("Extinguish");p.RemoveCommand("Cool");p.RemoveCommand("AttachFireHose");p.RemoveCommand("RemoveFirehose");p.RemoveCommand("UseShears");p.RemoveCommand("UseJumppad");p.RemoveCommand("UseChainSaw");p.RemoveCommand("UseAxe");p.RemoveCommand("RemoveEquipment");p.RemoveCommand("PickUp");p.RemoveCommand("SendPeople");p.RemoveCommand("DriveAwayPerson");p.RemoveCommand("PutInCar");p.RemoveCommand("ReleaseArrested");p.RemoveCommand("Lift");p.RemoveCommand("UnloadPerson");p.RemoveCommand("Pull");p.RemoveCommand("StopPull");p.RemoveCommand("EnterBasket");p.RemoveCommand("BasketDown");p.RemoveCommand("StopUseCannon");p.RemoveCommand("EnterCar");p.RemoveCommand("EnterHouse");p.RemoveCommand("PickUpHaspel");}}};// Haspelabstellen Script by Notarztblubb,Boogie,THW Teufel// Nutzung per Readmeeintrag freiconst char IMG[] = "use";object Haspelstellen : CommandScript{Haspelstellen(){SetIcon(IMG);SetCursor(IMG);}bool CheckPossible(GameObject *Caller){//CheckPossible Abschnittreturn true;}bool CheckTarget(GameObject *Caller, Actor *Target, int childID){//CheckTarget Abschnittreturn true;}void PushActions(GameObject *Caller, Actor *Target, int childID){Person p(Caller);Vector Pos = p.GetPosition();p.SetPlacement(PLACEMENT_CUSTOM_PLACEMENT);p.SetPosition(Pos + Vector(0.f,0.f,-45.f));Vehicle Haspel = Game::CreateVehicle("mod:Prototypes/Vehicles/Vehicles Objects/Firehose Reel.e4p", "Haspel");float r[9];p.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);float vx = -5.f, vy = -20.f, vz = 0.f;Math::RotateVector(vx, vy, vz, r);Haspel.SetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);Haspel.SetPosition(Pos + Vector(vx, vy, vz));Haspel.SetSelectable(true);int HaspelID = Haspel.GetID();p.SetUserData(HaspelID);p.SetChildEnabled("Haspel",false); // HIER DEINEN CHILDNAMEN REIN STATT HASPELp.SetPosition(Pos);p.AssignCommand("GetExtinguisher");p.AssignCommand("GetFireHose");p.AssignCommand("GetShears");p.AssignCommand("GetJumppad");p.AssignCommand("GetChainsaw");p.AssignCommand("GetAxe");p.AssignCommand("Verteiler");p.AssignCommand("Extinguish");p.AssignCommand("Cool");p.AssignCommand("AttachFireHose");p.AssignCommand("RemoveFirehose");p.AssignCommand("UseShears");p.AssignCommand("UseJumppad");p.AssignCommand("UseChainSaw");p.AssignCommand("UseAxe");p.AssignCommand("RemoveEquipment");p.AssignCommand("PickUp");p.AssignCommand("SendPeople");p.AssignCommand("DriveAwayPerson");p.AssignCommand("PutInCar");p.AssignCommand("ReleaseArrested");p.AssignCommand("Lift");p.AssignCommand("UnloadPerson");p.AssignCommand("Pull");p.AssignCommand("StopPull");p.AssignCommand("EnterBasket");p.AssignCommand("BasketDown");p.AssignCommand("StopUseCannon");p.AssignCommand("EnterCar");p.AssignCommand("EnterHouse");p.RemoveCommand("Haspelstellen");p.RemoveCommand("DeleteHaspel");p.AssignCommand("PickUpHaspel");p.SetRotation(Caller);p.PushActionSwitchAnim(ACTION_APPEND, "idle");p.PushActionWait(ACTION_APPEND, 3.f);p.PushActionSwitchAnim(ACTION_APPEND, "idle");}};// by GoKa | modified by a-rescue & GrisuStefan// Verдndert by THW Teufelobject DeleteHaspel : CommandScript{Vector pos;DeleteHaspel(){SetCursor("deinstall");SetIcon("deinstall");SetValidTargets(ACTOR_VEHICLE);//SetRestrictions(RESTRICT_NOTDESTROYED | RESTRICT_NOTBURNING );}bool CheckTarget(GameObject *Caller, Actor *Target, int childID){if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID()==Target->GetID()))return false;Vehicle vec(Target);if (Caller->GetObjectType()==TYPE_PERSON && Caller->GetEquipment()!=EQUIP_EMERGENCY_CASE &&vec.IsValid() && (vec.GetVehicleType() == VT_FIREFIGHTERS_GTF )){Person p(Caller);if(p.IsValid() && (p.IsCarryingPerson()||p.IsLinkedWithPerson()|| p.GetFirehoseID()!=0 || p.IsPulling() || p.GetEnteredCarID() != -1))return false;return true;}return false;}void PushActions(GameObject *Caller, Actor *Target, int childID){Person p(Caller);Vehicle v(Target);if (childID == 0){Vehicle v(Target);Vector ChildPos = v.GetChildPosition("Haspel1");p.PushActionMove(ACTION_APPEND, ChildPos);p.PushActionExecuteCommand(ACTION_APPEND, "DeleteHaspel", Target, 1, false);}if (childID == 1){v.PlayAnimOpenDoor(DAT_SPECIAL, 0.6f, 0);p.PushActionWait(ACTION_APPEND, 0.6f);p.PushActionExecuteCommand(ACTION_APPEND, "DeleteHaspel", Target, 2, false);}if (childID == 2){v.SetChildEnabled("Haspel1", true);p.SetChildEnabled("Haspel", false);p.AssignCommand("GetExtinguisher");p.AssignCommand("GetFireHose");p.AssignCommand("GetShears");p.AssignCommand("GetJumppad");p.AssignCommand("GetChainsaw");p.AssignCommand("GetAxe");p.AssignCommand("Verteiler");p.AssignCommand("Extinguish");p.AssignCommand("Cool");p.AssignCommand("AttachFireHose");p.AssignCommand("RemoveFirehose");p.AssignCommand("UseShears");p.AssignCommand("UseJumppad");p.AssignCommand("UseChainSaw");p.AssignCommand("UseAxe");p.AssignCommand("RemoveEquipment");p.AssignCommand("PickUp");p.AssignCommand("SendPeople");p.AssignCommand("DriveAwayPerson");p.AssignCommand("PutInCar");p.AssignCommand("ReleaseArrested");p.AssignCommand("Lift");p.AssignCommand("UnloadPerson");p.AssignCommand("Pull");p.AssignCommand("StopPull");p.AssignCommand("EnterBasket");p.AssignCommand("BasketDown");p.AssignCommand("StopUseCannon");p.AssignCommand("EnterCar");p.AssignCommand("EnterHouse");p.RemoveCommand("DeleteHaspel");p.RemoveCommand("Haspelstellen");p.AssignCommand("GetHaspel");}}};

 

Link to comment
Share on other sites

Well its strange but there is always a reason. My guess is that you executed PickUpHaspel (which deletes the target) instead of GetHaspel on the vehicle.

 

I'd make sure the PickUpHaspel can only be executed on that specific haspel model by changing the CheckTarget part of the script.

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