Jump to content
Xplorer4x4

Adding Bomb Robot to Other Vehcihles

Recommended Posts

I am trying to modify the SWAT Heavy Rescue into an LAPD Bomb Squad truck as LAPD has a similar truck. I cant quite figure out the correct code for it but i should be close.

Heres what I tried:

if (StrCompare(v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_bomb_squad.e4p") == 0) || (v.IsValid() && !v.IsDestroyed() || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/pierce_bomb_squad.e4p") == 0))

if (StrCompare(v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_bomb_squad.e4p") == 0) && (v.IsValid() && !v.IsDestroyed() || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/pierce_bomb_squad.e4p") == 0))

if (v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_bomb_squad.e4p") == 0 && v.IsValid() || !v.IsDestroyed() || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/pierce_bomb_squad.e4p") == 0)

if (v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_bomb_squad.e4p") == 0 && v.IsValid() && !v.IsDestroyed() || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/pierce_bomb_squad.e4p") == 0)

So far none of these have worked but none have crashed my game. Any ideas?

Link to comment
Share on other sites

I am trying to modify the SWAT Heavy Rescue into an LAPD Bomb Squad truck as LAPD has a similar truck. I cant quite figure out the correct code for it but i should be close.

Heres what I tried:

So far none of these have worked but none have crashed my game. Any ideas?

Can't you just add the commands from the bomb squad truck to the swat truck and delete the swat commands? Also just delete the swat personel and add the bomb squad personel to the vehicle. That should do the trick I think.

Link to comment
Share on other sites

No, there is no command for the actual vehicles regarding the robot. When i checked the bomb squad suv it just had a few simple commands like vcmdlfashing light, hazard light,return to HQ, and like two more generic commands. BTW, The swat heavy rescue doesnt have deploy swat commands or anything like that. Im talking about this SWAT truck btw:

http://farm4.static.flickr.com/3410/363818..._a9976572bb.jpg

Link to comment
Share on other sites

LABombRobot.script

Yes there is one... it includes :

// - PcmdRobotGet

// - PcmdRobotRemove

// - PcmdRobotSendTo

// - PcmdRobotUse

// - PcmdDummyRobot

part in regards to the getting of the robot from what vehicle...

Vehicle v(Target);
if (v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_bomb_squad.e4p") == 0)
{
return true;
}
return false;

I do believe that's it

Link to comment
Share on other sites

Well let me rephrase that, theres no command to simply put the robot in a vehicle. Then again there never is for equipment so I suppose that makes since. Nor is there a simple option to add it in the equipment section of the unit.xml because the bomb squad SUV has no equipment listed in the unit.xml.

Link to comment
Share on other sites

Well let me rephrase that, theres no command to simply put the robot in a vehicle. Then again there never is for equipment so I suppose that makes since. Nor is there a simple option to add it in the equipment section of the unit.xml because the bomb squad SUV has no equipment listed in the unit.xml.

Isn't it automaticly spawned when you click the right vehicle with the bomb squad guy?

So if you added the swat truck to the list of vehicles and you select that vehicle with the bomb squad guy it should display a 'get robot' command. Since the bomb squad guy isn't holding the robot I'm guessing the robot just spwans next to the vehicle. I'm not sure you need to add it as equipment to the vehicle.

Link to comment
Share on other sites

No it has to be coded in to the script. It cant just be added to freeplaybase. Otherwise, you can get the bomb squad guy out of the truck, click get bomb robot, but when you hover over the truck the icon gets a big red X on it, where as it doesnt have the red X on the bomb suqd suv even if I got the guy out of the SWAT truck.

Its not considered equipment in terms of a unit.xml file.

Link to comment
Share on other sites

No it has to be coded in to the script. It cant just be added to freeplaybase. Otherwise, you can get the bomb squad guy out of the truck, click get bomb robot, but when you hover over the truck the icon gets a big red X on it, where as it doesnt have the red X on the bomb suqd suv even if I got the guy out of the SWAT truck.

Its not considered equipment in terms of a unit.xml file.

I didn't say you could 'just' add it to the freeplay base. Of course you would have to at least at the SWAT van to the 'getrobot' script and you would have to change the units file so that the swat van can carry bomb squad guys.

Link to comment
Share on other sites

My bad. You said"So if you added the swat truck to the list of vehicles" so i thought you meant just the freeplaybase. The section of code I am modifying IS from the get robot script, and thats why I posted this thread as I cant quite figure out how to get the script to recognize both vehicles. The unit folder and xml is done. The truck in game and working fine except for housing the robot on it.

Link to comment
Share on other sites

My bad. You said"So if you added the swat truck to the list of vehicles" so i thought you meant just the freeplaybase. The section of code I am modifying IS from the get robot script, and thats why I posted this thread as I cant quite figure out how to get the script to recognize both vehicles. The unit folder and xml is done. The truck in game and working fine except for housing the robot on it.

Strange, I have a paper due next week, but after that I'll try and look into it.

Link to comment
Share on other sites

Alright. Because I had a good time at school today I will write a full explanation of this simple code:

Vehicle v(Target);
if (v.IsValid() && !v.IsDestroyed() && StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_bomb_squad.e4p") == 0)
{
return true;
}
return false;

What does this means in normal words?:

Vehicle v(Target); The target of the command is a vehicle and defined as 'v'.

Then you get 'if' and a '(' as the opening symbol.

The code can be read as: "if v is valid AND v is NOT destroyed AND v has the same prototype as 'suv_bomb_squad.e4p'".

If these checks return true the command will be executed (return true;) if one of these codes do not return true it won't (return false;)

Theory (homework):

The && symbols litteraly means AND

A ! symbol means the opposide and can be read as NOT

Not present in the code above but also important: || symbols litteraly means OR

StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/swat_truck.e4p") == 0 is 1 code (comparison function) and should not be changed.

So what do you need to do?

Instead of comparing v to only 1 prototype it also needs to compare it to the swat truck. To make the code return true v needs to either match suv_bomb_squad.e4p OR swat_truck.e4p.

So the new code is going to be:

Vehicle v(Target);
if (v.IsValid() && !v.IsDestroyed() && (StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/suv_bomb_squad.e4p") == 0 || StrCompare(v.GetPrototypeFileName(), "mod:Prototypes/Vehicles/03 LA Police/swat_truck.e4p") == 0))
{
return true;
}
return false;

Notice the || symbols, because v needs to match one of them and not both. If you would have used the && symbols instead of || the code can never return true because it can't much two prototypes, but only 1 of them.

Link to comment
Share on other sites

Thanks, Hoppah. I knew that the symbols mentioned(|| and &&) were needed to make an "or" but couldnt recal which was which, and I knew about ! all through years of working with php but I havent worked with php much for a year or two, so I am bit rusty, However I didnt quite read the V(traget) right when I was reading the code but i get it know.

I wasnt as close as I thought, but I was on the right track. Thanks a million Hoppah! Keep up the good work.

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