Is there a script to go with it? I don't want just a turret. I can do that.
I want a turret on a vehicle. I have a turret, I have a vehicle. So where's the /superglue command?
function WarthogVehicle::onAdd(%this,%obj)
{
// Setup the car with some defaults tires & springs
for(%i = 0; %i < %this.numWheels; %i++)
{
%obj.setWheelTire(%i, %this.defaultTire);
%obj.setWheelSpring(%i, %this.defaultSpring);
}
// 4 wheel steering
%obj.setWheelSteering(0,1);
%obj.setWheelSteering(1,1);
%obj.setWheelSteering(2,-1);
%obj.setWheelSteering(3,-1);
// 4 wheel drive
%obj.setWheelPowered(0,true);
%obj.setWheelPowered(1,true);
%obj.setWheelPowered(2,true);
%obj.setWheelPowered(3,true);
// gatt
%t = new AIPlayer()
{
dataBlock = WarthoggattPlayer;
};
MissionCleanup.add(%t);
%obj.mountObject(%t, 2);
%obj.gatt = %t;
%obj.creationTime = getSimTime();
%t.schedule(10,"riggatt");
}
function Player::riggatt(%obj)
{
if(%obj.dataBlock !$= WarthoggattPlayer)
return;
if(!isObject(%obj))
return;
%parent = %obj.getObjectMount();
if(!isObject(%parent))
return;
%obj.spawnBrick = %parent.spawnBrick;
%obj.brickGroup = %parent.brickGroup;
}
function WarthogVehicle::onRemove(%this,%obj)
{
if(isObject(%obj.gatt))
%obj.gatt.delete();
}
function WarthoggattPlayer::onDriverLeave(%this,%obj)
{
%obj.setTransform("0 0 0 0 0 0 0");
}
package WarthogPackage
{
function serverCmdNextSeat(%client)
{
if(!isObject(%client.player.getObjectMount()))
return;
%vehicle = %client.player.getObjectMount();
if(!%vehicle.dataBlock.rideable)
return;
%totalMounts = 0;
if(isObject(%vehicle.getObjectMount()))
{
%totalMounts = 1;
%mount0 = %vehicle.getObjectMount();
}
%mount[%totalMounts] = %vehicle;
%totalMounts++;
for(%i=0;%i<%vehicle.dataBlock.numMountPoints;%i++)
{
%mountedObject = %vehicle.getMountNodeObject(%i);
if(%mountedObject !$= 0)
{
if(%mountedObject.dataBlock.rideable)
{
%mount[%totalMounts] = %mountedObject;
%totalMounts++;
}
}
}
%seats = 0;
for(%i=0;%i<%totalMounts;%i++)
{
%mVehicle = %mount[%i];
for(%j=0;%j<%mVehicle.dataBlock.numMountPoints;%j++)
{
%mMount = %mVehicle.getMountNodeObject(%j);
%seat[%seats] = ((%i+1)*100)+%j;
if(isObject(%mMount))
{
if(%mMount $= %client.player)
%currSeat = %seats;
}
else
%freeSeats++;
%seats++;
}
}
if(%freeSeats < 1)
return;
%sId = %currSeat+1;
if(%sId >= %seats)
%sId = 0;
while(%foundSeat $= "")
{
%seatStr = %seat[%sId];
%cVehicle = %mount[getSubStr(%seatStr,0,1)-1];
%searchSeat = getSubStr(%seatStr,2,1);
if(%cVehicle.getMountNodeObject(%searchSeat) $= 0)
{
%foundSeat = %searchSeat;
break;
}
%sId++;
if(%sId >= %seats)
%sId = 0;
%k++;
if(%k > 100)
return;
}
%cVehicle.mountObject(%client.player,%foundSeat);
}
function serverCmdPrevSeat(%client)
{
if(!isObject(%client.player.getObjectMount()))
return;
%vehicle = %client.player.getObjectMount();
if(!%vehicle.dataBlock.rideable)
return;
%totalMounts = 0;
if(isObject(%vehicle.getObjectMount()))
{
%totalMounts = 1;
%mount0 = %vehicle.getObjectMount();
}
%mount[%totalMounts] = %vehicle;
%totalMounts++;
for(%i=0;%i<%vehicle.dataBlock.numMountPoints;%i++)
{
%mountedObject = %vehicle.getMountNodeObject(%i);
if(%mountedObject !$= 0)
{
if(%mountedObject.dataBlock.rideable)
{
%mount[%totalMounts] = %mountedObject;
%totalMounts++;
}
}
}
%seats = 0;
for(%i=0;%i<%totalMounts;%i++)
{
%mVehicle = %mount[%i];
for(%j=0;%j<%mVehicle.dataBlock.numMountPoints;%j++)
{
%mMount = %mVehicle.getMountNodeObject(%j);
%seat[%seats] = ((%i+1)*100)+%j;
if(isObject(%mMount))
{
if(%mMount $= %client.player)
%currSeat = %seats;
}
else
%freeSeats++;
%seats++;
}
}
if(%freeSeats < 1)
return;
%sId = %currSeat-1;
if(%sId < 0)
%sId = %seats--;
while(%foundSeat $= "")
{
%seatStr = %seat[%sId];
%cVehicle = %mount[getSubStr(%seatStr,0,1)-1];
%searchSeat = getSubStr(%seatStr,2,1);
if(%cVehicle.getMountNodeObject(%searchSeat) $= 0)
{
%foundSeat = %searchSeat;
break;
}
%sId--;
if(%sId < 1)
%sId = %seats-1;
%k++;
if(%k > 100)
return;
}
%cVehicle.mountObject(%client.player,%foundSeat);
}
function Player::burn(%obj,%time)
{
if(%obj.dataBlock $= WarthoggattPlayer)
return;
else
Parent::burn(%obj,%time);
}
function ShapeBase::setNodeColor(%obj,%node,%color)
{
parent::setnodecolor(%obj,%node,%color);
if(isObject(%obj.gatt))
{
%obj.gatt.setNodeColor("ALL",%color);
}
}
function WarthogVehicle::Damage(%this,%obj,%source,%pos,%amm,%type)
{
if((%obj.getDamageLevel()+%amm) >= %this.maxDamage)
{
if(%obj.destroyed)
return;
%obj.setNodeColor("ALL","0 0 0 1");
if(isObject(%obj.gatt))
{
%obj.gatt.delete();
%p = new Projectile()
{
dataBlock = WarthoggattExplosionProjectile;
initialPosition = vectorAdd(%obj.getPosition(),"0 0" SPC %this.initialExplosionOffset);
initialVelocity = "0 0 1";
client = %obj.lastDamageClient;
sourceClient = %obj.lastDamageClient;
};
MissionCleanup.add(%p);
}
else
{
%p = new Projectile()
{
dataBlock = WarthogExplosionProjectile;
initialPosition = vectorAdd(%obj.getPosition(),"0 0" SPC %this.initialExplosionOffset);
initialVelocity = "0 0 1";
client = %obj.lastDamageClient;
sourceClient = %obj.lastDamageClient;
};
MissionCleanup.add(%p);
}
if(%obj.destroyed)
return;
%obj.setDamageLevel(%this.maxDamage);
%obj.destroyed = 1;
%obj.schedule(%this.burnTime,"finalExplosion");
if(isObject(%obj.spawnBrick.client.minigame))
%respawn = %obj.spawnBrick.client.minigame.vehicleReSpawnTime;
%obj.spawnBrick.schedule(%respawn,"spawnVehicle");
}
else
Parent::Damage(%this,%obj,%source,%pos,%amm,%type);
}
function Player::emote(%obj,%emote)
{
if(%obj.dataBlock $= WarthoggattPlayer)
return;
Parent::emote(%obj,%emote);
}
function WarthoggattPlayer::onDamage(%this,%obj,%ammount)
{
if(%obj.dataBlock $= WarthoggattPlayer)
return;
Parent::onDamage(%this,%obj,%ammount);
}
function WarthogShellProjectile::onCollision(%this,%obj,%col,%a,%b,%c,%d,%e)
{
if(%col.dataBlock.className $= "Glass" && !%col.indestructable)
{
%col.explode();
}
Parent::onCollision(%this,%obj,%col,%a,%b,%c,%d,%e);
}
function WarthoggattPlayer::onDisabled(%this,%obj,%state)
{
%p = new Projectile()
{
dataBlock = WarthoggattExplosionProjectile;
initialPosition = vectorAdd(%obj.getObjectMount().getPosition(),"0 0" SPC %obj.getObjectMount().dataBlock.initialExplosionOffset);
initialVelocity = "0 0 1";
client = %obj.lastDamageClient;
sourceClient = %obj.lastDamageClient;
};
MissionCleanup.add(%p);
%obj.schedule(10,"delete");
%player = %obj.getMountedObject(0);
if(isObject(%player))
{
%obj.getObjectMount().schedule(10,"mountObject",%player,2);
}
}
function WarthoggattPlayer::Damage(%this,%obj,%source,%pos,%amm,%type)
{
//scale the damage ammount as if this was a vehicle
%amm *= $Damage::VehicleDamageScale[%type];
if(%obj.getDamageLevel()+%amm > %this.maxDamage)
%obj.setDamageLevel(%this.maxDamage);
else
Parent::Damage(%this,%obj,%source,%pos,%amm,%type);
}
function armor::onMount(%this,%obj,%col,%slot)
{
Parent::onMount(%this,%obj,%col,%slot);
if(%col.dataBlock $= WarthogVehicle)
{
if(%slot $= 2)
{
%obj.setLookLimits(1,0);
}
}
else if(%col.dataBlock $= WarthoggattPlayer)
{
%client = %obj.client;
if(isObject(%client))
ServerCmdUnUseTool(%client);
}
}
};
activatepackage(WarthogPackage);
I do shooting seperate