I'm a doctor, not a mechanic

Legacy:ProjectX/Code

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Ok here is where you will see a lot of code that dont work cos im a n00b at coding, if u can please tell me what ive dun wrong and tell me how to crrect id be really greatful.

When i load the new bulldog in a level, it appears, but when i walk up to it, and press [use] i cant get in it. The code i've changed is:

  1. #exec OBJ LOAD FILE=..\staticmeshes\BulldogMeshes.usx
  2. #exec OBJ LOAD FILE=..\sounds\WeaponSounds.uax
  3. #exec OBJ LOAD FILE=..\textures\VehicleFX.utx
  4.  
  5. class Betterbulldog extends KCar
  6.     placeable;
  7.  
  8. // triggers used to get into the Bulldog
  9. var const vector	FrontTriggerOffset;
  10. var BulldogTrigger	FLTrigger, FRTrigger, FlipTrigger;
  11.  
  12.  
  13. // headlight projector
  14. var const vector		HeadlightOffset;
  15. var BulldogHeadlight	Headlight;
  16. var bool				HeadlightOn;
  17.  
  18. // Light materials
  19. var Material			ReverseMaterial;
  20. var Material			BrakeMaterial;
  21. var Material			TailOffMaterial;
  22.  
  23. var Material			HeadlightOnMaterial;
  24. var Material			HeadlightOffMaterial;
  25.  
  26. var BulldogHeadlightCorona HeadlightCorona[8];
  27. var (Bulldog) vector	HeadlightCoronaOffset[8];
  28.  
  29. // Used to prevent triggering sounds continuously
  30. var float			UntilNextImpact;
  31.  
  32. // Wheel dirt emitter
  33. var BulldogDust		Dust[4]; // FL, FR, RL, RR
  34.  
  35. // Distance below centre of tire to place dust.
  36. var float			DustDrop;
  37.  
  38. // Ratio between dust kicked up and amount wheels are slipping
  39. var (Bulldog) float	DustSlipRate;
  40. var (Bulldog) float DustSlipThresh;
  41.  
  42. // Maximum speed at which you can get in the vehicle.
  43. var (Bulldog) float	TriggerSpeedThresh;
  44. var bool			TriggerState; // true for on, false for off.
  45. var bool			FlipTriggerState;
  46.  
  47. // Destroyed Buggy
  48. var (Bulldog) class<Actor>	DestroyedEffect;
  49. var (Bulldog) sound			DestroyedSound;
  50.  
  51. // Weapon
  52. var			  float	FireCountdown;
  53. var			  float SinceLastTargetting;
  54. var			  Pawn  CurrentTarget;
  55.  
  56. var (Bulldog) float		FireInterval;
  57. var (Bulldog) float		TargettingInterval;
  58. var (Bulldog) vector	RocketFireOffset; // Position (car ref frame) that rockets are launched from
  59. var (Bulldog) float     TargettingRange;
  60. var (Bulldog) Material	TargetMaterial;
  61.  
  62.  
  63. // Bulldog sound things
  64. var (Bulldog) float	EnginePitchScale;
  65. var (Bulldog) sound	BulldogStartSound;
  66. var (Bulldog) sound	BulldogIdleSound;
  67. var (Bulldog) float	HitSoundThreshold;
  68. var (Bulldog) sound	BulldogSquealSound;
  69. var (Bulldog) float	SquealVelThresh;
  70. var (Bulldog) sound	BulldogHitSound;
  71.  
  72. var (Bulldog) String BulldogStartForce;
  73. var (Bulldog) String BulldogIdleForce;
  74. var (Bulldog) String BulldogSquealForce;
  75. var (Bulldog) String BulldogHitForce;
  76.  
  77. replication
  78. {
  79. 	reliable if(Role == ROLE_Authority)
  80. 		HeadlightOn, CurrentTarget;
  81. }
  82.  
  83. function PreBeginPlay()
  84. {
  85. 	Super.PreBeginPlay();
  86. 	if ( Level.IsDemoBuild() )
  87. 		Destroy();
  88. }
  89.  
  90. simulated function PostNetBeginPlay()
  91. {
  92. 	local vector RotX, RotY, RotZ;
  93. 	local int i;
  94.  
  95.     Super.PostNetBeginPlay();
  96.  
  97.     GetAxes(Rotation,RotX,RotY,RotZ);
  98.  
  99. 	// Only have triggers on server
  100. 	if(Level.NetMode != NM_Client)
  101. 	{
  102. 		// Create triggers for gettting into the Bulldog
  103. 		FLTrigger = spawn(class'BetterbulldogTrigger', self,, Location + FrontTriggerOffset.X * RotX + FrontTriggerOffset.Y * RotY + FrontTriggerOffset.Z * RotZ);
  104. 		FLTrigger.SetBase(self);
  105. 		FLTrigger.SetCollision(true, false, false);
  106.  
  107. 		FRTrigger = spawn(class'BetterbulldogTrigger', self,, Location + FrontTriggerOffset.X * RotX - FrontTriggerOffset.Y * RotY + FrontTriggerOffset.Z * RotZ);
  108. 		FRTrigger.SetBase(self);
  109. 		FRTrigger.SetCollision(true, false, false);
  110.  
  111. 		TriggerState = true;
  112.  
  113. 		// Create trigger for flipping the bulldog back over.
  114. 		FlipTrigger = spawn(class'BetterbulldogTrigger', self,, Location);
  115. 		Fliptrigger.bCarFlipTrigger = true;
  116. 		FlipTrigger.SetBase(self);
  117. 		FlipTrigger.SetCollisionSize(350, 200);
  118. 		FlipTrigger.SetCollision(false, false, false);
  119.  
  120. 		FlipTriggerState = false;
  121. 	}
  122.  
  123. 	// Dont bother making emitters etc. on dedicated server
  124. 	if(Level.NetMode != NM_DedicatedServer)
  125. 	{
  126. 		// Create headlight projector. We make sure it doesn't project on the vehicle itself.
  127. 		Headlight = spawn(class'BulldogHeadlight', self,, Location + HeadlightOffset.X * RotX + HeadlightOffset.Y * RotY + HeadlightOffset.Z * RotZ);
  128. 		Headlight.SetBase(self);
  129. 		Headlight.SetRelativeRotation(rot(-2000, 32768, 0));
  130.  
  131. 		// Create wheel dust emitters.
  132. 		Dust[0] = spawn(class'BulldogDust', self,, Location + WheelFrontAlong*RotX + WheelFrontAcross*RotY + (WheelVert-DustDrop)*RotZ);
  133. 		Dust[0].SetBase(self);
  134.  
  135. 		Dust[1] = spawn(class'BulldogDust', self,, Location + WheelFrontAlong*RotX - WheelFrontAcross*RotY + (WheelVert-DustDrop)*RotZ);
  136. 		Dust[1].SetBase(self);	
  137.  
  138. 		Dust[2] = spawn(class'BulldogDust', self,, Location + WheelRearAlong*RotX + WheelRearAcross*RotY + (WheelVert-DustDrop)*RotZ);
  139. 		Dust[2].SetBase(self);
  140.  
  141. 		Dust[3] = spawn(class'BulldogDust', self,, Location + WheelRearAlong*RotX - WheelRearAcross*RotY + (WheelVert-DustDrop)*RotZ);
  142. 		Dust[3].SetBase(self);
  143.  
  144. 		// Set light materials
  145. 		Skins[1]=BrakeMaterial;
  146. 		Skins[2]=HeadlightOffMaterial;
  147.  
  148. 		// Spawn headlight coronas
  149. 		for(i=0; i<8; i++)
  150. 		{
  151. 			HeadlightCorona[i] = spawn(class'BulldogHeadlightCorona', self,, Location + (HeadlightCoronaOffset[i] >> Rotation) );
  152. 			HeadlightCorona[i].SetBase(self);
  153. 		}
  154. 	}
  155.  
  156.     // For KImpact event
  157.     KSetImpactThreshold(HitSoundThreshold);
  158.  
  159. 	// If this is not 'authority' version - don't destroy it if there is a problem. 
  160. 	// The network should sort things out.
  161. 	if(Role != ROLE_Authority)
  162. 	{
  163. 		KarmaParams(KParams).bDestroyOnSimError = False;
  164. 		KarmaParams(frontLeft.KParams).bDestroyOnSimError = False;
  165. 		KarmaParams(frontRight.KParams).bDestroyOnSimError = False;
  166. 		KarmaParams(rearLeft.KParams).bDestroyOnSimError = False;
  167. 		KarmaParams(rearRight.KParams).bDestroyOnSimError = False;
  168. 	}
  169. }
  170.  
  171. simulated event Destroyed()
  172. {
  173. 	local int i;
  174.  
  175. 	//Log("Betterbulldog Destroyed");
  176.  
  177. 	// Clean up random stuff attached to the car
  178. 	if(Level.NetMode != NM_Client)
  179. 	{
  180.  
  181. 		FLTrigger.Destroy();
  182. 		FRTrigger.Destroy();
  183. 		FlipTrigger.Destroy();
  184. 	}
  185.  
  186. 	if(Level.NetMode != NM_DedicatedServer)
  187. 	{
  188. 		'''Headlight.Destroy();
  189.  
  190. 		for(i=0; i<4; i++)
  191. 			Dust[i].Destroy();
  192.  
  193. 		for(i=0; i<8; i++)
  194. 			HeadlightCorona[i].Destroy();'''
  195. 	}
  196.  
  197. 	// This will destroy wheels & joints
  198. 	Super.Destroyed();
  199.  
  200. 	// Trigger destroyed sound and effect
  201. 	if(Level.NetMode != NM_DedicatedServer)
  202. 	{
  203. 		spawn(DestroyedEffect, self, , Location );
  204. 		PlaySound(DestroyedSound);
  205. 	}
  206. }
  207.  
  208. function KImpact(actor other, vector pos, vector impactVel, vector impactNorm)
  209. {
  210.     /* Only make noises for Bulldog-world impacts */
  211.     if(other != None)
  212.         return;
  213.  
  214.     if(UntilNextImpact < 0)
  215.     {
  216.         //PlaySound(BulldogHitSound);
  217.  
  218.         // hack to stop the sound repeating rapidly on impacts
  219.         //UntilNextImpact = GetSoundDuration(BulldogHitSound);
  220.  
  221.  
  222.     }
  223. }
  224.  
  225. simulated function ClientKDriverEnter(PlayerController pc)
  226. {
  227. 	//Log("Bulldog ClientKDriverEnter");
  228.  
  229. 	Super.ClientKDriverEnter(pc);
  230. }
  231.  
  232. function KDriverEnter(Pawn p)
  233. {
  234. 	//Log("Bulldog KDriverEnter");
  235.  
  236. 	Super.KDriverEnter(p);
  237.  
  238. 	//PlaySound(BulldogStartSound);
  239.  
  240. 	//AmbientSound=BulldogIdleSound;
  241.  
  242. 	p.bHidden = True;
  243. 	ReceiveLocalizedMessage(class'Vehicles.BulldogMessage', 1);
  244. }
  245.  
  246. simulated function ClientKDriverLeave(PlayerController pc)
  247. {
  248. 	//Log("Bulldog ClientKDriverLeave");
  249.  
  250. 	Super.ClientKDriverLeave(pc);
  251. }
  252.  
  253. function bool KDriverLeave(bool bForceLeave)
  254. {
  255. 	local Pawn OldDriver;
  256.  
  257. 	//Log("Bulldog KDriverLeave");
  258.  
  259. 	OldDriver = Driver;
  260.  
  261. 	// If we succesfully got out of the car, make driver visible again.
  262. 	if( Super.KDriverLeave(bForceLeave) )
  263. 	{
  264. 		OldDriver.bHidden = false;
  265. 		AmbientSound = None;	
  266. 		return true;
  267. 	}
  268. 	else
  269. 		return false;
  270. }
  271.  
  272. function LaunchRocket(bool bWasAltFire)
  273. {
  274. 	local vector RotX, RotY, RotZ, FireLocation;
  275. 	local BulldogRocket R;
  276. 	local PlayerController PC;
  277.  
  278. 	// Client can't do firing
  279. 	if(Role != ROLE_Authority)
  280. 		return;
  281.  
  282. 	// Fire as many rockets as we have time to.
  283. 	GetAxes(Rotation, RotX, RotY, RotZ);
  284. 	FireLocation = Location + (RocketFireOffset >> Rotation);
  285.  
  286. 	while(FireCountdown <= 0)
  287. 	{
  288. 		if(!bWasAltFire)
  289. 		{
  290. 			// Fire a rocket at the current target (starts flying forward and up a bit)
  291.  
  292. 			R = spawn(class'Vehicles.BulldogRocket', self, , FireLocation, rotator(-1 * RotX + 0.2 * RotZ));
  293. 			R.Seeking = CurrentTarget;
  294.  
  295. 			// Play firing noise
  296. 			PlaySound(Sound'WeaponSounds.RocketLauncher.RocketLauncherFire', SLOT_None,,,,, false);
  297. 			PC = PlayerController(Controller);
  298. 			if (PC != None && PC.bEnableWeaponForceFeedback)
  299. 				PC.ClientPlayForceFeedback("RocketLauncherFire");
  300. 		}
  301. 		else
  302. 		{
  303. 			//Log("Would AltFire At:"$CurrentTarget);
  304. 		}
  305.  
  306. 		FireCountdown += FireInterval;
  307. 	}
  308. }
  309.  
  310. // Fire a rocket (if we've had time to reload!)
  311. function VehicleFire(bool bWasAltFire)
  312. {
  313. 	Super.VehicleFire(bWasAltFire);
  314.  
  315. 	if(FireCountdown < 0)
  316. 	{
  317. 		FireCountdown = 0;
  318. 		LaunchRocket(bWasAltFire);
  319. 	}
  320. }
  321.  
  322. // For drawing targetting reticule
  323. simulated function DrawHud(Canvas C)
  324. {
  325. 	local int XPos, YPos;
  326. 	local vector ScreenPos;
  327. 	local float RatioX, RatioY;
  328. 	local float tileX, tileY;
  329. 	local float SizeX, SizeY, PosDotDir;
  330. 	local vector CameraLocation, CamDir;
  331. 	local rotator CameraRotation;
  332.  
  333. 	if(CurrentTarget == None)
  334. 		return;
  335.  
  336. 	SizeX = 64.0;
  337. 	SizeY = 64.0;
  338.  
  339. 	ScreenPos = C.WorldToScreen( CurrentTarget.Location );
  340.  
  341. 	// Dont draw reticule if target is behind camera
  342. 	C.GetCameraLocation( CameraLocation, CameraRotation );
  343. 	CamDir = vector(CameraRotation);
  344. 	PosDotDir = (CurrentTarget.Location - CameraLocation) Dot CamDir;
  345. 	if( PosDotDir < 0)
  346. 		return;
  347.  
  348. 	RatioX = C.SizeX / 640.0;
  349. 	RatioY = C.SizeY / 480.0;
  350.  
  351. 	tileX = sizeX * RatioX;
  352. 	tileY = sizeY * RatioX;
  353.  
  354. 	XPos = ScreenPos.X;
  355. 	YPos = ScreenPos.Y;
  356. 	C.Style = ERenderStyle.STY_Additive;
  357. 	C.DrawColor.R = 255;
  358. 	C.DrawColor.G = 255;
  359. 	C.DrawColor.B = 255;
  360. 	C.DrawColor.A = 255;
  361. 	C.SetPos(XPos - tileX*0.5, YPos - tileY*0.5);
  362. 	C.DrawTile( TargetMaterial, tileX, tileY, 0.0, 0.0, 256, 256); //--- TODO : Fix HARDCODED USIZE
  363. }
  364.  
  365. simulated function Tick(float Delta)
  366. {
  367.     Local float BestAim, BestDist, TotalSlip, EnginePitch, VMag;
  368. 	Local vector RotX, RotY, RotZ, FireLocation;
  369. 	local pawn NewTarget;
  370. 	local int i;
  371.  
  372.     Super.Tick(Delta);
  373.  
  374. 	// Weapons (run on server and replicated to client)
  375. 	if(Role == ROLE_Authority)
  376. 	{
  377. 		// Only put headlights on when driver is in. Save batteries!
  378. 		if(Driver != None)
  379. 			HeadlightOn=true;
  380. 		else
  381. 			HeadlightOn=false;
  382.  
  383. 		// Do targetting (do nothing if no controller)
  384. 		SinceLastTargetting += Delta;
  385. 		if(Controller != None && SinceLastTargetting > TargettingInterval)
  386. 		{
  387. 			GetAxes(Rotation, RotX, RotY, RotZ);
  388.  
  389. 			FireLocation = Location + (RocketFireOffset >> Rotation);
  390.  
  391. 			// BestAim is zero - so we will only target things in front of the buggy
  392. 			BestAim = 0;
  393. 			NewTarget = Controller.PickTarget(BestAim, BestDist, -1.0 * RotX, FireLocation, TargettingRange);
  394.  
  395. 			// If this is a new lock - play lock-on noise
  396. 			if(NewTarget != CurrentTarget)
  397. 			{
  398. 				if(NewTarget == None)
  399. 					PlayerController(Controller).ClientPlaySound(Sound'WeaponSounds.SeekLost');
  400. 				else
  401. 					PlayerController(Controller).ClientPlaySound(Sound'WeaponSounds.LockOn');
  402. 			}
  403.  
  404. 			CurrentTarget = NewTarget;
  405. 			SinceLastTargetting = 0;
  406. 		}
  407.  
  408. 		// Countdown to next shot
  409. 		FireCountdown -= Delta;
  410.  
  411. 		// This is for sustained barrages.
  412. 		// Primary fire takes priority
  413. 		if(bVehicleIsFiring)
  414. 			LaunchRocket(false);
  415. 		else if(bVehicleIsAltFiring)
  416. 			LaunchRocket(true);
  417. 	}
  418.  
  419. 	// Dont bother doing effects on dedicated server.
  420. 	if(Level.NetMode != NM_DedicatedServer)
  421. 	{
  422. 		// Update brake light colors.
  423. 		if(Gear == -1 && OutputBrake == false)
  424. 		{
  425. 			// REVERSE
  426. 			Skins[1] = ReverseMaterial;
  427. 		}
  428. 		else if(Gear == 0 && OutputBrake == true)
  429. 		{
  430. 			// BRAKE
  431. 			Skins[1] = BrakeMaterial;
  432. 		}
  433. 		else
  434. 		{
  435. 			// OFF
  436. 			Skins[1] = TailOffMaterial;
  437. 		}
  438.  
  439. 		// Set headlight projector state.
  440. 		Headlight.DetachProjector();
  441. 		if(HeadlightOn)
  442. 		{
  443. 			Headlight.AttachProjector();
  444. 			Skins[2] = HeadlightOnMaterial;
  445. 			for(i=0; i<8; i++)
  446. 				HeadlightCorona[i].bHidden = false;
  447. 		}
  448. 		else
  449. 		{
  450. 			Skins[2] = HeadlightOffMaterial;
  451. 			for(i=0; i<8; i++)
  452. 				HeadlightCorona[i].bHidden = true;
  453. 		}
  454.  
  455. 		// Update dust kicked up by wheels.
  456. 		Dust[0].UpdateDust(frontLeft, DustSlipRate, DustSlipThresh);
  457. 		Dust[1].UpdateDust(frontRight, DustSlipRate, DustSlipThresh);
  458. 		Dust[2].UpdateDust(rearLeft, DustSlipRate, DustSlipThresh);
  459. 		Dust[3].UpdateDust(rearRight, DustSlipRate, DustSlipThresh);
  460. 	}
  461.  
  462.     UntilNextImpact -= Delta;
  463.  
  464. 	// This assume the sound is an idle-ing sound, and increases with pitch
  465. 	// as wheels speed up.
  466. 	EnginePitch = 64 + ((WheelSpinSpeed/EnginePitchScale) * (255-64));
  467.     SoundPitch = FClamp(EnginePitch, 0, 254);
  468. 	//Log("Engine Pitch:"$SoundPitch);
  469.     //SoundVolume = 255;
  470.  
  471.     // Currently, just use rear wheels for slipping noise
  472.     TotalSlip = rearLeft.GroundSlipVel + rearRight.GroundSlipVel;
  473.     //log("TotalSlip:"$TotalSlip);
  474. 	if(TotalSlip > SquealVelThresh)
  475. 	{
  476. 		rearLeft.AmbientSound = BulldogSquealSound;
  477. 	}
  478. 	else
  479. 	{
  480. 		rearLeft.AmbientSound = None;
  481. 	}
  482.  
  483. 	// Dont have triggers on network clients.
  484. 	if(Level.NetMode != NM_Client)
  485. 	{
  486. 		// If vehicle is moving, disable collision for trigger.
  487. 		VMag = VSize(Velocity);
  488.  
  489. 		if(!bIsInverted && VMag < TriggerSpeedThresh && TriggerState == false)
  490. 		{
  491. 			FLTrigger.SetCollision(true, false, false);
  492. 			FRTrigger.SetCollision(true, false, false);
  493. 			TriggerState = true;
  494. 		}
  495. 		else if((bIsInverted || VMag > TriggerSpeedThresh) && TriggerState == true)
  496. 		{
  497. 			FLTrigger.SetCollision(false, false, false);
  498. 			FRTrigger.SetCollision(false, false, false);
  499. 			TriggerState = false;
  500. 		}
  501.  
  502. 		// If vehicle is inverted, and slow, turn on big 'flip vehicle' trigger.
  503. 		if(bIsInverted && VMag < TriggerSpeedThresh && FlipTriggerState == false)
  504. 		{
  505. 			FlipTrigger.SetCollision(true, false, false);
  506. 			FlipTriggerState = true;	
  507. 		}
  508. 		else if((!bIsInverted || VMag > TriggerSpeedThresh) && FlipTriggerState == true)
  509. 		{
  510. 			FlipTrigger.SetCollision(false, false, false);
  511. 			FlipTriggerState = false;
  512. 		}
  513. 	}
  514. }
  515.  
  516. // Really simple at the moment!
  517. function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, 
  518. 						Vector momentum, class<DamageType> damageType)
  519. {
  520. 	// Avoid damage healing the car!
  521. 	if(Damage < 0)
  522. 		return;
  523.  
  524. 	if(damageType == class'DamTypeSuperShockBeam')
  525. 		Health -= 100; // Instagib doesn't work on vehicles
  526. 	else
  527. 		Health -= 0.5 * Damage; // Weapons do less damage
  528.  
  529. 	// The vehicle is dead!
  530. 	if(Health <= 0)
  531. 	{
  532. 		if ( Controller != None )
  533. 		{
  534. 			if( Controller.bIsPlayer )
  535. 			{
  536. 				ClientKDriverLeave(PlayerController(Controller)); // Just to reset HUD etc.
  537. 				Controller.PawnDied(self); // This should unpossess the controller and let the player respawn
  538. 			}
  539. 			else
  540. 				Controller.Destroy();
  541. 		}
  542.  
  543. 		Destroy(); // Destroy the vehicle itself (see Destroyed below)
  544. 	}
  545.  
  546.     //KAddImpulse(momentum, hitlocation);
  547. }
  548.  
  549. defaultproperties
  550. {
  551. 	DrawType=DT_StaticMesh
  552. 	StaticMesh=StaticMesh'BulldogMeshes.Simple.S_Chassis'
  553.  
  554.     Begin Object Class=KarmaParamsRBFull Name=KParams0
  555.         KInertiaTensor(0)=20
  556.         KInertiaTensor(1)=0
  557.         KInertiaTensor(2)=0
  558.         KInertiaTensor(3)=30
  559.         KInertiaTensor(4)=0
  560.         KInertiaTensor(5)=48
  561. 		KCOMOffset=(X=0.8,Y=0.0,Z=-0.7)
  562. 		KStartEnabled=True
  563. 		KFriction=1.6
  564. 		KLinearDamping=0
  565. 		KAngularDamping=0
  566. 		bKNonSphericalInertia=False
  567.         bHighDetailOnly=False
  568.         bClientOnly=False
  569. 		bKDoubleTickRate=True
  570.         Name="KParams0"
  571.     End Object
  572.     KParams=KarmaParams'KParams0'
  573.  
  574. 	DrawScale=0.4
  575.  
  576. 	FrontTireClass=class'BulldogTire'
  577. 	RearTireClass=class'BulldogTire'
  578.  
  579. 	WheelFrontAlong=-100
  580. 	WheelFrontAcross=110
  581. 	WheelRearAlong=115
  582. 	WheelRearAcross=110
  583. 	WheelVert=-15
  584.  
  585. 	DestroyedEffect=class'XEffects.RocketExplosion'
  586. 	DestroyedSound=sound'WeaponSounds.P1RocketLauncherAltFire'
  587.  
  588.  
  589. 	//FrontTriggerOffset=(X=174,Y=0,Z=20)
  590. 	FrontTriggerOffset=(X=0,Y=165,Z=10)
  591.  
  592. 	TriggerSpeedThresh=40
  593.  
  594. 	HeadlightOffset=(X=-200,Y=0,Z=50)
  595. 	HeadlightOn=false
  596.  
  597. 	// Light materials
  598. 	ReverseMaterial=Material'VehicleFX.BDReverseLight_ON'
  599. 	BrakeMaterial=Material'VehicleFX.BDTaiLight_ON'
  600. 	TailOffMaterial=Material'VehicleFX.BDTailOff'
  601.  
  602. 	HeadlightOnMaterial=Material'VehicleFX.BDHeadlights_ON'
  603. 	HeadlightOffMaterial=Material'VehicleFX.BDHeadlights'
  604.  
  605. 	HeadlightCoronaOffset(0)=(X=-199,Y=51,Z=57)
  606. 	HeadlightCoronaOffset(1)=(X=-199,Y=-51,Z=57)
  607. 	HeadlightCoronaOffset(2)=(X=-128,Y=38,Z=125)
  608. 	HeadlightCoronaOffset(3)=(X=-189,Y=93,Z=28)
  609. 	HeadlightCoronaOffset(4)=(X=-183,Y=-93,Z=26)
  610. 	HeadlightCoronaOffset(5)=(X=-190,Y=-51,Z=77)
  611. 	HeadlightCoronaOffset(6)=(X=-128,Y=63,Z=123)
  612. 	HeadlightCoronaOffset(7)=(X=-185,Y=85,Z=10)
  613.  
  614. 	// Sounds
  615. 	EnginePitchScale=655350
  616. 	HitSoundThreshold=30
  617. 	SquealVelThresh=15
  618.  
  619. 	DustSlipRate=2.8
  620. 	DustSlipThresh=0.1
  621. 	DustDrop=30
  622.  
  623. 	// Weaponary
  624. 	bSpecialHUD=true
  625. 	FireInterval=0.9
  626. 	TargettingInterval=0.5
  627. 	RocketFireOffset=(X=0,Y=0,Z=180)
  628. 	TargettingRange=5000
  629.     TargetMaterial=Material'InterfaceContent.Hud.fbBombFocus'
  630.  
  631.  
  632. 	// Driver positions
  633.  
  634. 	ExitPositions(0)=(X=0,Y=200,Z=100)
  635. 	ExitPositions(1)=(X=0,Y=-200,Z=100)
  636. 	ExitPositions(2)=(X=350,Y=0,Z=100)
  637. 	ExitPositions(3)=(X=-350,Y=0,Z=100)
  638.  
  639. 	DrivePos=(X=-165,Y=0,Z=-100)
  640.  
  641.     OutputBrake=1
  642.     Steering=0
  643.     Throttle=0
  644.     Gear=1
  645. 	StopThreshold=40
  646.  
  647.     MaxSteerAngle=3400
  648.     MaxBrakeTorque=55
  649.  
  650. 	TorqueCurve=(Points=((InVal=0,OutVal=270),(InVal=20000,OutVal=170),(InVal=300000,OutVal=0)))
  651.     TorqueSplit=0.5
  652.     SteerPropGap=500
  653.     SteerTorque=15000
  654.     SteerSpeed=20000
  655.  
  656.     TireMass=0.5    
  657.     ChassisMass=8
  658.  
  659.     TireRollFriction=1.5
  660.     TireLateralFriction=1.5
  661.     TireRollSlip=0.06
  662.     TireLateralSlip=0.04
  663.     TireMinSlip=0.001
  664.     TireSlipRate=0.007
  665.     TireSoftness=0.0
  666.     TireAdhesion=0
  667.     TireRestitution=0
  668.  
  669. 	HandbrakeThresh=1000
  670. 	TireHandbrakeSlip=0.2
  671. 	TireHandbrakeFriction=-1.2
  672.  
  673.     SuspStiffness=150
  674.     SuspDamping=14.5
  675.     SuspHighLimit=0.5
  676.     SuspLowLimit=-0.5
  677.     SuspRef=0
  678.  
  679. 	AirSpeed = 5000
  680.  
  681. 	Health=300
  682.  
  683.     // sound
  684.     SoundRadius=255
  685.  
  686.     UntilNextImpact=500
  687. }
  688. </uscript lines>
  689. Pz. help.
  690.  
  691. '''EntropicLqd:''' Is this in a new class?  Any reason why you didn't post the whole code segment?
  692.  
  693. '''ProjectX:''' It's a modification of the bulldog, so it has lower acceleration and slightly higher speed, this is the only part i've changed so far, and this is the only part, therefore, where my problem will be.
  694.  
  695. '''ZxAnPhOrIaN:''' I am a n00b at uscripting also.. Look at my new map component at the open source area. It is a multi skybox zone thing similar to slickwilly's UT one, but more "user(or n00b)-friendly". And its for UT2003!
  696. '''AlphaOne:''' What happens when you try to run this codes? Does it actually compile?
  697. '''ProjectX:''' It compiles fine in UCC make and it appears in-game, i just cant enter it, thats the only thing wrong.
  698. '''ProjectX:''' I've found the problem, i forgot to change one of the class names in bulldog trigger. My new problem is now occurring (isn't debugging fun!?!?!?) Its in the uscript section above and heres the error i get in UCC MAKE: Error, type mismatch in '='. Ok, the line is line 292 in the script.
  699. '''ProjectX:''' Does anyone know what's wrong?
  700. '''AlphaOne:''' You must be really frustrated with this!? Before I try to help you, I would like to know if you modified the '''actuall''' bulldog code or created a subclass of a bulldog? If you modified the original bulldog, then you shouldn't be doing that. Really. That's why most of the original game code says that if you modify it you'll have problems. You either subclass the bulldog, or copy+pase the bulldog code into your own version of the bulldog. You can find how to [[Create A Subclass]] here. Alternatively, you can totally recreate your own bulldog, by creating a new package, creating classes MyBulldog and MyBulldogTires. Then fool around with those variables. The first step is easier (I think). When you subclass the bulldog, only include (in the defaultproperties) those variables that you've changed. If you don't know Object Oriented Programming (OOP), then you should search the net or this site for more info. It is the key to programming in UScript. I hope that helps.
  701. '''ProjectX:''' I copied the script to my own folder and compiled with UCC Make, changing the name to "betterbulldog"
  702. '''ProjectX:''' so ure all as infuriatingly n00bish as me/ have other stuff to do/ dont like me?
  703. '''ProjectX:''' I know this is a lot of code for you to help me with, but this is my first time at coding and if i dont get help now you may forever lose out on some great random insanity (like Food Fight UT2K3 not copyrighted in anyway, i would love to see this idea made)and anyway, the problem is only with 1 line of code, though i recognise that it may be due to another line of code somewhere else.
  704. '''Mychaeel:''' What's your problem with that code, again?  Compiler error in line 292?
  705. '''EntropicLqd:''' Bah - beat me to it.
  706. '''Daid303:''' Uh, can't find anything that wrong with line 292. Are you really really sure that this is YOUR code, and that that is the Right error?
  707. '''Mychaeel:''' Do you happen to have your ''own'' version of class BulldogRocket in your package?  Then that class and class Vehicles.BulldogRocket would indeed mismatch.
  708. '''ProjectX:''' That could be it, i shall check
  709. '''MythOpus:''' As you may or may not know... line ' 292 ' refers to the class that shoots the rocket.  Are you sure you have changed this to the class you have? Ex- Vehicles.OriginalBulldogFire to MyPackage.MyClassFire ?
  710.  
  711. '''Foxpaw:''' I decided to pore over this and figure out "what's down with that." :P
  712.  
  713. This is a part that doesn't work. It may have been an error in the copying, but other than this it compiled fine. (Actually I didn't have any betterbulldogtriggers so I just substituted them for regular bulldog triggers and made it so you can enter an empty betterbulldog by shooting it.. but you would probrably like to retain the method you have now.
  714. <uscript>
  715.   '''Headlight.Destroy();
  716.  
  717.   for(i=0; i<4; i++)
  718.     Dust[i].Destroy();
  719.  
  720.   for(i=0; i<8; i++)
  721.     HeadlightCorona[i].Destroy();'''

''' specifies a name constant, and obviously, is an invalid one.

Other than the bit above, it compiled and drove fine. It flips a lot less than the regular bulldog too.