Author Topic: How do you make a weapon that can only be while in a vehicle?  (Read 695 times)

I just want to modify the homing rocket to only work while you're in a vehicle.

WeaponImage::onMount(%data,%player,%slot) <- called when you hold your "WeaponImage"

Parent::onMount(%data,%player,%slot); if %player.getObjectMount() exists
otherwise return

Assuming you don't know how to code, I'll go ahead and just make that into a block of code you can just paste into the end of the cs file.

Code: [Select]
package vehicleHRL
{
   function WeaponImage::onMount(%data,%player,%slot)
   {
       if(isobject(%player.getObjectMount()))
          parent::onMount(%data,%player,%slot);
   }
};
activatePackage(vehicleHRL);
All you have to do is paste that in and change the text of "weaponImage" to the name of the image datablock for the weapon. It would probably be called homingRLImage or something, you'll have to find it in the script.

-Snip-
Nice spoon you have there.

With that code, if you get in a vehicle, equip the item, then get back out you can keep it and use it freely. Run a trace while your dismounting a vehicle and find the function that handles dismounting, package that, check if your holding the item, if so then remove it or unequip it or something.