View previous topic :: View next topic |
Author |
Message |
CocoT

Joined: 14 Dec 2004 Posts: 599 Location: Belly-Gum
|
Posted: Thu Jul 05, 2007 10:06 pm Post subject: 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?  _________________ http://www.planetcocot.net/ |
|
Back to top |
|
 |
Orion

Joined: 12 Jan 2007 Posts: 413 Location: Brazil
|
Posted: Thu Jul 05, 2007 11:45 pm Post subject: |
|
|
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:
Code: |
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;
}
|
_________________ There's no signature here. Stop looking for one. |
|
Back to top |
|
 |
Electro
Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia
|
Posted: Fri Jul 06, 2007 12:11 am Post subject: |
|
|
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!  _________________ Unit reporting!
http://www.bendarling.net/ |
|
Back to top |
|
 |
CocoT

Joined: 14 Dec 2004 Posts: 599 Location: Belly-Gum
|
Posted: Fri Jul 06, 2007 9:38 am Post subject: |
|
|
Great! Thanks a lot, guys, it works fine now  _________________ http://www.planetcocot.net/ |
|
Back to top |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Fri Jul 06, 2007 2:25 pm Post subject: |
|
|
Wait. FrikBot....shooting entities....I don't see how that fits with either InfraRed or SpaceWalk..... |
|
Back to top |
|
 |
Entar

Joined: 05 Nov 2004 Posts: 422 Location: At my computer
|
|
Back to top |
|
 |
CocoT

Joined: 14 Dec 2004 Posts: 599 Location: Belly-Gum
|
Posted: Fri Jul 06, 2007 8:00 pm Post subject: |
|
|
...
/me tiptoes out of the thread...
... but trips on his own screenshot
... ouch! _________________ http://www.planetcocot.net/ |
|
Back to top |
|
 |
|