Forums Index >> Modding >> My New Script



Page : <1> :


Im half way through making a New Script called
" Tank Gears " It will change your tanks gear but its kinda over manual because
you have to type /gear1 or /gear2 or /gear3 or /gear 4 and it will be like a Manual Car.

It will probably be out around My B-day and past
May 25 - June 10 a Pretty Long time from now but it will be only for my Mod
Because I need to make Improvements but it will be out for more people Soon after I finish all
the improvements if needed.

G-Crownz(SA2)

Friday, May 05, 2006 at 3:24:41 PM
b20

Good idea. I would just like to suggest something. Wouldn't it be hard if your in a scrum game and a person constantly had to type the command over and over again?

- b20

Friday, May 05, 2006 at 6:12:41 PM

Maybe you could just require the user to press a key without bringing up the chatbox?

Thinktanks: $20 New Mouse: $15 Winning an indy scrum game: Priceless

Saturday, May 06, 2006 at 4:39:01 AM

Oo cuz my idea was to already have Gear 1 Gear2 Gear3 and Gear4 already typed then just hit Enter then the up arrow key to get the gear up then Enter then down key to get the Gear to go down. That was my idea

Saturday, May 06, 2006 at 4:59:50 AM

Maybe try a key bind to the numbers "1, 2, 3, 4, and 5" on the keyboard?

 

Saturday, May 06, 2006 at 5:02:49 AM

I could probably write it myself.
EDIT: Sorry if I sound like I'm bragging, but here's the basic idea (not debugged):

 

                                        

function changeGears(%tank, %speed)
{
%tank.maxSpeed = %speed;
%tank.accelRate = %speed;
}
const gearOne = 11.9; // About a med's speed (for heavies)
const gearTwo = 15.9; // About a light's speed
const gearThree = 20.9; // Faster
const gearFour = 25.9; // For the really impatient
moveMap.bindCmd(keyboard, "1", "", "changeGears(%this, gearOne);");
moveMap.bindCmd(keyboard, "2", "", "changeGears(%this, gearTwo);");
moveMap.bindCmd(keyboard, "3", "", "changeGears(%this, gearThree);");
moveMap.bindCmd(keyboard, "4", "", "changeGears(%this, gearFour);");

 


I'll gladly work together with you on this one, though. None of the first letters in each line should be capitalized.

Last edited: Saturday, May 06, 2006 at 9:42:39 AM

Saturday, May 06, 2006 at 5:11:40 AM

@ Dj : look Okay. But what if I try to type 1 (ex. "I have 1 skin of you"), it would auto-change to Gear One then. So I suggest a key like ctrl+1 or alt+1

 

 

 

 

Saturday, May 06, 2006 at 7:01:36 AM

DJ, first: That'd have to be server side, as clients have NO control on the speed of the tanks. Second, TSL doesnt have constants... Lol try making a $Gears::GearOne = xx;


Sunday, May 07, 2006 at 2:23:50 AM

Ah... So set prefs instead? It's small enough to fit in one file, and I was planning on it being server-side anyways...

Sunday, May 07, 2006 at 4:19:40 AM

???? Lol yall just over there havin a conversation

Monday, May 08, 2006 at 3:57:04 AM

I love the way people offer to help, yet don't know how to do it themselves. Classic!

 

Monday, May 08, 2006 at 6:15:38 AM

This is a good idea, I like this.

Leader of the Vigilante Tanks! May Vigilance Carry On!

Monday, May 08, 2006 at 6:00:32 PM

This would be a cool feature if between all you guys it could work.

 

Monday, May 08, 2006 at 7:32:53 PM

Let me know when you get this to work, would be cool. This and a second scrum goal would be awesome!

 

Wednesday, May 10, 2006 at 5:17:20 AM


 

                                        
function servercmdchangethoseGears(%client, %speed)
{
%client.startingdb = %tank;
if(%a = 1)
%gear = 11.9; // About a med's speed (for heavies)
else if(%a = 2)
%gear = 15.9; // About a light's speed
else if(%a = 3)
%gear = 20.9; // Faster
else if(%a = 4)
%gear = 25.9; // For the really impatient
%tank.maxSpeed = %gear;
%tank.accelRate = %gear;
}
moveMap.bindCmd(keyboard, "1", "", "changeGears(1);");
moveMap.bindCmd(keyboard, "2", "", "changeGears(2);");
moveMap.bindCmd(keyboard, "3", "", "changeGears(3);");
moveMap.bindCmd(keyboard, "4", "", "changeGears(4);");
function changegears(%a)
{
commandtoserver("changethosegears",%a);
}

 

Both the server and client need that.... In other words....
If you have it and the guy hosting the server has it, it will work...

 

 

 

 

Last edited: Thursday, May 11, 2006 at 9:48:42 AM

Thursday, May 11, 2006 at 9:45:21 AM

BTW: I have not tested that... So dont get mad at me if it doesnt work

 

 

 

 

Thursday, May 11, 2006 at 9:49:35 AM

It works like this:

 

                                        
commandtoserver("testing", %a); //the variable being sent to the server is %a

 

The server will recieve the command and look for functions with "ServerCmd" at the beginning...
If the server has no function named "ServerCmdTesting" the server wont do anything, but if it does, it will execute the function
when a client uses commandtoserver, the server side function's first variable will be the %client number.... Or CADD as most of you know it... And then continue in order with the variables that are being sent

Like so:

 

                                        
servercmdtesting(%client, %a) //the server recieves the CADD of the client and the %a variable

 

The same works for client to server....

 

                                        
commandtoclient("testing", %a);

 

The client will recieve the command and look for functions with "ClientCmd" at the beginning...
If the client has no function named "ClientCmdTesting" the client wont do anything, but if it does, it will execute the function
the variables for server to client dont change at all

Like so:

 

                                        
clientcmdtesting(%a) //the client recieves the variable %a

 

Short tutorial for you there... Hope you like it :P

 

 

 

 

Friday, May 12, 2006 at 9:47:07 AM

@ Warfare : -off topic- how do you get those little 'quote-windows' |the piece's of ^ post, where the script piece's are in]

- C@S

 

 

 

 

Friday, May 12, 2006 at 9:57:54 AM

Use the <code> tag.
Aight, everyone, here's my version of the final script:

 

                                        
$Gears::Gears[] = [11.9, 15.9, 20.9, 25.9];
function servercmdchangeGears(%client, %speed)
{
centerprint(%client, "Changing Gears", 5, 5);
%tank = %client.player;
%tank.maxSpeed = $Gears::Gears[%speed];
%tank.accelRate = %tank.maxSpeed;
%client.tank = %tank;
}
moveMap.bindCmd(keyboard, "1", "", "changeGears(1);");
moveMap.bindCmd(keyboard, "2", "", "changeGears(2);");
moveMap.bindCmd(keyboard, "3", "", "changeGears(3);");
moveMap.bindCmd(keyboard, "4", "", "changeGears(4);");
function changegears(%a)
{
commandtoserver("changeGears",%a);
}

 


I mapped the gears to a pref, like Art said, except I made it an array. I also fixed the variable names in the server command. It should work now. Any volunteers for beta-testing?

Last edited: Friday, May 12, 2006 at 10:26:29 AM

Friday, May 12, 2006 at 10:16:44 AM

^ I can BETA-test.
Btw. It has an error... Dedicated window...

 

                                        
>>> Some Error Context, whit ## on sides
game/server/scripts/gears.cs Line 3 - Syntax Error
// --- Gears --- //
$gears::gears[]## ## = [11.9, 15.9, 20.9, 25.9]
>>> Report Complete

 

 

 

 

 

 

Last edited: Friday, May 12, 2006 at 11:20:45 AM

Friday, May 12, 2006 at 11:05:00 AM

Ah... Then forget the array, replace this:

$Gears::Gears[] = [11.9, 15.9, 20.9, 25.9];
function servercmdchangeGears(%client, %speed)
{
centerprint(%client, "Changing Gears", 5, 5);
%tank = %client.player;
%tank.maxSpeed = $Gears::Gears[%speed];
%tank.accelRate = %tank.maxSpeed;
%client.tank = %tank;
}
with this:

