1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

[Solved] Setting the spawning ammo for a custom class

Discussion in 'Modding Help' started by Frikman, Jul 15, 2016.

  1. Frikman

    Frikman Bison Rider

    Messages:
    162
    Hi, I'd like to know what script determines how much ammo a character gets when switching classes. Say, if I have a "Archer2" class and he uses "mat_arrows2" as ammo, how could I make that class spawn with said ammo?
     
  2. blackjoker77777

    blackjoker77777 Haxor Tester
    1. Zen Laboratories

    Messages:
    441
    I'd consider having a look on the "CTF_GiveSpawnItems.as" script as a start, you can find it located in "..\Base\Rules\CTF\Scripts".
    Search for this:
    upload_2016-7-15_18-54-25.png
    Scroll down a bit.
    Now, you can easily change the amount of ammo a specific class would get, let's say the archer?
    upload_2016-7-15_18-55-30.png
    You can simply change the 30 value to change the amount of arrows it's going to get at the start of the round.

    About how to let the "archer2" get the "mat_arrows2" ammo spawned?
    Simple, just Copy that archer part and put it after the knights' one, later on edit it.
    upload_2016-7-15_19-1-49.png
    So the things to change are:
    • The class name (the blob one in other words).
    • The name of the ammo, it's case sensitive as well, just a reminder.
    • The amount of ammo, see that cute purple integer? that's it.
    • The ItemFlag::Something (we don't want to overwrite things or provoke havoc do we?).
    After doing that, we'll need to add ItemFlag::archer2 as flag by doing this:
    1) Start by searching for this:
    upload_2016-7-15_19-7-45.png
    2) You'd probably see this part if you scroll down a bit.
    upload_2016-7-15_19-8-54.png
    3) Simply add and edit it to the right one.
    upload_2016-7-15_19-10-34.png
    4) We're done with the CTF_GiveSpawnItems.as for now.
    After doing that, we're supposed to have a look on the "CTF_Structs.as" located in "..\Base\Rules\CTF\Scripts" as well.
    Simply find the ItemFlag namespace,
    upload_2016-7-15_19-22-31.png
    and add the archer2 there so that ItemFlag::archer2 would actually be a valid thing.
    It should look something like this, I guess.
    upload_2016-7-15_21-24-23.png
    Hopefully, this should do it. Good luck and most importantly have fun.
    Edit: I considered the name of the class as "archer2" (not "Archer2"), probably I missed that in your original post, please always remember to write it case sensitive while editing or creating your scripts.
     
    Last edited: Jul 15, 2016
    Sytoplasma, Frikman and makmoud98 like this.
  3. Frikman

    Frikman Bison Rider

    Messages:
    162
    Thanks man. This whole thing is kind of contra-intuitive, isn't it? Well, I'd like to say that the part of the CTF_Structs.as requires you to set things in the correct order. Placing the archer2 = 0x03 line after the Knight = 0x04 didn't work, but if you place them correctly on both CTF_Structs.as and CTF_GiveSpawnItems.as (meaning, the same order) it works fine c:
     
  4. blackjoker77777

    blackjoker77777 Haxor Tester
    1. Zen Laboratories

    Messages:
    441
    Oh yeah, I should have mentioned that, my bad.
    I actually wrote it that way to be sure the line we've added is easy to notice (the same reason I wrote it more spaced than the default ones); but you're right, I could have picked a value higher than 4 at least haha, I will fix the screenshot to avoid confusion either way.
    Also I'm glad I could help, good luck with your modding projects. :)
    Edit: changed the screenshot, thanks for letting me know and sorry for the confusion.
     
    Last edited: Jul 15, 2016