PDA

View Full Version : About vehicles



guiismiti
29th August 2014, 00:16
Hey

I've been trying to modify the united noobs vehicle mod, and I was wondering... why aren't vehicles used in the original maps?
I know there are a lot of anti-glitch invisible walls, so, wouldn't be good to use a plane, but what about the jeeps? is it possible? Would be really fun to play some maps with those.

Loveboy
29th August 2014, 12:58
Hello guiismiti!

It's surely possible to play with jeeps in original maps, but I wouldn't do that, because the maps are small and full of buildings.
It's better if you do an own map: big, free of buildings and some grass on the ground.

guiismiti
29th August 2014, 20:27
I've been reading the scripts and can't find the link between the vehicles and the maps where the vehicles are enabled.
Why is it that the original maps can't be loaded?

I'm gonna try to enable jeeps in toujane and carentan - and disable the damage from collision depending on mapname :) I don't think I'll need help for this but, still need to know what to do for it to be enabled.

What I understood so far is, all vehicles are weapons (planes are grenades that explode on collision), just like sprint.

I'm gonna keep reading, thanks in advance.

serthy
30th August 2014, 08:47
iirc the un vehicle mod uses the ctf-flags to calculate the vehicle spawn positions. this is because their mod originally should work only on their custom map mp_libya.
however you can load the un mod on standard maps, but the vehicles will spawn outside of the map. you should rewrite the entire mod, as the un mod has such a bad performance anyways.

