Forums Index >> Modding >> Function for picking certain 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"));
}
}

 

 


Friday, November 11, 2005 at 3:36:29 PM

And also how can I make it so that everyone is always a certain team color regardless if they choose a different one??


Friday, November 11, 2005 at 3:53:53 PM
b20

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

Friday, November 11, 2005 at 6:18:33 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 ^...

Friday, November 11, 2005 at 8:36:48 PM

Neither of them work. I tried fixing them but I can't. Can I just get a straight answer??


Saturday, November 12, 2005 at 6:07:56 AM

I didn't do anything except make everyone who joins Blue, and the bots were green. So anywhere I placed a green spawn point, they would spawn there. Basic, very basic, but a useful tactic. The actual script has more in it.

Saturday, November 12, 2005 at 8:54:50 AM

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.


Saturday, November 12, 2005 at 10:27:25 AM

Function TankData::OnAdd(%this,%obj,%client)
{
if(%obj.client.deaths==0)
{
%client.team="GreenTeam";
CommandtoClient(%client,'CenterPrint',"You have joined soso's Impossible Odds!")
}
}

Saturday, November 12, 2005 at 8:52:18 PM

^ 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

Sunday, November 13, 2005 at 8:43:17 AM

^^ have you tested that code? Thinktanks doesn't load if you use that.

@56k

Thanks I'll try that out today.


Sunday, November 13, 2005 at 8:51:12 AM

@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?


Sunday, November 13, 2005 at 9:02:24 AM

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

Sunday, November 13, 2005 at 11:01:37 AM

Thanks,but what is the top one for?


Sunday, November 13, 2005 at 11:56:50 AM

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.

Sunday, November 13, 2005 at 12:33:52 PM

Nah, all I need now is the script for the picking spawn points for bots. :'(


Sunday, November 13, 2005 at 1:04:11 PM

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

Sunday, November 13, 2005 at 3:42:44 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

Sunday, November 13, 2005 at 4:11:19 PM

Yeah, I just got the team stuff sorted out for ya buddy, the rest is gonna take some time for me to get. I still don't think that useing a namebase to identify a bot in that sense is a good idea, but whatever suits you best.

Sunday, November 13, 2005 at 4:46:18 PM

^ I would tend to agree that name base isn't the best way to sort spawn points.

 

 

 

 

Sunday, November 13, 2005 at 5:11:09 PM

Yes, and bots do have other terms for identification... They have there own arrays. 8o

Last edited: Sunday, November 13, 2005 at 5:45:52 PM

Sunday, November 13, 2005 at 5:45:25 PM

Page : <1> :

insert quote insert url insert email insert image bold italic underline superscript subscript horizontal rule : : Help on using forum codes

Add comment:

HTML is disabled within comments, but ZBB Code is enabled.

Back to the top

Web site designed, maintained and funded by -z- and Dan MacDonald