Function servercmdchangeGears(%client, %speed)
{
%tank = %client.player;
if(%a = 1)
%gear = 11.9; // About a med's speed (for heavies)
else if(%a = 2)
%gear = 15.9; // About a light's speed
else if(%a = 3)
%gear = 20.9; // Faster
else if(%a = 4)
%gear = 25.9; // For the really impatient
%tank.maxSpeed = %gear;
%tank.accelRate = %gear;
%client.player = %tank;
}

And don't capitalize the F in function.

Last edited: Friday, May 12, 2006 at 1:29:32 PM

Friday, May 12, 2006 at 1:28:52 PM

So it should be this then?

 

                                        
function servercmdchangeGears(%client, %speed)
{
%tank = %client.player;
if(%a = 1)
%gear = 11.9; // About a med's speed (for heavies)
else if(%a = 2)
%gear = 15.9; // About a light's speed
else if(%a = 3)
%gear = 20.9; // Faster
else if(%a = 4)
%gear = 25.9; // For the really impatient
%tank.maxSpeed = %gear;
%tank.accelRate = %gear;
%client.player = %tank;
}
moveMap.bindCmd(keyboard, "1", "", "changeGears(1);");
moveMap.bindCmd(keyboard, "2", "", "changeGears(2);");
moveMap.bindCmd(keyboard, "3", "", "changeGears(3);");
moveMap.bindCmd(keyboard, "4", "", "changeGears(4);");
Function changegears(%a)
{
commandtoserver("changeGears",%a);
}

 

It gives a sorta 'error' but 'Cannot find object 'moveMap' attempting to create functipn 'bind'
and it doesn't work. In my server. I put the file in both game/server/scripts and game/client/scripts and not working. ;)

 

 

 

 

Last edited: Friday, May 12, 2006 at 9:08:20 PM

Friday, May 12, 2006 at 9:07:28 PM

Umm..this may sound dumb,but how do I put scripts into my mods?

Saturday, May 13, 2006 at 4:21:16 PM

^ I thought you quit TT?

Saturday, May 13, 2006 at 5:40:09 PM

It'd just be easier to make "new" tanks with different speed level and then make a code for them


Saturday, May 13, 2006 at 10:19:23 PM

^lol yeh, you have many words of wisdom... I would like to, but I can't use Milkshape or Blender. :S

- C@S

 

 

 

 

Sunday, May 14, 2006 at 12:59:16 AM

This was the error with the array:

$Gears::Gears[] = [11.9, 15.9, 20.9, 25.9] ;
THIS CANNOT BE USED

You must
$Gears::Gears[1] = 11.9;
$Gears::Gears[2] = 15.9;

Etc

And anyways, the new error is:

Function servercmdchangeGears(%client, %speed ) //Upon recieving, it's transforming the variable %a in the client into %speed
{
%tank = %client.player;
if(%a = 1) //Here and some other times, you're using %a, wich now doesnt exist, so it'll always be marked as "0" from TGE - Fix: Use %speed
%gear = 11.9; // About a med's speed (for heavies)
else if(%a = 2)
%gear = 15.9; // About a light's speed
else if(%a = 3)
%gear = 20.9; // Faster
else if(%a = 4)
%gear = 25.9; // For the really impatient
%tank.maxSpeed = %gear;
%tank.accelRate = %gear;
%client.player = %tank;
}


Last edited: Monday, May 15, 2006 at 7:42:34 AM

Monday, May 15, 2006 at 7:37:23 AM

Anyone able to get this to go?

 

Sunday, May 28, 2006 at 4:57:25 AM

I have stopped working on the script Bcuz I fpund out a better way then wasting ur time on this script

On the Admin Script file jsut Change the tanks name to Wut ever Gear and make the tanks faster and faster and have Better Acceleration as you Change Gears Also Known as Changing tanks but u keep the same tank everytime so...

Saturday, June 24, 2006 at 2:26:25 PM

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