Adding new functions to frikbots?
Moderator: InsideQC Admins
5 posts
• Page 1 of 1
Adding new functions to frikbots?
Hi,
I have 2 new impulsecommands for my Knife and for Placing Landmines in the game:
WEAPONS.QC
How can i add these functions to the frikbots?
The knife attack should only used in close combat / when the bot doesnt have ammo, and the landmine thing does only work when you have IT_ROCKETS, and should be placed on some
palced like doors or when you can pick up weapons...
I have 2 new impulsecommands for my Knife and for Placing Landmines in the game:
WEAPONS.QC
- Code: Select all
if (self.impulse == 13)
KnifeAttck(); // Knife Attack
if (self.impulse == 14)
DropBetty (); //Place Landmine
How can i add these functions to the frikbots?
The knife attack should only used in close combat / when the bot doesnt have ammo, and the landmine thing does only work when you have IT_ROCKETS, and should be placed on some
palced like doors or when you can pick up weapons...
-

dr_mabuse - Posts: 80
- Joined: Sat Sep 03, 2011 6:07 pm
Re: Adding new functions to frikbots?
I did something very similar with iHalo a long time ago, there may be a better way of doing it, but what I did was:
In this section of bot_fight.qc
See the bot_shoot? Well what I did was add an argument
I can't seem to find my iHalo source anywhere, but thats about what I did and got the effect I wanted. There may be a better way however.
But if your knife attack is a replacement to the IT_AXE and is its own IT_WEAPON then you would have to edit the weapon_range code in bot_fight.qc and the frikbots should be able to use it then, same goes for the betty. The code I showed you assumes that your melee is a secondary attack like Halo.
In this section of bot_fight.qc
- Code: Select all
// decide if I should shoot
foedist = vlen(org - self.origin);
v = weapon_range(self.weapon);
if (foedist > v_y && foedist < v_z)
{
traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * v_z, FALSE, self);
if (vlen(trace_endpos - (self.origin + self.view_ofs)) >= v_y)
{
// try to avoid shooting teammates
if (trace_ent.classname == "player")
if ((trace_ent.team == self.team && teamplay) || (coop))
return;
bot_shoot();
}
}
See the bot_shoot? Well what I did was add an argument
- Code: Select all
if( (vlen(self.origin - self.enemy.orgin) < 64) || (random() < 0.2) ) //We want to be close enough to attack, but we dont always want to melee when close
KnifeAttck();
else
bot_shooot();
I can't seem to find my iHalo source anywhere, but thats about what I did and got the effect I wanted. There may be a better way however.
But if your knife attack is a replacement to the IT_AXE and is its own IT_WEAPON then you would have to edit the weapon_range code in bot_fight.qc and the frikbots should be able to use it then, same goes for the betty. The code I showed you assumes that your melee is a secondary attack like Halo.
- Ghost_Fang
- Posts: 336
- Joined: Thu Nov 12, 2009 4:37 am
Re: Adding new functions to frikbots?
thanks 
And yes, i have plans to remove my IT_AXE to make place for a new weapon, and the new "Axe" is called by my Impulse 13 now (look and feel from Call of Duty).
My Betty thing works the same way...
EDIT: i dont have tested your method atm but i think it wont work this way, because the "KnifeAttck" is in weapons.qc, and the botstuff comes after defs.qc and it will give a compile error (unknown value "KnifeAttck")
And yes, i have plans to remove my IT_AXE to make place for a new weapon, and the new "Axe" is called by my Impulse 13 now (look and feel from Call of Duty).
My Betty thing works the same way...
EDIT: i dont have tested your method atm but i think it wont work this way, because the "KnifeAttck" is in weapons.qc, and the botstuff comes after defs.qc and it will give a compile error (unknown value "KnifeAttck")
-

dr_mabuse - Posts: 80
- Joined: Sat Sep 03, 2011 6:07 pm
Re: Adding new functions to frikbots?
Just go here:
and right above bot_fight_style =
add void() KnifeAttck;
Like so.
What this does is tells your compiler that you have defined this somewhere farther down the compile line, but you want to use it NOW! That should fix that error.
- Code: Select all
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Bot_fight_style
This is the core of the bot's thinking when
attacking an enemy.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
void() bot_fight_style =
and right above bot_fight_style =
add void() KnifeAttck;
- Code: Select all
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Bot_fight_style
This is the core of the bot's thinking when
attacking an enemy.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
void() KnifeAttck;
void() bot_fight_style =
Like so.
What this does is tells your compiler that you have defined this somewhere farther down the compile line, but you want to use it NOW! That should fix that error.
- Ghost_Fang
- Posts: 336
- Joined: Thu Nov 12, 2009 4:37 am
Re: Adding new functions to frikbots?
*Facepalm* lol, ofcourse, thx for reminding me...
I should not drink and mod anymore xD
Anyways, it works now
I should not drink and mod anymore xD
Anyways, it works now
-

dr_mabuse - Posts: 80
- Joined: Sat Sep 03, 2011 6:07 pm
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest