New rain functions. VERY USEFULL too.need help
by Alexander Porter · in Technical Issues · 12/24/2002 (11:22 am) · 8 replies
ok, yesterday i managed to make new spawnspheres from the source and place them ingame and all. something is wrong with my RainProjectile.cs file so i'm trying to spawn just a crossbowprojectile to get it to work. no script/syntax errors anymore so it runs fine but nothing spawn. here is the code. please help so i can make some sort of contribution.
modified version/copy of the player spawning in game.cs
//-----------------------------------------------------------------------------
// Trying to create spawnspheres that will "rain" projectiles if they are there.
//-----------------------------------------------------------------------------
// Rain functions! we need Rain
//-----------------------------------------------------------------------------
// change to spawn rain projectile
function StartRain(%this)
{
// Find rain spawn point and start
//%RainSpawnPoint = pickRainSpawnPt();
// given a special coord
%RainSpawnPoint = "78.5883 -317.463 332.232" ;
createRain(%RainSpawnPoint);
echo ( "rain!!!!!!!!!!!!" );
}
//-----------------------------------------------------------------------------
function createRain(%RainSpawnPoint)
{
// Create Rain prjectile
%Rdrop = new Projectile()
{
dataBlock = CrossbowProjectile;
//initialVelocity = %muzzleVelocity;
//initialPosition = "78.5883 -317.463 332.232";
//sourceObject = %client.player;
};
%Rdrop.setTransform(%RainSpawnPoint);
echo( "RainSpawn.cs Tried to spawn again" );
// MissionCleanup.add(%Rdrop);
}
//-----------------------------------------------------------------------------
// Support functions
//-----------------------------------------------------------------------------
function pickRainSpawnPt()
{
echo( "Function pickRainSpawnPt found!" );
%groupName = "MissionGroup/RainDropPoints";
%group = nameToID(%groupName);
if (%group != -1)
{
%count = %group.getCount();
echo ( " != -1" );
if (%count != 0)
{
echo( " != 0" );
%index = getRandom(%count-1);
%RSpawn = %group.getObject(%index);
return %RSpawn.getTransform();
echo( "RSpawnPoint picked" );
}
else
error("No spawn points found in " @ %groupName);
}
else
error("Missing Rain spawn points group " @ %groupName);
// Could be no spawn points, in which case we'll stick the
// player at the center of the world.
return "78.5883 -317.463 332.232";
echo( "Spawnpoint picked!" );
}
echo( "RainSpawn.cs executed" );
StartRain();
echo(" rain created again");
//having trouble spawning the object.all the echo's work, and the script is executed but nothing spawns.
// new spawnspheres are made (green) but the function stops and wont continue again. i need to put "StartRain();" in the function
//that creates the rain so that there will always be rain.
modified version/copy of the player spawning in game.cs
//-----------------------------------------------------------------------------
// Trying to create spawnspheres that will "rain" projectiles if they are there.
//-----------------------------------------------------------------------------
// Rain functions! we need Rain
//-----------------------------------------------------------------------------
// change to spawn rain projectile
function StartRain(%this)
{
// Find rain spawn point and start
//%RainSpawnPoint = pickRainSpawnPt();
// given a special coord
%RainSpawnPoint = "78.5883 -317.463 332.232" ;
createRain(%RainSpawnPoint);
echo ( "rain!!!!!!!!!!!!" );
}
//-----------------------------------------------------------------------------
function createRain(%RainSpawnPoint)
{
// Create Rain prjectile
%Rdrop = new Projectile()
{
dataBlock = CrossbowProjectile;
//initialVelocity = %muzzleVelocity;
//initialPosition = "78.5883 -317.463 332.232";
//sourceObject = %client.player;
};
%Rdrop.setTransform(%RainSpawnPoint);
echo( "RainSpawn.cs Tried to spawn again" );
// MissionCleanup.add(%Rdrop);
}
//-----------------------------------------------------------------------------
// Support functions
//-----------------------------------------------------------------------------
function pickRainSpawnPt()
{
echo( "Function pickRainSpawnPt found!" );
%groupName = "MissionGroup/RainDropPoints";
%group = nameToID(%groupName);
if (%group != -1)
{
%count = %group.getCount();
echo ( " != -1" );
if (%count != 0)
{
echo( " != 0" );
%index = getRandom(%count-1);
%RSpawn = %group.getObject(%index);
return %RSpawn.getTransform();
echo( "RSpawnPoint picked" );
}
else
error("No spawn points found in " @ %groupName);
}
else
error("Missing Rain spawn points group " @ %groupName);
// Could be no spawn points, in which case we'll stick the
// player at the center of the world.
return "78.5883 -317.463 332.232";
echo( "Spawnpoint picked!" );
}
echo( "RainSpawn.cs executed" );
StartRain();
echo(" rain created again");
//having trouble spawning the object.all the echo's work, and the script is executed but nothing spawns.
// new spawnspheres are made (green) but the function stops and wont continue again. i need to put "StartRain();" in the function
//that creates the rain so that there will always be rain.
About the author
#2
12/24/2002 (1:56 pm)
don't the current rain functions only do 2d objects like sprites ? also you gotta work about them going through objects. this can make specific area / locations have rain/hail/snow/ and impacts. also think of the effect of a shockwave added to a raindrop . it would look good on water for the ripple effect. hail would bounce meteors showers could be in a specific area. airstrikes, volcanoes shooting stuff up. lots of fun stuff.
#3
12/24/2002 (2:04 pm)
Ok so the projectile do spawn, but they spawn and zoom down through the terrain. but something is wrong. they dont collide with the terrain.making progress though!! they spawn as nothings, need to slow the velocity. ;p
#5
so far they do spawn, working on it more. will keep you all updated
EDIT: wo0t
this will be very good when it works. now i can manually execute the function in the console and it drops the rain at the wrong spot. i can't seem to get it to drop at the spawn sphere location. also do the spawnspheres now pick a random spot withing the radius of the sphere?
12/24/2002 (4:24 pm)
yes, i think hail that bounced would be very very nice.so far they do spawn, working on it more. will keep you all updated
EDIT: wo0t
this will be very good when it works. now i can manually execute the function in the console and it drops the rain at the wrong spot. i can't seem to get it to drop at the spawn sphere location. also do the spawnspheres now pick a random spot withing the radius of the sphere?
#6
EDIT: also can someone help me with the reason why when it spawns it doesn't pick an area within the sphere but rather at the senter of the sphere? the player drop points do this too. Tribes 2 managed to pickout a place within the spawn radius i believe
12/24/2002 (5:07 pm)
and on the 24th of december Alex made RAIN! need to make the continuous spawn and make it so it doesn't just spawn in one spot!!!!!EDIT: also can someone help me with the reason why when it spawns it doesn't pick an area within the sphere but rather at the senter of the sphere? the player drop points do this too. Tribes 2 managed to pickout a place within the spawn radius i believe
#7
That feature was removed from Torque as it was tied closely with some other proprietary code.
12/25/2002 (12:30 am)
Tribes 2 built what was called a SpawnGraph during mission save. This allowed for the spawn within the sphere.That feature was removed from Torque as it was tied closely with some other proprietary code.
#8
Daniel has done some incredible things in the scripts, including a spawnsphere function that does exactly what you need.
12/25/2002 (6:29 am)
Take a look at Trakers, www.liquid.np.netDaniel has done some incredible things in the scripts, including a spawnsphere function that does exactly what you need.
Associate Ken Finney
Tubetti World
B) change your spawn point to be: "78.5883 -317.463 332.232 1 0 0 0"