Forums Index >> Modding >> "Idea" Adding more cars and things, need help........



Page : <1> :


Ok here it goes.....I am trying to add more cars and things to pull up in the list like when you type /jeep it brings up the jeep. Well I have other ones that I would like to add to the list and in the admin scripts folder in the normalcodes.cs file are these codes....

Else if(%code $= "/light")
{
tankchanger(%sender,"LightTank");
return;
}
else if(%code $= "/med")
{
tankchanger(%sender,"MediumTank");
return;
}
else if(%code $= "/heavy")
{
tankchanger(%sender,"HeavyTank");
return;
}
else if(%code $= "/ufo")
{
tankchanger(%sender,"BabyBoss");
return;
}
else if(%code $= "/jeep")
{
tankchanger(%sender,"Jeep");
return;
}
else if(%code $= "/gocart")
{
tankchanger(%sender,"gocart");
return;
}

As you see I have in the last one gocart and I am able to have it say that it has changed your tank to gocart. Thats all good so far but now where would I put the command and how would I put it so it changes to the gocart.....

This is out of tankDb.cs file that I remade......

Datablock TankData(gocart : MediumTank)
{
shapeFile =

"~/data/shapes/tanks/gocart/gocart.dts";
brainShapeFile =

"~/data/shapes/tanks/brainjar01.dts";
turnRate = 68.0; // degrees per

Second
accelRate = 45.0; // increase

Velocity this many meters per second
deccelRate = 45.0; // when breaking,

Decrease velocity
// this many

Meters per second
coastDeccelRate = 10.0; // rate of

Decceleration when coasting...
antiSlideRate = 11.1; // dissipate

Sideways velocity by this many meters
// per second
maxSpeed = 45.9; // meters per

Second (in forward direction)
turretVerCenter = 2.0; // vertical

Resting angle of turret in degrees
turretHorRange = 58.5; // range in +/-

Degrees of turret horizontally
turretVerRange = 21.0; // range in +/-

Degrees of turret vertically
turretAutoLevel = 0.5;
suspensionRange = 0.6; // proportion of

Wheel size for wheel to move up/down
springRangeX = 0.06;
springRangeY = 0.06;
springVelScale = 1.0;
springCorrectScale1 = 2.0;
springCorrectScale2 = 0.99;
damageAmount = 14.0; // total amount

Of damage tank can withstand
damageScale = 1.0; // multiply

Damage we do to others by this amount
armorScale = 1.0; // multiply

Damage we take by this amount (note: smaller

Better)
fireScale = 1.0; // adjust

Inter-fire interval by scale (2 means twice as

Slow)
defaultProjectile = "DefaultProjectile";
ai = GoldLightAI;
};

I used this one b/c it replaced the jeep one which is a copy of it. I have all files to allow the gocart to use but need to excute it when using the command /gocart "name"? What else do I need to do to make it work so I can add this and also other ones to with a code change select? Thank you guys again for you help on this and this will probably benifit everyone if it has not been done yet.
I am currently useing Arts script if that helps too

I do not know if this is also a right script for to change to the different ones but if it is please let me know how to change it to work and also where to place it.....

Exec("./tank.cs");

//-----------------------------------------------------------------------------

Function TankData::create(%block)
{
switch$(%block)
{
case "LightTank":
%obj = new Tank() {
dataBlock = %block;
};
return(%obj);
case "MediumTank":
%obj = new Tank() {
dataBlock = %block;
};
return(%obj);
case "HeavyTank":
%obj = new Tank() {
dataBlock = %block;
};
return(%obj);
}
return(-1);
}

Function TankData::onAdd(%this,%obj)
{
}

Function TankData::onTargetDestroyed(%db,%this,%killer)
{
// need to deal with both ai bots and players as killer's and killee's

%isPlayerKilled = isObject(%this.client);
%isPlayerKiller = isObject(%killer.client);

If (%isPlayerKiller)
{
%killer.incScore(1,1);
%killer.client.kills++;
if (%killer.client.kills % 10 == 0)
spawnTarget(TargetSaucer);
}
if (%isPlayerKilled)
commandToClient(%client,'CenterPrint',"Your brain has been separated from your tank, press SPACE.", 0, 1 );
else if (%this.dataBlock.getName() !$= "TargetSaucer")
spawnTarget(%this.dataBlock);

If (LocalClientConnection.kills == 5)
schedule(1500,0,"exitTargetPractice");
}

