wc3ft with bots - fix

Want to talk about war3ft or make suggestions? Post them here

Moderator: Forum Moderator

Post Reply
mexykanu
Rifleman
Posts: 176
Joined: Sun Oct 22, 2006 8:06 am

wc3ft with bots - fix

Post by mexykanu » Sat Dec 30, 2006 3:51 pm

[FOR ADMINS]Before thinking about deleting, i want to say that i searched a day for how to do this, and i finally got it... by myself (my coding is close to 0) and i tought other people might need this too.


FOR VERSION 2.3.2, if you want bot_buy_item 0 (bots not allowed to buy items), it doesn't work: you have to search events.inl for this:

Code: Select all

	if(is_user_bot(id)){
		new Float:randomnumber = random_float(0.0,1.0)
		if (randomnumber <= iCvar[FT_BOT_BUY_ITEM]){
			new num = random_num(1,2)
			if (num == 1)
				_menu_Shopmenu_One(id, random_num(0,8))
			else
				_menu_Shopmenu_Two(id, random_num(0,8))
		}
		if (randomnumber <= 0.06){
			p_data[id][P_XP]=xplevel[floatround(random_float(0.0,3.16)*random_float(0.0,3.16))]
			p_data[id][P_RACE] = random_num(1,iCvar[FT_RACES])
		}
	}
and replace it with this:

Code: Select all

//	if(is_user_bot(id)){
//		new Float:randomnumber = random_float(0.0,1.0)
//		if (randomnumber <= iCvar[FT_BOT_BUY_ITEM]){
//			new num = random_num(1,2)
//			if (num == 1)
//				_menu_Shopmenu_One(id, random_num(0,8))
//			else
//				_menu_Shopmenu_Two(id, random_num(0,8))
//		}
//		if (randomnumber <= 0.06){
//			//p_data[id][P_XP]=xplevel[floatround(random_float(0.0,3.16)*random_float(0.0,3.16))]
//			p_data[id][P_RACE] = random_num(1,iCvar[FT_RACES])
//		}
//	}
then recompile

Code: Select all

amxxpc warcraft3FT.sma
(guess u already knew that... and u got it.

If you want to disable the bot's ultimates post here, if the topic still exists :D

P.S.: not sure if i should post here... anyway

User avatar
YamiKaitou
Forum Moderator
Forum Moderator
Posts: 1925
Joined: Wed Feb 01, 2006 4:33 pm
Contact:

Post by YamiKaitou » Sat Dec 30, 2006 3:54 pm

I guess good work, but 2.3.2 is soon to be out-of-date
Image

No support via PM or Email

User avatar
Geesu
<b>King of the world!</b>
Posts: 3159
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Post by Geesu » Sat Dec 30, 2006 4:55 pm

That also prevents bots from changing their race...

but question - why don't you just set the cvar bot_buy_item to 0? Wouldn't this accomplish the same thing of bots not buying items?
No Support via PM

User avatar
YamiKaitou
Forum Moderator
Forum Moderator
Posts: 1925
Joined: Wed Feb 01, 2006 4:33 pm
Contact:

Post by YamiKaitou » Sat Dec 30, 2006 5:34 pm

If the randomnumber is always going to be between 0.0 and 1.0, then setting the bot_buy_item to 0 won't do squat. In this line, it is a less than or equal to sign.
[small]if (randomnumber <= iCvar[FT_BOT_BUY_ITEM]){[/small]

It should be this
[small]if (randomnumber < iCvar[FT_BOT_BUY_ITEM]){[/small]
Image

No support via PM or Email

User avatar
Geesu
<b>King of the world!</b>
Posts: 3159
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Post by Geesu » Sat Dec 30, 2006 5:36 pm

ok I see what you're saying - but the chance of it being 0 is VERY slim ya know? But I see what you're saying... I'll change that for the 3.0 RC4
No Support via PM

mexykanu
Rifleman
Posts: 176
Joined: Sun Oct 22, 2006 8:06 am

Post by mexykanu » Sun Dec 31, 2006 6:46 am

as i said, if you set bots_buy_item 0, 1 out of 10 still buys an item.. my guess is you should make a function or something that makes the bot buy an item, and when it is 0, the plugin skips the function. when <> 0 it buys... don't know how to say this... uses the function with the chance :D

User avatar
YamiKaitou
Forum Moderator
Forum Moderator
Posts: 1925
Joined: Wed Feb 01, 2006 4:33 pm
Contact:

Post by YamiKaitou » Sun Dec 31, 2006 10:41 am

Such as this?

[small]if (iCvar[FT_BOT_BUY_ITEM] != 0 || randomnumber < iCvar[FT_BOT_BUY_ITEM]){[/small]
Image

No support via PM or Email

User avatar
Geesu
<b>King of the world!</b>
Posts: 3159
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Post by Geesu » Sun Dec 31, 2006 8:17 pm

this has been committed for RC4 - FYI
No Support via PM

mexykanu
Rifleman
Posts: 176
Joined: Sun Oct 22, 2006 8:06 am

Post by mexykanu » Thu Jan 04, 2007 3:36 am

YamiKaitou wrote:Such as this?

[small]if (iCvar[FT_BOT_BUY_ITEM] != 0 || randomnumber < iCvar[FT_BOT_BUY_ITEM]){[/small]
don't know what that means... what does "iCvar[FT_BOT_BUY_ITEM] != 0 " mean ?

User avatar
YamiKaitou
Forum Moderator
Forum Moderator
Posts: 1925
Joined: Wed Feb 01, 2006 4:33 pm
Contact:

Post by YamiKaitou » Thu Jan 04, 2007 11:24 am

It covers the slim chance that randomnumber can be 0. You cold also make it this and it will not do it at all if the cvar is 0.

[small] if (iCvar[FT_BOT_BUY_ITEM] != 0 && randomnumber < iCvar[FT_BOT_BUY_ITEM]){ [/small]
Image

No support via PM or Email

mexykanu
Rifleman
Posts: 176
Joined: Sun Oct 22, 2006 8:06 am

Post by mexykanu » Thu Jan 04, 2007 1:10 pm

i tought the translation was : if (iCvar[FT_BOT_BUY_ITEM] isn't = 0 and randomnumber etc etc

Post Reply