Having bot fire on command

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Papapishu

我是康
Jun 18, 2001
2,043
0
0
43
void
www.vovoid.com
I'm working on a mod that requires the bot to change to a specific weapon (the chainsaw, don't worry, they have it) and fire it.
I'm lost in the AI code, anyone who has any idea?
 

Silver_Ibex

Member
Feb 27, 2001
654
0
16
And now for something incredibly stupid yet simple, have an invisible pawn set to enemy be spawned right in front of them whenever you need a bot to fire.
 

eXoR

Lead coder
Oct 22, 2001
36
0
0
38
Holland
exorcist.gamepoint.net
Granted you can get the bot to switch to the weapon, you presumably could call
<BotReference>.Weapon.Fire(1);

or first do a search in the Level.PawnList for Bots and then call those functions on 'em.

You could also try <BotReference>.Weapon.GotoState('Firing');
but I don't know if it'll work .. you could at least try :)
 

Papapishu

我是康
Jun 18, 2001
2,043
0
0
43
void
www.vovoid.com
I found a function called FindInventoryType(), and it returns a handle to a weapon the pawn has in the inventory, so if I would send it the class chainsaw it would return a handle to the bot's chainsaw.
Then I set their "pendingweapon" var to this value.
Then I probably just call the weapons "putdown" function to make them put down the old weapon, thus taking up the new one, the CS, voilá...
Hope that works...
Then I can call the bot.weapon.fire(1); function to make them fire it...
What does the value in the fire function do anyway?
 

Papapishu

我是康
Jun 18, 2001
2,043
0
0
43
void
www.vovoid.com
I got it working...
What I did was that I modified the flag (which is a parameter in deciding wheter the bots use the chainsaw) and when the flag saw the bot within the radius, it used the findinventorytype to get the CS up and then let the CS go into "NormalFire" state every tick, causing it to sound and it was acceptable by the check which states that if the chainsaw is in NormalFire state, everything's OK.
Check it out for yourself if you want to...
It's just a beta, so it's not perfect...The Timber! Mod