Page 1 of 2

CoD 4 Set Next Spawn Point (origin)

Posted: September 3rd, 2010, 4:01 pm
by Moustache
How is it possible to set the next spawn point (origin) for a player?

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 3rd, 2010, 7:24 pm
by Drofder2004
Every gametype has its own logic.

S&D has fixed.
DM has random.
TDM has a "far from enemy, close to team".

But you do not determine which spawnpoint is used in mapping.

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 3rd, 2010, 11:00 pm
by Hoogie
Drofder2004 wrote:TDM has a "far from enemy, close to team".
This system is obviously not working. 99% of the matches i played of TDM i spawned atleast once in the middle of the enemy team without any teammates around me.

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 3rd, 2010, 11:31 pm
by Drofder2004
Hoogie wrote:
Drofder2004 wrote:TDM has a "far from enemy, close to team".
This system is obviously not working. 99% of the matches i played of TDM i spawned atleast once in the middle of the enemy team without any teammates around me.
TDM will always have a complicated logic, especially on busy servers.

If you play with more than 8 players per team, you essentially have to calculate the positions of all 8 enemies, find an average point and then find the average point of your allies and then locate the nearest spawn between the two, with such small maps, it is likely that you may spawn very close to the enemy, simply because one enemy is on the other side of the map.

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 3rd, 2010, 11:34 pm
by Hoogie
Drofder2004 wrote:
Hoogie wrote:
Drofder2004 wrote:TDM has a "far from enemy, close to team".
This system is obviously not working. 99% of the matches i played of TDM i spawned atleast once in the middle of the enemy team without any teammates around me.
TDM will always have a complicated logic, especially on busy servers.

If you play with more than 8 players per team, you essentially have to calculate the positions of all 8 enemies, find an average point and then find the average point of your allies and then locate the nearest spawn between the two, with such small maps, it is likely that you may spawn very close to the enemy, simply because one enemy is on the other side of the map.
I don't mean one enemy, i mean in the middle on the enemy spawn.

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 4th, 2010, 3:28 am
by Drofder2004
Hoogie wrote:I don't mean one enemy, i mean in the middle on the enemy spawn.
I know, but it is just "logic" it is not foolproof and always will have flaws in random spawns.

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 4th, 2010, 11:52 am
by Moustache
Well I don't want to change all the spwan points.

I just want to do something like this:

Code: Select all

if(value_x == 1)
{
	self Next_Spawn_Origin((200,200,1000)); // I don't know how to set the next spawn place
	self IPrintLnBold("Do you really think you can fly?");
}

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 4th, 2010, 2:47 pm
by Drofder2004
Are you coding a map or mod?
If map, which gametype?

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 4th, 2010, 3:22 pm
by Moustache
Sorry for the less amount of info.

I am (trying to) scripting a mod.

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 6th, 2010, 12:09 pm
by Moustache
Is this even possible?
Or is it a no go?

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 6th, 2010, 1:42 pm
by Rezil
We can't help you if we don't have enough info. I'm still not sure what you're trying to achieve with this.

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 6th, 2010, 2:12 pm
by Drofder2004
Sound to me like progressive spawn points.
Such as save points.

Firstly, you need to make sure you are using a fixed location spawn logic (such as S&D)
[You should be able to find this in the S&D gametype file]

Secondly, you would then need to define origins for all your moved spawnpoints, whether this be by using ingame viewpos or mapping (if you are mapping, this becomes easier)

Finally, you need to create a script that moves the spawnpoints when requested.

Its a fair amount of work, and being udner the impression you haven't done much coding, I would suggest rethinking. If you are a good coder, then yo ushould've been able to work this out by reading the gametype files.

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 6th, 2010, 7:27 pm
by Moustache
I thought it where just a few commands or so to set the next spawn origin.
Maybe I should try an other method then.

This could also work for what I want:
1. I need the whole screen to turn black. So that the player can't see anything. Also not his minimap. Maybe it is possible to just destroy all hud elements and add a new hud element that gives him a black screen. And when he respawns the black hud element will be destroyd. And the other hud elements will be rebuild by the game.
Or am I wrong?

This is my code for the blackscreen. Only it fails because it doesn't fill my whole screen (I play @ 1920x1080) and you can still see the minimap trough it.

Code: Select all

blackscreen_HUD()
{
	if (isDefined(self.blackscreen))
		self.blackscreen destroy();

	wait 0.05;

	self.blackscreen = newClientHudElem(self);
	self.blackscreen.sort = -100;
	self.blackscreen.archived = false;
	self.blackscreen.alignX = "left";
	self.blackscreen.alignY = "top";
	self.blackscreen.x = 0;
	self.blackscreen.y = 0;
	self.blackscreen.alpha = 1;
	self.blackscreen setShader("black", 640, 480);
}
2. Then it need to look likes the player dies.
I already had a small piece of script that copy's the player and then start the copy to ragdoll. But the problem is that only the player itself saw the ragdoll.
How can I let everybody see the ragdoll?
And how can I place the skull icon in the bottom left corner so that it looks like that player killed himself?
This is what I have for the ragdoll:

Code: Select all

body = self ClonePlayer(0);
wait 0.05;
body StartRagdoll();
wait 1;
body Hide();
3. And how can I prevent that the player is visible on the minimap? He should also not be visible for his team mates.

Sorry for this shit load of question :oops:
I hope someone can and wants to help me.

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 6th, 2010, 9:23 pm
by Drofder2004
1. self.blackscreen.foreground = 1;
and sort = 100.

2. The death we see is not ragdoll, but an animation, with the body becoming a ragdoll after.
This is untested and pulled straight from the gametype files.

Code: Select all

   deathAnim = ent getcorpseanim();

	startFrac = 0.35;

	if ( animhasnotetrack( deathAnim, "start_ragdoll" ) )
	{
		times = getnotetracktimes( deathAnim, "start_ragdoll" );
		if ( isDefined( times ) )
			startFrac = times[0];
	}

	waitTime = startFrac * getanimlength( deathAnim );
	wait( waitTime );

	if ( isDefined( ent ) )
		ent startragdoll( 1 );
Message in bottom left

Code: Select all

obituary(self, self, "none", "MOD_SUICIDE");
3. Not sure, but maybe locate and modify the icons used and make them full alpha?

Re: CoD 4 Set Next Spawn Point (origin)

Posted: September 6th, 2010, 9:49 pm
by Rezil
For 1. you have to allign it "fullscreen" on both the X and Y axes. For 3. it would be quite difficult, the alpha way won't work because the arrow is one shader used for all players. Modifying it directly would affect all of your teammates as well. Ragdolls and physics in cod4 are shit because they're local, not server-side so for example if a brick is in one place on your computer, it might be in a completely different place for someone else(in theory).