Change Race Past freeze Time

This is the place for general discussion about Warcraft3 XP, including install help.

Moderator: Forum Moderator

Post Reply
Gunny
Peon
Posts: 36
Joined: Mon Dec 05, 2005 6:24 pm
Location: Magnolia, Texas
Contact:

Change Race Past freeze Time

Post by Gunny » Wed May 09, 2007 4:55 pm

I know of the cvar to allow changing race past the freeze time but what I want to do is only allow you to change race during the Buy time or only in the buy zone.

The reason for this is I don't like it when players will change to different race mid round just because they are weak or want to be silent or want to hide.

If I set the mp_changeracepastfreezetime to 0 then players are having trouble choosing their race when they enter the game mid round or if their connection is a slower than a few others.

Any ideas on how to solve this.

Currently my cvars are set to this:
mp_freezetime 3
mp_changeracepastfreezetime 1
mp_allowchangerace 1

All the rest are default for a Long term and saved via mysql
-john

User avatar
ferret
Lead Warcraft 3 XP Developer
Posts: 422
Joined: Wed Jul 06, 2005 8:20 am
Location: Atlanta, GA
Contact:

Post by ferret » Thu May 10, 2007 8:51 am

What kind of connection is too slow to pick a range while dead or at the start of a round? :/

Anyways. I believe buytime is in minutes, so mp_buytime 0.5 is 30 seconds. At least that's what I remember. I haven't touched CS1.6 in over a year, no joke. So if its not mp_buytime, figure out what it really is and replace it in the file I'm posting:

