[GENERAL] Share your code and questions

Locked
3xistence
Posts: 90
Joined: Sun May 13, 2012 3:02 pm

[GENERAL] Share your code and questions

Post by 3xistence »

Obviously, we are all a little jelous about the goals we reach with the code, also the small ones.
But i still think that share some random codes will help ourself to improve and also to find some nice clues about how to improve it.
So share a part of your "mods" and get a nice talk in order to improve it.

I will write it, in a raw way, part of my code about forcing bots to use only gauntlet inside a match:

Code: Select all

/*###########################
# BOTS USES ONLY GAUNTLET #
###########################
*/
mod on g_main.c
add
vmCvar_t	bot_onlygauntlet;
add
{ &bot_onlygauntlet, "bot_onlygauntlet", "0", CVAR_SERVERINFO, 0, qtrue  },
	
mod on g_local.h
extern	vmCvar_t	bot_onlygauntlet;

mod on ai_dmq3.c
on "void BotChooseWeapon(bot_state_t *bs) {"
	
	after the line
	"int newweaponnum;"
	
	add the following line
	if (bot_onlygauntlet.integer == 1){	//if the cvar is 1
		bs->weaponnum = 1;	//the selected weaponnum will be 1 = gauntlet you can specify also WP_GAUNTLET instead of 1
		return;	// stop here and don't go on with the other instruction
		}
	
ever on ai_dmq3.c
	check for "float BotAgression" and add // i don't know if is usefull add this stuff
	if (bot_onlygauntlet.integer == 1) {

	return 100;	// we want them aggressive and chasing the player also with gauntlet
	}

and also on "float BotFeelingBad"
change the first lines in order to figure like this
	if (bs->weaponnum == WP_GAUNTLET && bot_onlygauntlet.integer != 1) {
		return 100;
	}

	//the bot will feel bad with gauntlet but only if the bot_onlygauntlet cvar will be != 1 so theorically our bot_onlygauntlet
	//cvar will send back (if the cvar will be 1) a feelingbad == 0
That's what i do, i need to check it again but strangely the teammates bots on a >= GT_TEAM match will get angry with their teammates too and they tries to kill them like a FFA match
zaomaohao
Posts: 1
Joined: Sat Jan 03, 2015 11:46 am

Re: [GENERAL] Share your code and questions

Post by zaomaohao »

BOTS USES ONLY GAUNTLET I think it must me changed to something new
Unlike scam [url=http://www.braindumps.com/training/a-plus-exam.htm]a+ practice test[/url] dumps and itil v3 dumps training program, our best [url=http://www.braindumps.com/training/security-plus-test.htm]security+ questions[/url] and [url=http://www.braindumps.com/training/network-plus-test.htm]network+ certification[/url] online training courses provide you quick success in first try of icnd 640-822.
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Re: [GENERAL] Share your code and questions

Post by Eraser »

https://code.google.com/p/entityplus/so ... unk%2Fcode

'nuff said :smirk:
vinny
Posts: 57
Joined: Sun Feb 20, 2011 12:25 pm

Re: [GENERAL] Share your code and questions

Post by vinny »

I've been playing UT99 lately and i'm curious about how to implement some like the double movement key dash. If you quickly double-press any WASD key, the player dashes into that direction. Any ideas? :D
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Re: [GENERAL] Share your code and questions

Post by Eraser »

Just give a player a temporary speed boost in the correct direction?
vinny
Posts: 57
Joined: Sun Feb 20, 2011 12:25 pm

Re: [GENERAL] Share your code and questions

Post by vinny »

It's not really a speed boost, but more like a half-height horizontal jump. How can i detect a double tap like that?
Locked