PUNISH ME (http://killtube.org/showthread.php?1624-DOWNLOAD-COD2-TANKs&highlight=tank)

guiismiti
9th September 2014, 20:52
Well, almost everything is working. I'm using vehicles in TDM with bots (bots don't know how to use it, ofc, they will be there just to get some people into the server)
The maps I'm using - mp_iceberg_v2 (planes and AA only), mp_iwo_jima_1, mp_gunslingers, zzz_vokbeta
and also El Alamein (planes and AA only - it's not bad for planes - no buildings, map limits are far away).

For the AA and jeep spawns I simply used fixed positions I chose in game.

I'm stuck with the following problem, though - when I eject from a plane and immediately try to use an AA / jeep, I don't get attached.
When plane pilots eject, the plane falls, explodes and, after a few seconds, it's removed.
What is happening exactly - I eject, I open the chute, I use an AA or jeep.
If the plane is still in the map (still in the air, falling, or on the ground, blown up), I don't get attached.
After the plane is removed, I get properly attached.
I noticed that, if I leave the AA and use it again while the plane is still in the map, I get attached properly.

I tested the original mod, it's CTF with random relative spawns around the flag. The bug does not happen then.
But if I set fix locations for the spawns, the bug will happen.

Can anybody help, please?

Here is the code for aa_spawn.
What has changed is this:

aa = spawn( "script_model", aaorigin );

That used to be like this:

aa = spawn( "script_model", origin );

I'm now giving the function the location for the spawn, instead of letting it get a random one.


aa_spawn(team, plusAngles, aaorigin)
{
self endon("intermission");

if( !isDefined( team ) )
team = "axis";
if( !isDefined( plusAngles ) )
plusAngles = (0,0,0);

alliedf = getentarray("allied_flag", "targetname");
axisf = getentarray("axis_flag", "targetname");

originAllied = alliedf[0] getOrigin();
originAxis = axisf[0] getOrigin();

temp = (0,0,0);
if( team == "axis" )
{
tempOrigin = originAxis;
temp = vectorToAngles( originAxis - originAllied );
}
else
{
temp = vectorToAngles( originAllied - originAxis );
tempOrigin = originAllied;
}

tempF = anglesToForward( temp );

temp = vector_scale( tempF, randomIntRange( level.aaMinFarBack,level.aaMaxFarBack) );

temp += tempOrigin;

origin = temp;

wait( randomIntRange( 2,4 ) );

x = randomIntRange( level.aaMinX, level.aaMaxX);
y = randomIntRange( level.aaMinY, level.aaMaxY);

trace = bulletTrace( origin + (x,y,500), origin - (x, y, 11500 ), false, undefined );
origin = trace["position"] ;

aa = spawn( "script_model", aaorigin );
aa setModel( game["aa"] );
aa show();

aa.cannonRounds = [];
//aa.properties = [];

anglesF = anglesToForward( aa.angles );
anglesR = anglesToRight( aa.angles );
anglesU = anglesToUp( aa.angles );


// GUNS GUNS GUNS
aa.properties["gun0"]["f"] = 100;
aa.properties["gun0"]["r"] = -19;
aa.properties["gun0"]["u"] = 56.5;

aa.properties["gun1"]["f"] = 100;
aa.properties["gun1"]["r"] = 19;
aa.properties["gun1"]["u"] = 39.5;


aa.properties["gun2"]["f"] = 100;
aa.properties["gun2"]["r"] = -19;
aa.properties["gun2"]["u"] = 40;

aa.properties["gun3"]["f"] = 100;
aa.properties["gun3"]["r"] = 19;
aa.properties["gun3"]["u"] = 56;

maxRounds = 20;

aa.cannonRounds[ aa.cannonRounds.size ] = maxRounds;
aa.cannonRounds[ aa.cannonRounds.size ] = maxRounds;
aa.cannonRounds[ aa.cannonRounds.size ] = maxRounds;
aa.cannonRounds[ aa.cannonRounds.size ] = maxRounds;

/////////////////////////////////////

// GUNNER
aa.properties["gunner"]["f"] = -30;
aa.properties["gunner"]["r"] = 1;
aa.properties["gunner"]["u"] = 20;


aa.gunner = undefined;
aa.gunner = undefined;

// END GUNNER

aa.fireSetting = 1;
aa.team = team;
aa.weaponName = "aa_mp";
aa.angles += plusAngles;
aa.plusAngles = plusAngles;
aa.damage = 0;
aa.maxDamage = level.aaMaxDamage;
aa.vehicleType = "aa";
aa thread scriptedTrigger( 75.0);
aa thread onTrigger( );
aa thread trackDamage(aaorigin);
}



And this is spawn_jeep. New spawn location called jeeporigin now


spawn_jeep( team, jeeporigin )
{

origin = (-39200, 11383, -320);

if( team == "allies")
spawnpointname = "mp_ctf_spawn_allied";
else
spawnpointname = "mp_ctf_spawn_axis";

sp = getentarray(spawnpointname, "classname");


for(j = 0; j < 1; j++ )
{

temp = sp[ randomIntRange(0, sp.size -1) ];

x = randomIntRange(1,2400);
y = randomIntRange( 1,2400 );
trace = bulletTrace( temp.origin + (x,y,550),temp.origin - (x,y,1000), false, undefined );

origin = trace["position"];

jeeps = level.jeeps;
gdist = true;
for(i = 0; i < jeeps.size; i++ )
{
if( !isDefined( jeeps[i] ) )
continue;

dist = distance( jeeps[i] getOrigin(), origin);
dist2 = distance( origin, temp.origin );

itemp = origin[2] - temp.origin[2];
if( ( itemp > -120 && itemp < 120 ) & dist > 1000 && dist2 > 140 )
{
gdist = false;
break;

}
}

if( gdist == true )
break;

wait(0.1);

}
wait 1;

origin = getRandomSpawn( team,80, 700 );

jeep = spawn("script_model", jeeporigin );

jeep setModel( game["jeep" + team] );
jeep show();

jeep.teamAlt = team;
anglesF = anglesToForward( jeep.angles );
anglesR = anglesToRight( jeep.angles );

temp = vector_scale( anglesR, -18);
temp += vector_scale( anglesF, -14);
jeep.driverTag = spawn("script_origin", jeep getOrigin() + (0,0,10 ));
jeep.driverTag linkTo(jeep);

//***********************************
// passenger location
//***********************************
if( team == "axis" )
temp = vector_scale( anglesF, -45);
else
temp = vector_scale( anglesF, -50);

jeep.passenger1Tag = spawn("script_origin", jeep getOrigin() + temp + (0,0,15 ));
jeep.passenger1Tag linkTo(jeep);

//***********************************
// turret Back passenger location
//***********************************
temp = vector_scale( anglesF, -50);

turrets = getentarray ("misc_turret","classname");

//***********************************
// Front Left Tire
//***********************************
temp = vector_scale( anglesF, 50 );
tireOrigin = origin + temp;

temp = vector_scale( anglesR, -25 );
tireOrigin += temp;

jeep.frontLeftTire = spawn("script_origin", tireOrigin + (0,0,1) );
jeep.frontLeftTire linkTo( jeep );

//***********************************
// Front Right Tire
//***********************************
temp = vector_scale( anglesF, 50 );
tireOrigin = origin + temp;

temp = vector_scale( anglesR, 25 );
tireOrigin += temp;

jeep.frontRightTire = spawn("script_origin", tireOrigin + (0,0,1) );
jeep.frontRightTire linkTo( jeep );

//***********************************
// Back Left Tire
//***********************************
temp = vector_scale( anglesF, -40 );
tireOrigin = origin + temp;

temp = vector_scale( anglesR, -25 );
tireOrigin += temp;


jeep.backLeftTire = spawn("script_origin", tireOrigin + (0,0,1) );
jeep.backLeftTire linkTo( jeep );

//***********************************
// Back Right Tire
//***********************************
temp = vector_scale( anglesF, -40 );
tireOrigin = origin + temp;

temp = vector_scale( anglesR, 25 );
tireOrigin += temp;

jeep.backRightTire = spawn("script_origin", tireOrigin + (0,0,1) );
jeep.backRightTire linkTo( jeep );

maxspeed = getCvarInt("dvar_jeepMaxSpeed");
minspeed = getCvarInt("dvar_jeepMinSpeed");
if( maxspeed == 0 )
maxspeed = 40;
if( minspeed == 0 )
minspeed = -30;


jeep.sounds = [];
jeep.sounds[0] = "jeep_start";
jeep.sounds[1] = "jeep_idle";
jeep.sounds[2] = "jeep_move";
jeep.sounds[3] = "jeep_horn";
jeep.sounds[4] = "jeep_crash";

jeep.team = team;
jeep.speed = 0;
jeep.maxSpeed = maxspeed;
jeep.minSpeed = minspeed;
jeep.jeepAngle = 0;
jeep.colPos = (0,0,0);
jeep.colSurf = "";
jeep.maxDamage = 10;
jeep.damage = 0;
jeep.vehicleType = "jeep";

jeep.jeepTimerSet = undefined;
level.jeeps[ level.jeeps.size ] = jeep;
jeep thread engineON(jeeporigin);
jeep thread jeepBackupTime();

return jeep;
}



P. S. Not getting attached means - I can still move with WASD after using AA or jeep, while shooting / driving it.

guiismiti
9th September 2014, 20:59
Also, onPlaneShutDown:



onPlaneShutDown()
{
self endon( "intermission" );
self endon( "plane_crashed" );

self waittill( "plane_shutdown" );
self.shutdown = 1;
self playLoopSound( "plane_dive" );

pilot = self.peep;

pilot.minefield = undefined;

if( isDefined( pilot ) && isPlayer( pilot) && isAlive( pilot ) )
{
pilot openMenu( game["chute_menu"] );
pilot.altAngles = pilot getPlayerAngles();
pilot thread onMenu();

}

if( isDefined( self.hitBy ) )
{
self.hitBy.score++;
self.hitBy.shotdownCount += 1;
}

angles = self.angles;
iturn = 0;
if( angles[2] > 0 )
iturn = 1;
else
iturn = 2;
irotate = randomIntRange(10,60);

du = anglesToUp( self.angles);

maxTime = 60;
while( isDefined( self ) && self.crashed == 0 )
{
temp = vector_scale(du, - 100 );
t = self getOrigin() + temp;

df = anglesToForward( self.angles );
temp = vector_scale(df, 1000);
t = temp + t;
angles = vectorToAngles( t - self getOrigin() );

if( iturn ==1 )
angles = (angles[0], angles[1], self.angles[2] + irotate );
else
angles = (angles[0], angles[1], self.angles[2] - irotate );

self rotateTo( angles, randomFloatRange(.1,.5),0,0 );
self planeAccel();
if( isDefined( self.peep ) )
self.peep setplayerangles(self.angles);

maxTime -= .1;

if( maxTime < 0 )
break;

wait( .1 );
}

if( isDefined( self.peep ) )
self.peep setplayerangles((0,0,0));

self stopLoopSound("plane_dive");

if( isDefined( self.peep ) )
self.peep suicide();

self.crashed = 1;
}