(Understand I'm writing this from work while bored and between tasks, without having written any AMXX in over a year. I believe this code will work however.)

This adds mp_changeracewithbuytime. Set to 1 and you can change race until the buytime ends, rather than the end of the freezetime. If you use mp_changeracepastfreezetime 1 it will still allow race change at any time though, so turn it off.

To recap:

mp_allowchangerace - 1 allows race change, 0 disallows. When set to 1, players can change race while dead or during freeze time.
mp_changeracepastfreezetime - When set to 1, disables the "must be dead or in freeze time" restriction. Living players can change at any time during the round.
mp_changeracewithbuytime - Set to 1 uses buytime instead of freezetime to determine when race change is no longer allowed, when mp_changeracepastfreezetime is set to 0.

I'll add to CVS later. This is the important line, replace it if I got the cvar name wrong:

set_task(get_cvar_float("mp_buytime")*60.0,"end_buytime", 10987)
Attachments
warcraft3.sma
(326.14 KiB) Downloaded 333 times
-< www.gamehavoc.com >-

Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!

Gunny
Peon
Posts: 36
Joined: Mon Dec 05, 2005 6:24 pm
Location: Magnolia, Texas
Contact:

Post by Gunny » Thu May 10, 2007 5:25 pm

I am getting a compile error.

Code: Select all

warcraft3.sma(5149) : error 075: input line too long (after substitutions)

1 Error.
Could not locate output file warcraft3.amx (compile failed).
war3xp@tdow:~/hlds/cstrike/addons/amxmodx/scripting$
Did you use the sma that is on the cvs? that is the only one I can use to compile from, the one that is listed on the website shows to compile and complete but it tried to save it as a amx file and not a amxx but it when I go to the compiled folder it is not present.

In reference to your question about the connection... When you are not the first 2 players on the server and the round starts, then you are not able to select your race except during freezetime unless you use the pastfreezetime cvar.

Thanks
-john

Gunny
Peon
Posts: 36
Joined: Mon Dec 05, 2005 6:24 pm
Location: Magnolia, Texas
Contact:

Post by Gunny » Thu May 10, 2007 6:05 pm

Ok I added the code to the one that I can compile and it did compile except with a loose indention at line 217.

I am testing the new version on my server now. I have noticed that when I add the cvar

Code: Select all

mp_changeracewithbuytime 1
and then try to check it via console

Code: Select all

mp_changeracewithbuytime
it gives no setting...meaning it comes back blank unlike when I try

Code: Select all

mp_changeracepastfreezetime
it comes back

Code: Select all

mp_changeracepastfreezetime 0
Thanks
-john

User avatar
ferret
Lead Warcraft 3 XP Developer
Posts: 422
Joined: Wed Jul 06, 2005 8:20 am
Location: Atlanta, GA
Contact:

Post by ferret » Fri May 11, 2007 6:05 am

Did you copy ALL of the code changes? The line I posted is not everything I added. I'll list them here:

Change #1:

Code: Select all

	if(gNewSpawn && gRoundOver)
	{
		gNewSpawn = false
		bFreezeTime = true
			
		#if ITEMS_DROPABLE
		new stray_items = 0
		do
		{
			stray_items = find_ent_by_class(stray_items,"wc3item")
			if(stray_items > 0)
				remove_entity(stray_items)
		}
		while(stray_items)
		#endif	
	}
to

Code: Select all

	if(gNewSpawn && gRoundOver)
	{
		gNewSpawn = false
		bFreezeTime = true
		if(get_cvar_num("mp_changeracewithbuytime") == 1)
			set_task(get_cvar_float("mp_buytime")*60.0,"end_buytime", 10987)
			
		#if ITEMS_DROPABLE
		new stray_items = 0
		do
		{
			stray_items = find_ent_by_class(stray_items,"wc3item")
			if(stray_items > 0)
				remove_entity(stray_items)
		}
		while(stray_items)
		#endif	
	}
Change #2:

Code: Select all

public start_round()
{
	bFreezeTime = false
		
	gRoundOver = false
to

Code: Select all

public start_round()
{
	if(get_cvar_num("mp_changeracewithbuytime") == 0)
		bFreezeTime = false
		
	gRoundOver = false
Change #3:

Add this function. I put it after start_round():

Code: Select all

public end_buytime()
{
	bFreezeTime = false;
	
	return PLUGIN_CONTINUE
}
Change #4:

Code: Select all

	register_cvar("mp_allowchangerace","0",0)
	register_cvar("mp_changeracepastfreezetime","0",0)
	#if ORCNADE_CVAR
		register_cvar("mp_alloworcnade","1",0)
	#endif
to

Code: Select all

	register_cvar("mp_allowchangerace","0",0)
	register_cvar("mp_changeracepastfreezetime","0",0)
	register_cvar("mp_changeracewithbuytime","0",0)
	#if ORCNADE_CVAR
		register_cvar("mp_alloworcnade","1",0)
	#endif
-< www.gamehavoc.com >-

Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!

Gunny
Peon
Posts: 36
Joined: Mon Dec 05, 2005 6:24 pm
Location: Magnolia, Texas
Contact:

Post by Gunny » Fri May 11, 2007 9:25 am

I made the changes, some of the code wasn't listed exactly as you posted, it had different spacing but I replaced it as per your instructions, at least I think I did all correctly.

Anyway I am getting more compile errors.

Code: Select all

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

warcraft3.sma(1885) : warning 217: loose indentation
warcraft3.sma(2117) : warning 217: loose indentation
warcraft3.sma(2117) : error 029: invalid expression, assumed zero
warcraft3.sma(2117) : error 017: undefined symbol "end_buytime"
warcraft3.sma(2125) : warning 225: unreachable code

2 Errors.
Could not locate output file warcraft3.amx (compile failed).
war3xp@avara:~/hlds/cstrike/addons/amxmodx/scripting$
It might be best if I just post my sma that I am working with and you can look at it.

Thanks for all your help.

You can see my sma at this link.
http://dm1.tdow.net/war3xp/warcraft3.sma
-john

User avatar
ferret
Lead Warcraft 3 XP Developer
Posts: 422
Joined: Wed Jul 06, 2005 8:20 am
Location: Atlanta, GA
Contact:

Post by ferret » Fri May 11, 2007 12:06 pm

Don't put

Code: Select all

	public end_buytime()
{
	bFreezeTime = false;
   
   return PLUGIN_CONTINUE
}
Inside of start_round(). Move it to after it, after this:

Code: Select all

	}

	return PLUGIN_CONTINUE
}
That's the line 2117 error. The loose indentation warnings don't matter. The 225 warning is related to the errors above it.
-< www.gamehavoc.com >-

Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!

User avatar
ferret
Lead Warcraft 3 XP Developer
Posts: 422
Joined: Wed Jul 06, 2005 8:20 am
Location: Atlanta, GA
Contact:

Post by ferret » Fri May 11, 2007 12:10 pm

Your original compile error is unrelated to the changes I made. There seems to have been a change in AMXX that has caused one of the messages (French description of blood elf skills) to be too long. I'll research and fix later... If it still happens, do this:

find:

Code: Select all

			format(title,63,"Competences des %s.",racename[5])
			message = "<HTML><head></head><pre><body bgcolor=#000000><font color=#FFB000>Armure Enchanter: Te donne l'armure complete plus (%d, %d, %d) au commencement du round.<p>\
			Mana de Protection: Tous les dmg non mortels que tu prendras seront réduits par (%d%%, %d%%, %d%%).<p>\
			La Soif de Sang: Ajoute (%d, %d , %d) de dmg à chaque balle et la vitesse de l'ennemi est reduite temporairement.<p>\
			Ultimate, L'ombre de Frappe: Emet une puissante force destructrice à un ennemi qui est dans ton champs de vision."
			format(message,2047,message,p_crimsonarmor[0],p_crimsonarmor[1],p_crimsonarmor[2],floatround(p_manashield[0]*100),floatround(p_manashield[1]*100),floatround(p_manashield[2]*100),p_bloodlust[0],p_bloodlust[1],p_bloodlust[2])
change to:

Code: Select all

			format(title,63,"Competences des %s.",racename[5])
			message = "<HTML><head></head><pre><body><font>Armure Enchanter: Te donne l'armure complete plus (%d, %d, %d) au commencement du round.<p>\
			Mana de Protection: Tous les dmg non mortels que tu prendras seront réduits par (%d%%, %d%%, %d%%).<p>\
			La Soif de Sang: Ajoute (%d, %d , %d) de dmg à chaque balle et la vitesse de l'ennemi est reduite temporairement."
			format(message,2047,message,p_crimsonarmor[0],p_crimsonarmor[1],p_crimsonarmor[2],floatround(p_manashield[0]*100),floatround(p_manashield[1]*100),floatround(p_manashield[2]*100),p_bloodlust[0],p_bloodlust[1],p_bloodlust[2])
I deleted a bit of text, should make it small enough. This is probably due to Bailopan making the error checking in the compiler better, and its catching old bugs that have existed for years and years.
-< www.gamehavoc.com >-

Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!

Gunny
Peon
Posts: 36
Joined: Mon Dec 05, 2005 6:24 pm
Location: Magnolia, Texas
Contact:

Post by Gunny » Fri May 11, 2007 1:55 pm

ferret wrote:Don't put

Code: Select all

	public end_buytime()
{
	bFreezeTime = false;
   
   return PLUGIN_CONTINUE
}
Inside of start_round(). Move it to after it, after this:

Code: Select all

	}

	return PLUGIN_CONTINUE
}
That's the line 2117 error. The loose indentation warnings don't matter. The 225 warning is related to the errors above it.
Ah, I was not sure about where to place that, Thanks

