Author Topic: Player Vehicles  (Read 1477 times)

Is it possible to mount weapons onto a Player vehicle? I tried it with the Warplane and it dosent work.

Boat much? I'm not sure how to make it work but it would involve mounting an weapon image to a mount point, now if you're trying to make cannons on a boat which I'm pretty sure you are, your gonna keep running into more problems making it shoot sideways.

When you say player vehicle do you mean just a vehicle, or a player with the vehicle datablock?
If you don't already have the weapon image:
Code: [Select]
//projectile
datablock ProjectileData(YourWeaponProjectile)
{
   projectileShapeName = "~/data/shapes/laser.dts";
   directDamage        = 10;
   radiusDamage        = 10;
   damageRadius        = 0.5;
   explosion           = YourWeaponExplosion;

   muzzleVelocity      = 200;
   velInheritFactor    = 0;

   armingDelay         = 0;
   lifetime            = 80000;
   fadeDelay           = 75000;
   bounceElasticity    = 0;
   bounceFriction      = 0;
   isBallistic         = true;
   gravityMod = 0;

   hasLight    = true;
   lightRadius = 3.0;
   lightColor  = "0.9 0 0";
};
Code: [Select]
datablock ShapeBaseImageData(YourWeaponImage) {
   shapeFile = "~/data/shapes/blank.dts";
   emap = true;
   offset = "3.21 2.8 -0.27";
   correctMuzzleVector = false;
   className = "WeaponImage";
   mountPoint = 0;
   ammo = " ";
   projectile = YourWeaponProjectile;
   projectileType = Projectile;

   // Initial start up state
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]       = "Ready";

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Fire";
stateAllowImageChange[1]         = true;

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Reload";
stateTimeoutValue[2]            = 0.05;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateSound[2] = YourWeaponFireSound;

stateName[3] = "Reload";
stateSequence[3]                = "Reload";
stateAllowImageChange[3]        = false;
stateTimeoutValue[3]            = 0.1;
stateWaitForTimeout[3] = true;
stateTransitionOnTimeout[3]     = "Check";

stateName[4] = "Check";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";

stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateScript[5]                  = "onStopFire";
};
I your vehicle already has an on add function, scroll down to it and add the following code:
Code: [Select]
%obj.mountImage(YourWeaponImage,MountPointNumber);If you don't already have an on add function add this at the bottom of your code:
Code: [Select]
function YourVehicle::onAdd(%data, %obj)
{
  %obj.mountImage(YourWeaponImage,0);
}

Edit:
Boat much? I'm not sure how to make it work but it would involve mounting an weapon image to a mount point, now if you're trying to make cannons on a boat which I'm pretty sure you are, your gonna keep running into more problems making it shoot sideways.

Yeah if you are talking about cannons on your Galleon or whatevah ship it was, I suggest not, mounting the weapons straight would be easy, just the amount of lagg caused from firing once would be very, very painful.
« Last Edit: April 19, 2008, 06:36:48 PM by Destiny/Zack0Wack0 »

umm no its something diffrent. I mean player Datablock

You sure that didnt work to? Because when the players datablock is turned into another datablock, it uses the other datablocks mounts.. so it should..

nope. I think you need to use weapon slots

It would probably be better to make the weapon part of the model's animations and have them play when you press a button, spawning a projectile, rather than mounting weapon images.

Code: [Select]
function YourVehicle::onAdd(%data, %obj)
{
  %obj.mountImage(YourWeaponImage,0);
}
If you don't want things to break, I'd suggest having parent::onAdd(%data, %obj); in there.

Yeah if you are talking about cannons on your Galleon or whatevah ship it was, I suggest not, mounting the weapons straight would be easy, just the amount of lagg caused from firing once would be very, very painful.
I've got multiple weapon images of a missile launcher mounted to a Destroyer, they don't cause lag. All you have to do is set their imagetrigger to 1 for a while.

There's my Para, mounted onto the front of a jeep, with a little modification of the warplane script (Credits to whoever made it), It fires for a second, enough to give most opponents an overdose of lead before flattening them.

aloshi made the warplane, also i wonder if you can like make a gun point to where your looking in a vehicle...

1. Press Q.
2. Enter 1st person.
3. Click mouse1.
4. ??????
5. Profit!
:cookieMonster:

It would still be better if you see rocketlaunchers and pistols on jeeps :P

I did that before I had even thought of making the Para and Galil.

You'll notice the grenade-launcher I mounted to the jeep. It turns out that in 3rd person, a projectile affected by gravity will launched from the muzzlepoint of the launcher, and in 1st person, it launches in the direction of the eyenode.