Forums Index >> Modding >> Function for picking certain spawn points?
Page : <1> :
And also how can I make it so that everyone is always a certain team color regardless if they choose a different one??
No idea on that Big Show. :[
EDIT: Oh and hey! If you figure it out, can you put that in the survivor server, too? :o
- b20
Last edited: Friday, November 11, 2005 at 6:19:19 PM
It is, and it all has to do with the onAdd function.
Function TankData::OnAdd(%this,%obj,%client)
{
if(%obj.client.deaths==0)
{
%client.team="GreenTeam";
CommandtoClient(%client,'CenterPrint',"You have joined soso's Impossible Odds!")
}
}
The part to sort deaths and client spawn points (just made this up. Should be something along these lines)
Function TankData::OnDestroy(%this,%obj,%client)
{
%client = %this.Client;
%this.client = %BotClient;
%client.deaths++;
%killer.client.kills++;
%client.obj.tank.setTransform(pickSpawnPoint(1 1 1 1));
}
This is just a guidline, I'm not sure it will work, but you might want to start with this...
Don't Ever, ever, ever classify the name of whatever target you are meaning through there namebase function! My way works better, but it won't be when they add. I have recreated the impossible odds, you've seen it. I would email you the script, but it is a very difficult to follow one. I'm trying to sort it out so you can follow it... Un'til then, expand for ^...
Neither of them work. I tried fixing them but I can't. Can I just get a straight answer??
Well you see if I did that how would they turn blue if they were green and I wasn't there to turn them blue? They wouldn't be responsible and make themselves blue if I made the code for everyone there. And second if a bot dies then what are the chances it'll respawn at the same spot? Most likely that they will start piling up on each other.
^ That concept should work. Remember to change the "F" in function to lowercase.
Another option (this might work... I haven't tested this code specifically. Heh.):
// ---------------------------------------------
package TeamChangeMod {
function GameConnection::onConnect( %client, %name, %teamName, %tankId )
{
%teamName = "GreenTeam";
Parent::onConnect( %client, %name, %teamName, %tankId );
}
};
activatePackage(TeamChangeMod);
// ---------------------------------------------
Note: I'm using a "package" to append some code onto the beginning of another function. Very useful for modding.
Last edited: Sunday, November 13, 2005 at 3:38:24 PM
^^ have you tested that code? Thinktanks doesn't load if you use that.
@56k
Thanks I'll try that out today.
@56k
That works and also doesn't. The game knows im green (tested with bots) but the game also doesn't. I appear as blue and even on the message at the bottom tells me im on the blue team but the bots start killing me because im actually on green. Any way to fix this?? Do you also happen to know how to make the bots always spawn in the same position you choose?
Okay, this is what I use, and it does work.
Function certainGreennumber()
{
%GreenCount = 0;
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if(%cl.team $= "GreenTeam")
{
%GreenCount++;
}
}
%count = botClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%cl = botClientGroup.getObject(%i);
if(%cl.team $= "BlueTeam")
{
%blueCount++;
}
}
return %blueCount;
}
[/tag]
[tag]Function TankData::onAdd(%this,%obj)
{
%client = %obj.client;
if(%client.deaths == 0 && !isObject(%client.ai))
{
commandToClient(%client,'CenterPrint',"Welcome to Inpossible Odds!", 4, 4);
%client.team="GreenTeam";
MessageAll('MsgClientDrop',"",%client.nameBase, %client);
MessageAll('MsgClientJoin',"",%client.nameBase,%client,%client.team,%client.cumScore,0,0,0);
}
}
[/tag]
Last edited: Sunday, November 13, 2005 at 4:49:35 PM
Thanks,but what is the top one for?
That is what makes a player (not a bot) take the place of blue. You'll notice there is another function below that meaning that bots take the place of green when the game starts. The bottom is the way to make a person unable to choose what team they are on. You will have to add neccesary OnDestroy tactics. If you want my script (bug free) it's all yours. I'll email you soon.
Nah, all I need now is the script for the picking spawn points for bots. :'(
Heh.. Wacky, guess the script call I was using happens too late. Try the new updated code.
@splam: use the 'code' tag in your post instead of 'quote' and it won't mess up the capitalization. :)
Last edited: Sunday, November 13, 2005 at 3:45:05 PM
You might get somewhere with the code you were trying to use with a few changes:
function TankData::onAdd(%this,%obj)
{
if (%obj.namebase $= "Boss [Bot]")
{
%obj.tank.setTransform("1 1 1");
}
else if (%obj.namebase $= "Boss2 [Bot]")
{
%obj.tank.setTransform("3 1 -5");
}
}
I don't actually know if that will work or not. Does %obj.namebase return what you need it too for this to work? And is this function called at the right time so that the regular pick spawn point function won't over ride it?
Last edited: Sunday, November 13, 2005 at 5:11:43 PM
^ I would tend to agree that name base isn't the best way to sort spawn points.
Page : <1> :
Hey does anyone KNOW the script so that bots will only spawn in a certain position? I'm trying to remake paco's impossible odds but I can't if I dont have this script!! This is what I got (doesn't work) :
function Bot1::onAdd(%this,%obj)
{
if(%obj.client.namebase !$= "Boss [Bot]")
{
%obj.tank.setTransform(pickSpawnPoint("1 1 1 1"));
}
}