Forums Index >> Modding >> My New Script
Page : <1> :
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
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
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
Maybe try a key bind to the numbers "1, 2, 3, 4, and 5" on the keyboard?
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
@ 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
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;
???? Lol yall just over there havin a conversation
I love the way people offer to help, yet don't know how to do it themselves. Classic!
This is a good idea, I like this.
Leader of the Vigilante Tanks! May Vigilance Carry On!
This would be a cool feature if between all you guys it could work.
Let me know when you get this to work, would be cool. This and a second scrum goal would be awesome!
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
BTW: I have not tested that... So dont get mad at me if it doesnt work
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
@ 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
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
^ 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
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
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
Umm..this may sound dumb,but how do I put scripts into my mods?
It'd just be easier to make "new" tanks with different speed level and then make a code for them
^lol yeh, you have many words of wisdom... I would like to, but I can't use Milkshape or Blender. :S
- C@S
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
Anyone able to get this to go?
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...
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)