Game Development Community

Random Spawnpositions

by Lukas Joergensen · in Torque Game Engine · 03/24/2009 (8:40 am) · 4 replies

I thought i had a code for random spawnpositions, but torsion tells me this


//-------------------------- 3/24/2009 -- 16:37:42 -----
Compiling GameOne/server/randomspawn.cs...
GameOne/server/randomspawn.cs Line: 3 - parse error
>>> Advanced script error report. Line 3.
>>> Some error context, with ## on sides of error halt:
/Adding Ai players by spell beta prototype 1

function findaispawnpoint();
##{##
//find spawnpoint
%spawnpoint = getRandom(-1715.67,-1915.67) SPC getRandom(-2104.21,-1904.21) SPC (63.286);
addaiplayer1(%spawnpoint);
}

function addaiplayer1(%spawnpoint);
{
// Create the player object
%player = new Player() {
dataBlock = PlayerBody;
>>> Error report complete.

#1
03/24/2009 (8:54 am)
Are you sure you shouldn't just have (%this, %spawnPoint) on your function findaispawnpoint function? With %this being the function.
#2
03/24/2009 (9:04 am)
Tried it but similar bug came up:

//-------------------------- 3/24/2009 -- 17:03:00 -----
Compiling GameOne/server/randomspawn.cs...
GameOne/server/randomspawn.cs Line: 3 - parse error
>>> Advanced script error report. Line 3.
>>> Some error context, with ## on sides of error halt:
/Adding Ai players by spell beta prototype 1

function findaispawnpoint(%this,%spawnpoint);
##{##
//find spawnpoint
%spawnpoint = getRandom(-1715.67,-1915.67) SPC getRandom(-2104.21,-1904.21) SPC (63.286);
addaiplayer1(%spawnpoint);
}

function addaiplayer1(%this,%spawnpoint);
{
// Create the player object
%player = new Player() {
dataBlock = PlayerBody;
>>> Error report complete.
#3
03/24/2009 (9:22 am)
function findaispawnpoint(); {}
function addaiplayer1(%spawnpoint); {}
function findaispawnpoint(%this,%spawnpoint); {}
function addaiplayer1(%this,%spawnpoint); {}
Remove the semi-colons before the braces. Only use semi-colons for line terminations and ending a datablock after the closing brace.
#4
03/24/2009 (9:26 am)
omg lol xD thanks works now ^^