Page 1 of 1

[GENERAL] Share your code and questions

Posted: Wed Sep 18, 2013 10:45 pm
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

Re: [GENERAL] Share your code and questions

Posted: Sat Jan 03, 2015 11:50 am
by zaomaohao
BOTS USES ONLY GAUNTLET I think it must me changed to something new

Re: [GENERAL] Share your code and questions

Posted: Sat Jan 03, 2015 2:57 pm
by Eraser
https://code.google.com/p/entityplus/so ... unk%2Fcode

'nuff said :smirk:

Re: [GENERAL] Share your code and questions

Posted: Sun Jan 04, 2015 4:23 am
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

Re: [GENERAL] Share your code and questions

Posted: Mon Jan 05, 2015 9:03 am
by Eraser
Just give a player a temporary speed boost in the correct direction?

Re: [GENERAL] Share your code and questions

Posted: Mon Jan 05, 2015 11:12 am
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?