Author Topic: Maps not appearing in custom speedkart gamemode.  (Read 1294 times)

Hello! I've been trying to make a speedkart randomizer but the script and the maps are not showing, some assistance please.
I have no clue on what made this happen.

« Last Edit: September 08, 2015, 04:27:04 PM by Bow »

Please post the code you modified here. Not the entire speedkart code.

Code: [Select]
function randomizer()
{
$var1 = getRandom(0,15);
if ($var1 = 1);
%player.addItem(Gun);
}
Here.

= is used to SET a value. To compare two values, use the comparative operator ==. $= for other data types such as strings.

Code: [Select]
function randomizer()
{
$var1 = getRandom(0,15);
if ($var1 = 1);
%player.addItem(Gun);
}
Here.
You also don't need a variable here(especially not a global one). You can do if(getRandom(0, 15) == 1).

You also don't need a variable here(especially not a global one). You can do if(getRandom(0, 15) == 1).
I was thinking about changing the $ to % at school
Thanks a bunch
Edit: Still, doesn't work, the maps are not there.
« Last Edit: September 09, 2015, 03:07:47 PM by Bow »

You need to call the function like so: randomizer(player object here) and include a input var in the function itself.

As a guess, did you change the gamemode.txt to point at your copied gamemode? You need to.

You need to call the function like so: randomizer(player object here) and include a input var in the function itself.
alright thanks. do I need to add %player as well?
As a guess, did you change the gamemode.txt to point at your copied gamemode? You need to.
I think so, not internally sure
All I did was replace addon Gamemode_Speedkart to addon Gamemode_Speedkart+
« Last Edit: September 10, 2015, 05:34:52 PM by Bow »

name it something different, i bet 1 million bucks that torque or your operating system is not going to like that plus sign

alright thanks. do I need to add %player as well?I think so, not internally sure
All you need to do is add %player as an argument to the function and then call the function with a player object.

All you need to do is add %player as an argument to the function and then call the function with a player object.
What do you mean player object?
%obj?
isObject(%player)?
name it something different, i bet 1 million bucks that torque or your operating system is not going to like that plus sign
I tried to rename it to speedkartS
Still nothing
I can give you the whole file if you want.
here: https://www.mediafire.com/?3mxszg702125i28
Wow, things just never work out with me.
« Last Edit: September 11, 2015, 04:08:35 PM by Bow »

What do you mean player object?
%obj?
isObject(%player)?I tried to rename it to speedkartS
No.
Change this from
Code: [Select]
function randomizer(%var, %player)
{
%var1 = getRandom(0,15);
if (%var1 <= 15);
%player.addItem(gun);
}
randomizer(isObject(%player));
To
Code: [Select]
function randomizer(%player)
{
if (getRandom(0, 15) <= 1)
%player.addItem(gun);
}
Never put a ; at the end of an if statement. It causes a syntax error and syntax errors make it so that your entire script breaks. Call randomizer(%player); whenever you want the person to have a chance of getting a gun.


Change the line at the bottom of the server.cs from
Code: [Select]
exec("./karts/speedKartS.cs");
to
Code: [Select]
exec("./karts/speedKart.cs");

Remember that if nothing is working, check the console to see if your script has a syntax error.