Setting a certain weapon

Topic created ยท 4 Posts ยท 78 Views
  • I am hosting a MW3 server with bot warfare mod.

    I like the bots to have same Title / Emblems / Gun / Attachment.

    I have manage to do the Title, Emblem and Gun but I cant do the attachment.

    The gun I want is the ACR with heartbeat.

    In MW2 I have done all the above even the gun using:
    self giveWeapon("masada_heartbeat_mp");

    but in MW3 I can give the gun using:
    self giveWeapon("iw5_acr_mp");

    but tried different ways to add in the heartbeat like the code for MW2. Unfortunately I can't get it to have the heartbeat monitor.

    Anyone know the filename for the ACR with Heartbeat or does it not work the same way as MW2



  • To answer your question, an ACR with only the heartbeat attachment would be iw5_acr_mp_heartbeat.
    If you want to copy paste without understanding just know that what you need is this

    newWeapon = "iw5_acr_mp_heartbeat";
    self GiveWeapon(newWeapon );
    self SetSpawnWeapon(newWeapon );

    If you want to understand then read below

    Note that giving a weapon only gives a weapon, it doesn't switch to that weapon.
    To switch to that weapon you need to use one of two functions to set that weapon as the current weapon.
    self SwitchToWeapon(weapon) gives the weapon normally
    self SetSpawnWeapon(weapon) gives the weapon instantly without playing the animation of when you get a new weapon. weapon has to be the exact same weapon code you use in GiveWeapon(weapon). You can't just pass the weapon's name, it needs the full name with the attachment, just like when you give it.

    Keep in mind that if you don't have a clean class beforehand or if you don't use self TakeAllWeapons() before giving weapons or if you don't use one of the two functions I gave above you can end up having 3 weapons, so I recommend using one of them unless you want 3 weapons.

    Also note that for some reason the game needs a specific order for some attachments so if you would add a thermal, acog or holographic sight then you would need to have the heartbeat first and then the scope. Other attachments go first for assault rifles.
    You can find these reverse cases in my script, for example here for assault rifles, should be self explanatory

    These two links can help you in the future, especially the first one since this is where I got all the reference from

  • And by the way, this is a modding question so I don't see why you posted in server support.
    The issue would be the same in a private match and the topic is GSC. No problem, just saying ๐Ÿ˜‰

  • Thanks for the info Resxt. I have all the other codes I just posted the most relevent to what I needed to get my issue across.

    Cheers for moving the post, it was a case of I could'nt see the wood for the trees

    Thanks again


Log in to reply