Forums Index >> Modding >> spawnsphere scripting?
Page : <1> :
Easy, after a score, delete the goals and pick a random green or blue spawn respectively for the next goals.
Like so:
function getnewgoal(%datablock)
{
%dataGroup = "MissionGroup";
%goalCount = 0;
for(%i = 0; %i < %dataGroup.getCount(); %i++)
{
%obj = %dataGroup.getObject(%i);
if(%obj.DataBlock $= %datablock) //Make sure the %obj.DataBlock has the capitals
{
%goalCount++;
}
}
}
That should get you started...
while %datablock is the datablock name of the green or blue goal...
After you get how many of that particular goal there is, you can pick a random number with %goalcount as the limit, and then tell the server to go find the ramdom picked goal...
After you get all of that, simply create a new goal and viola!
Last edited: Saturday, April 22, 2006 at 10:18:11 AM
^ I should add that this little snippit will not do what you want it to do, this is just a little boost in the right direction
Thanks... Was what I was wanting
^ um no.... Torque does not care about cases in variables... %DaTaBlOcK is the same as %datablock.... In strings however, it depends on what you are trying to do
@crap
I dont have a working e-mail yet, but if you go get a membership in the red strike forum
that PGG and Art started you can private message me. I intend to get an e-mail soon.... But until then :P
[edit] actually crap, if you want go ahead and e-mail me at thinktanker123@yahoo.com and pm me at the red strike forum as well... I can possibly sneak on another pc that the firewall doesnt block yahoo on.... Yeah, my father thought it suspicious of me to have a yahoo account without him knowing... Go ahead and do both and if I cant access e-mail elsewhere we can use the other forum
@canned
Sorry dude, I thought you ment the variable declared in the function
function getnewgoal(%datablock)
Yeah, the %obj.DataBlock must have the capitals or else it will whine at you... Good call. :P
Last edited: Saturday, April 22, 2006 at 10:22:01 AM
Page : <1> :
I've been trying to learn a little scripting, but am stuck way out of my depth at the minute...
Wanting to make 2 scrumgoals appear, specific to each team (managed to do).
but the problem is that I don't want them as static goals, like after each goal I want them to move to another position as if they were REAL scrumgoals. And im wanting them specific to each team. Blue scrumgoal appears on blue spawnspheres and green scrumgoal appears on green spawnspheres etc.