After making the changes this one compiled with only 2 warnings

Code: Select all

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

warcraft3.sma(1890) : warning 217: loose indentation
warcraft3.sma(9571) : warning 217: loose indentation
Header size:           5592 bytes
Code size:           224976 bytes
Data size:           123380 bytes
Stack/heap size:      24576 bytes; max. usage is unknown, due to recursion
Total requirements:  378524 bytes

2 Warnings.
Done.
and I fixed them and now I get no errors on compile.

Code: Select all

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Header size:           5592 bytes
Code size:           224976 bytes
Data size:           123380 bytes
Stack/heap size:      24576 bytes; max. usage is unknown, due to recursion
Total requirements:  378524 bytes
Done.
Testing this out now.

Here is the version that will compile with out any errors

http://dm1.tdow.net/war3xp/warcraft3.sma
THANKS !!!!!!
-john

Gunny
Peon
Posts: 36
Joined: Mon Dec 05, 2005 6:24 pm
Location: Magnolia, Texas
Contact:

Post by Gunny » Fri May 11, 2007 4:12 pm

The change race during Buytime seems to work fine but I am having issues with freezing. Players can't move at all sometimes after the buytime and at other times they can switch weapons and move after by time.
-john

User avatar
ferret
Lead Warcraft 3 XP Developer
Posts: 422
Joined: Wed Jul 06, 2005 8:20 am
Location: Atlanta, GA
Contact:

Post by ferret » Fri May 11, 2007 9:32 pm

Ugh. I know why. Too late tonight to fix, and moving tomorrow. I'll have you some more changes sometime this weekend.
-< www.gamehavoc.com >-

Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!

Gunny
Peon
Posts: 36
Joined: Mon Dec 05, 2005 6:24 pm
Location: Magnolia, Texas
Contact:

Post by Gunny » Sat May 12, 2007 9:14 pm

np, I am at work today and tomorrow is mothers day so it can wait until you have time especially since I know how it is to have to move. IT SUCKS
-john

User avatar
ferret
Lead Warcraft 3 XP Developer
Posts: 422
Joined: Wed Jul 06, 2005 8:20 am
Location: Atlanta, GA
Contact:

Post by ferret » Mon May 14, 2007 7:03 am

Try this one
Attachments
warcraft3.sma
WC3
(316.52 KiB) Downloaded 345 times
-< www.gamehavoc.com >-

Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!

Gunny
Peon
Posts: 36
Joined: Mon Dec 05, 2005 6:24 pm
Location: Magnolia, Texas
Contact:

Post by Gunny » Mon May 14, 2007 7:39 am

This is the error I get with this last one:

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

warcraft3.sma(2115) : error 017: undefined symbol "ChangeRaceTime"
warcraft3.sma(2115) : warning 217: loose indentation
warcraft3.sma(2115 -- 2117) : warning 215: expression has no effect
warcraft3.sma(2117) : warning 217: loose indentation

1 Error.
Could not locate output file warcraft3.amx (compile failed).
-john

User avatar
ferret
Lead Warcraft 3 XP Developer
Posts: 422
Joined: Wed Jul 06, 2005 8:20 am
Location: Atlanta, GA
Contact:

Post by ferret » Mon May 14, 2007 1:43 pm

Bleh typo
Attachments
warcraft3.sma
(316.52 KiB) Downloaded 391 times
-< www.gamehavoc.com >-

Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!

Post Reply