Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Spawning a team at a certain place.
Spawning a team at a certain place.
2004-01-22, 2:15 PM #1
Ino for you advanced coggers itts probably quite simple. But if i had a level which was say a castle with and outdoor area how could i make it so that in a team game if there were 5 walplayers in the castle and 5 outside that red team always spawned at the 5 inside and yellow always spawned at the outside ones.

------------------
Nightfire Mod
Spoting an error in post will result in a $100 reward.
Offer expires on 6/6/06. Valid one per customer, per day.

Rangi
2004-01-22, 4:21 PM #2
Is there some stuff in the CTF code that you can use?
I remember something about the first 16 wp's are neutral (in the CTF lobby), the next 8 are red team, and the last 8 are gold team. Something like that.

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-01-23, 1:34 AM #3
Oh look! Tutorial!
Oh, and the first 8 are Red, and the next 8 are Yellow (gold), and all others are starting points. But remember! Only 32 walkplayers per level!

/Edward
Edward's Cognative Hazards
2004-01-23, 3:35 AM #4
he dosent mean CTF, he means team based, liek some kind of sige level.

ill knock something up quick. stand by

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-23, 4:19 AM #5
ok, i ahvent been able to test, but i think i got the hex palyer spawn flags right... this cog will handel up to 32 spawn points, but should work perfectly with 10 (five inside five outside)

Code:
# PJ_team_spawn.cog
#
# makes all red team players spawn in the base
# and all yellow outside.
# cog uses a pulse to make all team players red or gold
#
#  **********************************************
#  WARNING the first five spawn points are gold
#  WARNING the second five are red
#  WARNING the next five are gold
#  WARNING the next five are red, and so on
#  *********************************************
#
# [PJB]
# 23/jan/2004

symbols
thing	player	local
int	team	local
int	i	local
message	startup
message pulse
end
code
startup:
setpulse(0.1); //ten MS pulse
return;

pulse:
for(i=0;i<=GetNumPlayers();i=i+1) //for all players
{
player=getplayerthing(i);  //get player I
team=GetPlayerTeam(player);//get palyer team
if(team==0)setpulse(0);	   //if the game is not team based stop the pulse

if(team==3 || team==1)     //if the palyer is red or blue
{
setplayerteam(player,1);   //set the palyer to  red (incase he is blue)
setRespawnMask(player,0x125275);//set the palyer spawn points
}

if(team==4 || team==2)     //if the palyer is gold or green
{
setplayerteam(player,2);   //set the player to gold (incase he is green)
setRespawnMask(player, 0x1252750);    //set the player spawn points
}
}
return;
end


------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-23, 12:39 PM #6
I see... I'm also making something like this. It's for an Alien mod and I use ThingUserData. Those that enter one sector are given the value 4000 and those that enter another get 2000. If someone dies, they are teleported to a ghost position according to their value. Then a secret switch to teleport the HOST to his comfy chair.

/Edward
Edward's Cognative Hazards
2004-01-23, 1:08 PM #7
Uhh i tryed pjb's cog and it didnt seem to work. Is there anything special i need to do with the cog like do i add it into the cogs of my level or do i just leave it there??

------------------
Nightfire Mod
Spoting an error in post will result in a $100 reward.
Offer expires on 6/6/06. Valid one per customer, per day.

Rangi
2004-01-23, 1:12 PM #8
Do you mean loading it into the Cog Window in Jed? If so, yes.
Otherwise, I don't see the point of combining it with another cog. Is any of it working at all? (make sure you have it loaded in the cog window and hit refresh, I guess).

Of course, there is the possibility that there was an incorrect flag or two in the code. I don't know what to look for, so I'd wait for PJB to say something.

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-01-23, 1:16 PM #9
Yea thats what i was doing having it in the cog window and it didnt work...

------------------
Nightfire Mod
Spoting an error in post will result in a $100 reward.
Offer expires on 6/6/06. Valid one per customer, per day.

Rangi
2004-01-25, 10:10 AM #10
I wonder where PJB went off to. Guess I'll take a whack at it.

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-01-26, 1:16 PM #11
Ok. I think I have it working. This code does what PJB said it would: respawns all red players in base and all gold outside. I have respawned about 50 or so times as a red player and I've always respawned in the base, so it apparently works. The problem was the respawn flags PJB used. They are now fixed.
Concerning the walkplayers: The first 30 alternate between red and gold respawn pts at every 5th one (1-5 are red, 6-10 are gold, 11-15 are red, etc). But the 31 and 32 wp's are different. WP 31 is red and WP 32 is gold. Just a note if you actually go up to 32 wp's.

Here is the revised cog.

Code:
# PJ_team_spawn.cog
#
# makes all red team players spawn in the base
# and all yellow outside.
# cog uses a pulse to make all team players red or gold
#
#  WARNING the first five spawn points are gold
#  WARNING the second five are red
#  WARNING the next five are gold
#  WARNING the next five are red, and so on
#
# Original code written by PJB
# Bug with respawn flags fixed by Darth Slaw
#
# 26/jan/2004
#==============================================================#
symbols

thing     player    local

int       team      local
int       i         local

message   startup
message   pulse

end
#==============================================================#
code
#------------------------------------------------------
startup:
	SetPulse(0.1);						//ten MS pulse

Return;
#------------------------------------------------------
pulse:
	for(i = 0; i < GetNumPlayers(); i = i + 1)		//for all players
	{
		player = GetPlayerThing(i);			//get player I
		team = GetPlayerTeam(player);			//get player team
		if(team == 0) SetPulse(0);			//if the game is not team based stop the pulse
		if(team == 3 || team == 1)			//if the player is red or blue
		{
			SetPlayerTeam(player, 1);		//set the player to  red (incase he is blue)
			SetRespawnMask(player, 0x41f07c1f);	//set the player spawn points
		}
		if(team == 4 || team == 2)			//if the player is gold or green
		{
			SetPlayerTeam(player, 2);		//set the player to gold (incase he is green)
			SetRespawnMask(player, 0xbe0f83e0);	//set the player spawn points
		}
	}

Return;
#------------------------------------------------------
end


[edit] Oh, ok. I just did a bit more debugging, and, it does work, but if the player joins the blue team or green team, they are transferred to the red (if blue) or gold (if green) team, but they keep their green or blue models.
Also, I edited this code within the first 20-30 minutes of posting. Make sure your "for" loop statement says < and not <= between i and GetNumPlayers(). That was another small error that caused the pulse's termination. It is now also fixed.

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team

[This message has been edited by Darth Slaw (edited January 26, 2004).]
May the mass times acceleration be with you.
2004-01-27, 6:25 AM #12
sorry aobut that, exactly what was wong with my respawn flags? i should ahve so use teh calutior but i did it in my head isnted

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-01-27, 11:40 AM #13
It looks like it was just bad math. I added every other 5 flag values together in Windows Calculator and came up with the flags I gave you.

I don't know about you but I almost always need a calculator to add hex values together.

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-01-27, 1:05 PM #14
Anyway thanks alot PJB and slaw

------------------
Nightfire Mod
Spoting an error in post will result in a $100 reward.
Offer expires on 6/6/06. Valid one per customer, per day.

Rangi

↑ Up to the top!