BxPanxi Posted April 6, 2019 Report Share Posted April 6, 2019 Hi, I am trying to get the Police Barricade tool into a mod called Northview South County. It has the script, but the script points to some .e4p files, how do I make a e4p for a Vehicle? I thought I needed to add the tool name in the unit.xml but I don't know the tool name either. Please help! i am also aware this is a very old game and I probably won't get a response. Quote Link to comment Share on other sites More sharing options...
itchboy Posted April 7, 2019 Report Share Posted April 7, 2019 Units xml has nothing to do with any of the custom equipment found in mods. You need to edit the script files. They contain the list of units that have the barricades. The scripts for ballistic shields, guns, and traffic cones also operate on the same logic. 1 Quote Link to comment Share on other sites More sharing options...
BxPanxi Posted April 9, 2019 Author Report Share Posted April 9, 2019 @itchboy Yeah I edited the files, but now a little far into the game, the LA Police Barricde error comes up saying "Statement took too long" Quote Link to comment Share on other sites More sharing options...
itchboy Posted April 9, 2019 Report Share Posted April 9, 2019 Let me see how you edited the script. You most likely commited a syntax error. Quote Link to comment Share on other sites More sharing options...
BxPanxi Posted April 10, 2019 Author Report Share Posted April 10, 2019 @itchboySorry I don't respond for a while, I don't expect to get a response immediately. Here's a link to a GIF which shows what section I changed. If you just want the code, it is below; https://gyazo.com/675636db75500ccda8f627721769ff1d Spoiler if (v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_lapd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/hummerh2_lasd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/rescue_truck01_lapd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_lapp.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol1.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol2.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol4.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol6.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/rescue_truck02_lapd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/swat_armoured_vehicle.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/swat_truck.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 US Army/hmmwv.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/05 US Army/us_army_truck.e4p") == 0) return true; return false; } } void PushActions(GameObject *Caller, Actor *Target, int childID) { Vector TargetPos = Target->GetTargetPoint(Caller, TARGET_EQUIPMENTDOOR); Caller->PushActionMove(ACTION_NEWLIST, TargetPos); Caller->PushActionTurnTo(ACTION_APPEND, Target); Caller->PushActionGetEquipment(ACTION_APPEND, Target, EQUIP_NONE); Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_BARRICADE, Target, 1, false); } }; object PcmdBarricadeRemove : CommandScript { PcmdBarricadeRemove() { SetIcon("policebarricaderemove"); SetCursor("policebarricaderemove"); SetValidTargets(ACTOR_VEHICLE | ACTOR_OBJECT); SetRestrictions(RESTRICT_NOTDESTROYED | RESTRICT_NOTBURNING | RESTRICT_HASROADBLOCK); SetPossibleCallers(ACTOR_PERSON); SetNeedsCarWithFlagSet(OF_HAS_ROADBLOCK); } /*bool CheckPossible(GameObject *Caller) { if(!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON) return false; Person p(Caller); if (p.IsCarryingPerson()||p.IsLinkedWithPerson()|| p.GetFirehoseID()!=0 || p.IsPulling()) return false; if (!Game::ExistsNormalObjectWithFlagSet(OF_HAS_ROADBLOCK)) return false; return true; }*/ bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { if(!Caller->IsValid() || !Target || !Target->IsValid() || Target->GetType()!=ACTOR_VEHICLE) return false; if(Caller->GetObjectType()==TYPE_PERSON) { Person p(Caller); Vehicle v(Target); if (v.IsDestroyed()) return false; if(p.IsValid() && (p.IsLinkedWithPerson() || p.IsCarryingPerson() || p.IsEquipped() || p.IsPulling() || p.GetFirehoseID()!=0 || p.GetEnteredCarID() != -1)) return false; Vehicle v(Target); if (v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_lapd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/hummerh2_lasd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/rescue_truck01_lapd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/rescue_truck02_lapd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/swat_armoured_vehicle.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/swat_truck.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/05 US Army/hmmwv.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/05 US Army/us_army_truck.e4p") == 0) return true; return false; } } Quote Link to comment Share on other sites More sharing options...
itchboy Posted April 12, 2019 Report Share Posted April 12, 2019 You inputted too many vehicles, it looks like. Those conditions only allow for maybe 8 or 9 conditions in the "if" section. You will have to split up the vehicles, or do a different setup like this. Quote Link to comment Share on other sites More sharing options...
The Loot Posted April 22, 2019 Report Share Posted April 22, 2019 I found that the simplest way to do it was to make dummy commands and assign them to any applicable vehicle, which the equipment script would then check for. object FlagHasBarricade : CommandScript { FlagHasBarricade() { SetGroupID(20); } bool CheckGroupVisibility(GameObject *Caller) { return false; } bool CheckPossible(GameObject *Caller) { return false; } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { return false; } void PushActions(GameObject *Caller, Actor *Target, int childID) { } }; And then in the script CheckTarget section, just add this: if (!Target->HasCommand("FlagHasBarricade")) return false; It makes it very simple to add new vehicles later: just add the dummy command and they're all set. Quote Link to comment Share on other sites More sharing options...
BxPanxi Posted May 10, 2019 Author Report Share Posted May 10, 2019 Alright so I'm having a few troubles. I tried to do it again and now it says theres an error with the parenthesis. I don't know what's wrong here? @itchboy And, @The LootI'm not really the best at this stuff so I didn't get what you meant by that script at all, sorry! if (v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_lapd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_lapp.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol1.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol2.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol4.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol6.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/rescue_truck02_lapd.e4p") == 0 return true; return false; } } void PushActions(GameObject *Caller, Actor *Target, int childID) { Vector TargetPos = Target->GetTargetPoint(Caller, TARGET_EQUIPMENTDOOR); Caller->PushActionMove(ACTION_NEWLIST, TargetPos); Caller->PushActionTurnTo(ACTION_APPEND, Target); Caller->PushActionGetEquipment(ACTION_APPEND, Target, EQUIP_NONE); Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_BARRICADE, Target, 1, false); } }; object PcmdBarricadeRemove : CommandScript { PcmdBarricadeRemove() { SetIcon("policebarricaderemove"); SetCursor("policebarricaderemove"); SetValidTargets(ACTOR_VEHICLE | ACTOR_OBJECT); SetRestrictions(RESTRICT_NOTDESTROYED | RESTRICT_NOTBURNING | RESTRICT_HASROADBLOCK); SetPossibleCallers(ACTOR_PERSON); SetNeedsCarWithFlagSet(OF_HAS_ROADBLOCK); } /*bool CheckPossible(GameObject *Caller) { if(!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON) return false; Person p(Caller); if (p.IsCarryingPerson()||p.IsLinkedWithPerson()|| p.GetFirehoseID()!=0 || p.IsPulling()) return false; if (!Game::ExistsNormalObjectWithFlagSet(OF_HAS_ROADBLOCK)) return false; return true; }*/ bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { if(!Caller->IsValid() || !Target || !Target->IsValid() || Target->GetType()!=ACTOR_VEHICLE) return false; if(Caller->GetObjectType()==TYPE_PERSON) { Person p(Caller); Vehicle v(Target); if (v.IsDestroyed()) return false; if(p.IsValid() && (p.IsLinkedWithPerson() || p.IsCarryingPerson() || p.IsEquipped() || p.IsPulling() || p.GetFirehoseID()!=0 || p.GetEnteredCarID() != -1)) return false; Vehicle v(Target); if (v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_lapd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_lapp.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol1.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol2.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol4.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol6.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/rescue_truck02_lapd.e4p") == 0 return true; return false; } } Quote Link to comment Share on other sites More sharing options...
itchboy Posted May 10, 2019 Report Share Posted May 10, 2019 You are missing a parenthesis after the "0" of rescue_truck02_lapd. Quote Link to comment Share on other sites More sharing options...
BxPanxi Posted May 11, 2019 Author Report Share Posted May 11, 2019 @itchboyHey! Thanks for you response, I think I got it fixed, haven't tested it yet because of problems with resolution but thank you! Quote Link to comment Share on other sites More sharing options...
BxPanxi Posted May 11, 2019 Author Report Share Posted May 11, 2019 Alright seems what I did didn't work. What happened here..? @itchboy if (v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_lapd.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_lapp.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol1.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol2.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol4.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/cv_patrol6.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/rescue_truck02_lapd.e4p") == 0) return true; return false; } } } Quote Link to comment Share on other sites More sharing options...
itchboy Posted May 12, 2019 Report Share Posted May 12, 2019 There seems to be nothing wrong with it. Can you upload the rest of the script? Quote Link to comment Share on other sites More sharing options...
BxPanxi Posted August 6, 2019 Author Report Share Posted August 6, 2019 @itchboy I'm sorry! I don't usually visit the website since I always think it's dead in 2012. My bad. I actually kind of forgot about the problem here, it seems to have fixed itself, or something. It shouldn't matter though since I am getting Emergency 5 so, yeah. Quote Link to comment Share on other sites More sharing options...