Author Topic: Problems coding new playertypes  (Read 1796 times)

Hello all, I came here because I'm working on a series of playertypes called "Lightweight" players; players with 1/3 of the mass of a normal player in order to make better use of jets. Unfortunately, I've run into a problem with these: they refuse to appear ingame. I've tried several times to look for syntax errors and make the code the most like other playertype's I could, but still no result. So, as a last resort, I turn to the FORUMS!

Here's the contents of the Player_Lightweight.cs I'm using:

Code: [Select]
//3x less mass with jets

datablock PlayerData(PlayerLightweightJet : PlayerStandardArmor)
{
maxdamage = 55

mass = 40

runForce = 5 * 70;
maxForwardSpeed = 50;
maxSideSpeed = 40;
maxBackwardSpeed = 18;

minJetEnergy = 90;
jetEnergyDrain = 2;
canJet = 1;

uiName = "Standard Lightweight Player";
showEnergyBar = false;
};

//3x less mass with limited jets

datablock PlayerData(PlayerLightweightFuelJet : PlayerStandardArmor)
{
maxdamage = 55

mass = 40

runForce = 5 * 70;
maxForwardSpeed = 50;
maxSideSpeed = 40;
maxBackwardSpeed = 18;

minJetEnergy = 5;
jetEnergyDrain = 2;
canJet = 1;

uiName = "Fuel Jet Lightweight Player";
showEnergyBar = true;
};

//3x less mass with no jets

datablock PlayerData(PlayerLightweightNoJet : PlayerStandardArmor)
{
maxdamage = 55

mass = 40

runForce = 5 * 70;
maxForwardSpeed = 50;
maxSideSpeed = 40;
maxBackwardSpeed = 18;

minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;

uiName = "No Jet Lightweight Player";
showEnergyBar = false;
};

And here's the server.cs:

Code: [Select]
exec("./player_lightweight.cs");
If you can help, that'll be great!

Well first of all remove this nonsense

exec("./player_lightweight.cs");

And put the datablocks where they belong, directly in server.cs

And second, your code has syntax errors:

maxdamage = 55

mass = 40

1. If I place the datablocks in the server.cs, do I redirect the Player_Lightweight.cs to the server.cs?
2. So I put the "mass" and "maxdamage" values into the same stanza?

1. If I place the datablocks in the server.cs, do I redirect the Player_Lightweight.cs to the server.cs?
Just copy paste everything to server.cs and delete player_lightweight.cs

2. So I put the "mass" and "maxdamage" values into the same stanza?
No.. you add the missing semicolons!

Just copy paste everything to server.cs and delete player_lightweight.cs
No.. you add the missing semicolons!

Ah, silly me! *Fixed*

I've tried several times to look for syntax errors

There's this neat thing called the console. It'll show if your mod has syntax errors or not, and where the error more than likely is.