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 → Idea for capturing respawn points...
Idea for capturing respawn points...
2001-07-27, 10:15 AM #1
Please note: this is untested. Please do not take the code until it works. (Let's use the 'honor system' [http://forums.massassi.net/html/wink.gif] )

The goal here is to capture all respawn points, then teleport to a random one. (Teleport code not added yet, just the capture code)

This was modified from the code Hideki posted for Jawa Tag. Think this will work Hideki?

Code:
	//Thanks to Hideki for the following code:
	For(x=0; x<GetSectorCount(); x=x+1)
     	   {   
		potential = FirstThingInSector(x);   
		While(potential != -1)   
		   {      
			If(GetThingTemplate(potential) == walkplayer_tpl)      
			   {         
				respawn[ID] = potential;         
				ID = ID + 1;      
			   }      
			potential = NextThingInSector(potential);   
		   }	
	     }
  	chosen = rand()*ID;
  	if(chosen == ID) chosen = ID - 1;
  	randRespawn = respawn[chosen];


Hopefully this will work. I'll test it later.

-Tazz



[This message has been edited by Tazz (edited July 27, 2001).]
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2003-09-15, 7:26 AM #2
Yes, I am resurrecting my own ancient topic just to see if anyone ever tested this idea, or would like to use it. I never did test it, but I was searching through all my old threads to get some of my old code back, and found this. SaberMaster, I'm looking at your or GBK inparticular, since you two are the coding gurus. I don't have much time to test it, but does it look right?

------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2003-09-17, 2:56 PM #3
The player and walkplayer templates are the same, so that's not going to work. I'm almost sure that when JK starts an MP game, it stores the original sector and position of the walkplayers - they become the spawn points. The walkplayers themselves are just disabled things (0x80000 thingflag).

So on startup, save the sector and position of however many walkplayers you need to an array. Then use Rand() to get a random spawn point.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!