1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

Having bot fire on command

Discussion in 'Programming' started by Papapishu, Dec 2, 2001.

  1. Papapishu

    Papapishu 我是康

    Joined:
    Jun 18, 2001
    Messages:
    2,043
    Likes Received:
    0
    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?
     
  2. Silver_Ibex

    Silver_Ibex Member

    Joined:
    Feb 27, 2001
    Messages:
    654
    Likes Received:
    0
    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.
     
  3. eXoR

    eXoR Lead coder

    Joined:
    Oct 22, 2001
    Messages:
    36
    Likes Received:
    0
    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 :)
     
  4. navboy

    navboy New Member

    Joined:
    Jan 5, 2001
    Messages:
    340
    Likes Received:
    0
    It seems like i analyzed the TrapSpringer code when i was trying to modify it and it contains some great examples of making the bots fire a weapon, or at least points to same.
     
  5. Papapishu

    Papapishu 我是康

    Joined:
    Jun 18, 2001
    Messages:
    2,043
    Likes Received:
    0
    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?
     
  6. +RIP+Botje

    +RIP+Botje New Member

    Joined:
    Dec 8, 2001
    Messages:
    19
    Likes Received:
    0
    as far as i can tell, it isn't used in UT
    don't know for Unreal tho
     
  7. Papapishu

    Papapishu 我是康

    Joined:
    Jun 18, 2001
    Messages:
    2,043
    Likes Received:
    0
    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
     
  8. BondJamesBond

    BondJamesBond New Member

    Joined:
    Sep 23, 2001
    Messages:
    43
    Likes Received:
    0
    By the way...

    By the way, how do you use the Weapon.Fire(1); command?

    Thanks
     

Share This Page