In this recipe, we will do something fun with the car and attach a machine gun to the vehicle and have it be fired from the driver's seat.
Complete the Creating a new car XML recipe. Then open MyVehicle.xml
in Notepad or an equivalent editor. Delete the following cells from MyVehicle.xml
:
<Weapons> <Primary/> </Weapons> <ActionParts/>
In the cells that were just deleted (as they were obsolete), copy the following lines:
<SeatActions> <SeatAction class="Weapons"> <Weapons isSecondary="0"> <Weapons> <Weapon class="AsianCoaxialGun" part="body"> <Helpers> <Helper value="mgun_out"/> </Helpers> </Weapon> </Weapons> </Weapons> </SeatAction> </SeatActions>
The newly added <SeatAction>
tag is used for any weapons that are made for the vehicles. The weapon itself can use a helper to fire from and if the weapon is set up on a part, then the weapon will rotate with that part as well (such as a turret).
The flag of isSecondary
handles whether the weapon is fired from the primary fire button or if it uses the secondary fire button.
3.14.144.216