Getting Frikbot to shoot an entity
Moderator: InsideQC Admins
15 posts
• Page 1 of 1
Getting Frikbot to shoot an entity
Hi!
I'm playing around with a little something here and was wondering if there was an easy way to make a Frikbot shoot an entity that is not a player or a monster. Basically, I'm making the player create an entity and would like bots to shoot at it (while shooting at each other and/or the player). I've tried a couple of things but can't seem to make it work. Any suggestions?
I'm playing around with a little something here and was wondering if there was an easy way to make a Frikbot shoot an entity that is not a player or a monster. Basically, I'm making the player create an entity and would like bots to shoot at it (while shooting at each other and/or the player). I've tried a couple of things but can't seem to make it work. Any suggestions?
Neurotic Conversions - New location: Update your bookmarks!
-

CocoT - Posts: 695
- Joined: Tue Dec 14, 2004 5:39 pm
- Location: Belly-Gum
Yes!
You can do it pretty easily, search fot bot_dodge_stuff() at bot_fight.qc and add this in the (else) after (if (coop)) statement:
You can do it pretty easily, search fot bot_dodge_stuff() at bot_fight.qc and add this in the (else) after (if (coop)) statement:
- Code: Select all
local entity head;
head = findradius(self.origin, 9999);
while(head)
{
if(head.classname == "something")
{
if(head.health > 0)
{
tsz = bot_size_player(head) + vlen(head.origin - self.origin) * 0.5;
if (tsz < foesz)
{
if (fov(head) || head.b_sound > time || self.b_skill == 3)
{
if (fisible(head))
{
self.enemy = head;
foesz = tsz;
}
}
}
}
}
head = head.chain;
}
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
If you really want to shove things down its throat you could always just do:
self.enemy = targetentity;
at the end of BotAI
BotAI is called pretty often, so if it's an entity you already know.. should be fine, but you don't want to be doing a find here methinks.
Really depends on what you're using it for!
self.enemy = targetentity;
at the end of BotAI
BotAI is called pretty often, so if it's an entity you already know.. should be fine, but you don't want to be doing a find here methinks.
Really depends on what you're using it for!
Benjamin Darling
http://www.bendarling.net/
Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
http://www.reflexfps.net/
http://www.bendarling.net/
Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
http://www.reflexfps.net/
- Electro
- Posts: 312
- Joined: Wed Dec 29, 2004 11:25 pm
- Location: Brisbane, Australia
Great! Thanks a lot, guys, it works fine now 
Neurotic Conversions - New location: Update your bookmarks!
-

CocoT - Posts: 695
- Joined: Tue Dec 14, 2004 5:39 pm
- Location: Belly-Gum
Who said he's working on one of those two? CocoT seems to have a certain aptitude for working on multiple mods at a time... dum dum DUM!
-

Entar - Posts: 439
- Joined: Fri Nov 05, 2004 7:27 pm
- Location: At my computer
...
/me tiptoes out of the thread...
... but trips on his own screenshot
... ouch!
Neurotic Conversions - New location: Update your bookmarks!
-

CocoT - Posts: 695
- Joined: Tue Dec 14, 2004 5:39 pm
- Location: Belly-Gum
Re: Getting Frikbot to shoot an entity
I tried implementing the above code, but get this error message:
INDIRECT 13454(FOE)ENTITY 0 13077(_NEXT)._NEXT 13454(FOE)
BOT_FIGHT.QC : BOT_DODGE_STUFF
BOT_AI.QC : BOTAI
BOT_PHYS.QC : POSTPHYSICS
(NO FUNCTION)
RUNAWAY LOOP ERROR
The code compiles with no warnings.
INDIRECT 13454(FOE)ENTITY 0 13077(_NEXT)._NEXT 13454(FOE)
BOT_FIGHT.QC : BOT_DODGE_STUFF
BOT_AI.QC : BOTAI
BOT_PHYS.QC : POSTPHYSICS
(NO FUNCTION)
RUNAWAY LOOP ERROR
The code compiles with no warnings.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
Re: Getting Frikbot to shoot an entity
BotAI is called pretty often, so if it's an entity you already know.. should be fine, but you don't want to be doing a find here methinks.
Try Electro's method instead?
or wrap a counter there instead, like if c > 256 break;
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Re: Getting Frikbot to shoot an entity
Yea...that was getting errors as well. I tried that first. I have no idea what you said after that
or wrap a counter there instead, like if c > 256 break;
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
Re: Getting Frikbot to shoot an entity
any other help?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
Re: Getting Frikbot to shoot an entity
make sure you are not recursively calling findradius. it can potentially mess up the .next chain resulting in infinite loops (at least in dp where the order isn't guarenteed, but its a potential problem in any engine).
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: Getting Frikbot to shoot an entity
Thx Spike. I'll look into it.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
Re: Getting Frikbot to shoot an entity
When using Electros method of adding self.enemy = targetentity; at the end of BotAI().
I get an error while compiling: "Unknown value targetentity" and "type mismatch for = (pointer and _variant)
I get an error while compiling: "Unknown value targetentity" and "type mismatch for = (pointer and _variant)
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
Re: Getting Frikbot to shoot an entity
i think he means target1, target2, target3, self.enemy etc. for targetentity.
ok look up the function
priority_for_thing
add the classname and a priority to that function, might help.
ok look up the function
priority_for_thing
add the classname and a priority to that function, might help.
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
15 posts
• Page 1 of 1
Return to Artificial Intelligence
Who is online
Users browsing this forum: No registered users and 1 guest