CoD 4 Set Next Spawn Point (origin)

Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!

Moderator: Core Staff

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

CoD 4 Set Next Spawn Point (origin)

Post by Moustache » September 3rd, 2010, 4:01 pm

How is it possible to set the next spawn point (origin) for a player?

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: CoD 4 Set Next Spawn Point (origin)

Post by Drofder2004 » September 3rd, 2010, 7:24 pm

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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Hoogie
Core Staff
Core Staff
Posts: 3974
Joined: September 2nd, 2008, 10:22 am
Location: Holland

Re: CoD 4 Set Next Spawn Point (origin)

Post by Hoogie » September 3rd, 2010, 11:00 pm

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.
-=[[CoDJumper.com Movies]]=-
[[Ambush]] || [[Backlot]] || [[Bloc]] || [[Bog]] || [[Broadcast]] || [[Chinatown]] || [[Countdown]]
[[Crash]] || [[Creek]] || [[Crossfire]] || [[District]] || [[Downpour]] || [[Killhouse]] || [[Overgrown]]
[[Pipeline]] || [[Shipment & Wetwork]] || [[Showdown]] || [[Strike]] || [[Vacant]]


A woman can fake an orgasm, but a man can fake an entire relationship

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: CoD 4 Set Next Spawn Point (origin)

Post by Drofder2004 » September 3rd, 2010, 11:31 pm

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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Hoogie
Core Staff
Core Staff
Posts: 3974
Joined: September 2nd, 2008, 10:22 am
Location: Holland

Re: CoD 4 Set Next Spawn Point (origin)

Post by Hoogie » September 3rd, 2010, 11:34 pm

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.
-=[[CoDJumper.com Movies]]=-
[[Ambush]] || [[Backlot]] || [[Bloc]] || [[Bog]] || [[Broadcast]] || [[Chinatown]] || [[Countdown]]
[[Crash]] || [[Creek]] || [[Crossfire]] || [[District]] || [[Downpour]] || [[Killhouse]] || [[Overgrown]]
[[Pipeline]] || [[Shipment & Wetwork]] || [[Showdown]] || [[Strike]] || [[Vacant]]


A woman can fake an orgasm, but a man can fake an entire relationship

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: CoD 4 Set Next Spawn Point (origin)

Post by Drofder2004 » September 4th, 2010, 3:28 am

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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: CoD 4 Set Next Spawn Point (origin)

Post by Moustache » September 4th, 2010, 11:52 am

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?");
}

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: CoD 4 Set Next Spawn Point (origin)

Post by Drofder2004 » September 4th, 2010, 2:47 pm

Are you coding a map or mod?
If map, which gametype?
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: CoD 4 Set Next Spawn Point (origin)

Post by Moustache » September 4th, 2010, 3:22 pm

Sorry for the less amount of info.

I am (trying to) scripting a mod.

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: CoD 4 Set Next Spawn Point (origin)

Post by Moustache » September 6th, 2010, 12:09 pm

Is this even possible?
Or is it a no go?

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: CoD 4 Set Next Spawn Point (origin)

Post by Rezil » September 6th, 2010, 1:42 pm

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.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: CoD 4 Set Next Spawn Point (origin)

Post by Drofder2004 » September 6th, 2010, 2:12 pm

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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: CoD 4 Set Next Spawn Point (origin)

Post by Moustache » September 6th, 2010, 7:27 pm

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.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: CoD 4 Set Next Spawn Point (origin)

Post by Drofder2004 » September 6th, 2010, 9:23 pm

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?
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: CoD 4 Set Next Spawn Point (origin)

Post by Rezil » September 6th, 2010, 9:49 pm

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).
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests