Author Topic: Modifying ShootOnClick to Work on Remote Vehicles  (Read 887 times)

I've been making an RC plane that has machine guns, like the one from GTA San Andreas.  So far I've completed the model and despite the vehicle's tire spring needing work it's done.  The problem I'm having is while the vehicle's guns work when spawned from a brick and with the player mounted inside it, it doesn't work when the player is made the controlobject of the vehicle (and not actually mounted in it).

Is there a way I can make the control object of a vehicle be able to call the function onTrigger the same way a player in the driver's seat can?


I used NiXiLL's ShootOnClick script to make it have machine guns on both of its wings
http://forum.blockland.us/index.php?topic=51249.msg821575#msg821575

I modified Bushido's RC Sapper code to make it spawn my vehicle instead of the RC car
http://forum.blockland.us/index.php?topic=133926.msg3009776#msg3009776


You'll have to package armor::onTrigger to add the functionality you want. I don't have time to write the code for you (seeing as you're probably not experienced enough to handwrite your own code for this), maybe someone else will.


package YourPackage
{
   function Armor::onTrigger(%datablock,%player,%slot,%val)
   {
      Parent::onTrigger(%datablock,%player,%slot,%val);
      // 0 = fire
      // 2 = jump
      // 3 = crouch
      // 4 = jet
      if(%slot == 4 && %val && %player.getMountedImage(0) == nameToID(YourControllerImage))
      {
         //Vehicle Data
         //
         //
         %player.setControlObject(%yourVehicle);
      }
   }
};
activatePackage(YourPackage);


This is just a start, the "//Vehicle Data" stuff is where to put vehicle/aiplayer data.

You will need to write the other side of the controller if you want to go back to yourself. Otherwise you would be stuck.
« Last Edit: March 25, 2014, 03:22:17 AM by Advanced Bot »