Function TankData::onDestroyed(%db,%this,%killer)
{
if ($Game::SinglePlayer)
{
%db.onSPDestroyed(%this,%killer);
return;
}
if ($Game::TargetRange)
{
%db.onTargetDestroyed(%this,%killer);
return;
}

// need to deal with both ai bots and players as killer's and killee's

%client = %this.client;
%client.deaths++;

// echo("killed tank: " @ %this @ ", client: " @ %client);
// echo("killer tank: " @ %killer @ ", client: " @ %killerClient);

If (isObject(%killer))
{
messageAll('MsgClientKilled','%1 has been eliminated by %2!',%client.name,%killer.client.name);
if ($Game::MissionType $= "Deathmatch")
{
// this is a score...
if ($Game::TeamGame)
{
if (%killer.client.team.getId() != %client.team.getId())
%killer.incScore(1,1);
}
else
%killer.incScore(1,1);
}
%killer.client.kills++;
}
else
{
messageAll('MsgClientKilled','%1 has been eliminated!',%client.name);
}

If ($Game::MissionType $= "Deathmatch")
{
if ($Game::TeamGame)
{
if (isObject(%killer) && %killer.client.team.getId() == %client.team.getId())
// team killer, lose point
%this.incScore(-1,-1);
else
%this.incScore(-1,0);
}
else
%this.incScore(-1,-1);
}
if (!isObject(%client.ai))
{
if ($Game::aiControlMode)
{
%client.player = 0;
%client.schedule(4000,"spawnPlayer");
}
else
commandToClient(%client,'CenterPrint',"Your brain has been separated from your tank, press SPACE.", 0, 1 );
}
else
spawnBotPlayer(%client);
}

Function Tank::onRemove(%this)
{
}

// Based on old GameConnection incScore function -- moved here for ai
function Tank::incScore(%this,%delta,%deltaTeam)
{
%client = %this.client;

// handle floor on score
if (-%delta>%client.score)
{
%client.cumScore -= %client.score;
%client.score = 0;
}
else
{
%client.score += %delta;
%client.cumScore += %delta;
}

If (isObject(%client.team))
{
if (-%deltaTeam>%client.team.score)
{
%client.team.cumScore -= %client.team.score;
%client.team.score = 0;
}
else
{
%client.team.score += %deltaTeam;
%client.team.cumScore += %deltaTeam;
}
}
messageAll('MsgClientScoreChanged', "", %client.score, %client.cumScore, %client);
if (isObject(%client.team))
messageAll('MsgTeamScoreChanged', "", %client.team.score, %client.team.cumScore, %client.team.getId());
}

Thank you again guys for your help, this has been a big brain boggler and now I am comming to you

 

Last edited: Thursday, July 27, 2006 at 5:35:35 PM

Thursday, July 27, 2006 at 5:29:14 PM

I am not 100% clear what you changed....but it looks like you added a new conditional for "/gocart" in NormalCodes.cs. You also seem to indicate that it does not give you an error when you execute the /gocart command during the game. So that part of the change seems to work. This leaves the tankDB.cs file change as the more likely source of your problem. You added a new datablock TankData(gocart : MediumTank) at the end of the file I presume. Which I guess you just copied an existing one and changed the paths to the new.dts files. Those two change should be all you need to add a new tank type. The other code displayed should not be changed.

I am not sure what steps you have tried to debug this problem but here are a few ideas:

Always make backups so you can roll back a change if something crazy happens.

1. Verify that you are actually using the change that you made. Do this by deleting the.dso file and verify that it complies the.cs file and creates.dso that loads without error. Always do this step!

2. Make sure the pathnames to the.dts files are correct.

 

Thursday, July 27, 2006 at 8:28:28 PM

^ Whoah man you popped outta nowhere. Where have you been all this time? Playing with an alias or took a long break? I remember playing with you a long time ago :o

Saturday, July 29, 2006 at 12:15:40 AM

You got it right

Monday, July 31, 2006 at 11:18:59 AM

Page : <1> :

insert quote insert url insert email insert image bold italic underline superscript subscript horizontal rule : : Help on using forum codes

Add comment:

HTML is disabled within comments, but ZBB Code is enabled.

Back to the top

Web site designed, maintained and funded by -z- and Dan MacDonald