Announcement

Collapse
No announcement yet.

Custom crates with replenishing equipment

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom crates with replenishing equipment

    I feel it's rather silly how many mission makers, instead of using maybe 3 or 4 crates to put everything into just throw about 50 million crates because they can't figure out how to add anything to the crates or are too lazy. Well, it's rather easy actually. Here's a little SQF you can put in your mission for those of you who put down 5 weapon crates because they only have x amount of weapons or equipment and your JIP's/respawners always use them up.

    They can be used with any crate, or even some vehicles =)

    Code:
    //////////////////////////////////////////////////////////////////
    // [this] exec "MedicalBox.sqf"
    //////////////////////////////////////////////////////////////////
    
    _crate = _this select 0
    ~3
    #start
    _crate setdamage 0
    clearMagazineCargo _crate
    clearWeaponCargo _crate
    
    //Medical
    _crate addMagazineCargo ["ACE_Bandage", 100]
    _crate addMagazineCargo ["ACE_Morphine", 100]
    _crate addMagazineCargo ["ACE_Epinephrine", 100]
    ~300
    goto "start"
    It's pretty simple. After 3 seconds the SQF sets the crate's damage to 0 (in case, for whatever reason, somebody has shot it or blown it up), clears out all of the weapons and ammo, then adds in 100 bandages, 100 morphine, and 100 epinephrine. Then it waits 5 minutes, sets the crate's damage to 0, clears all weapons and ammo, essentially repeating itself every 5 minutes. (It clears all items so they don't just keep piling up.)

    Here's an example crate that adds a few basic weapons.
    Code:
    //////////////////////////////////////////////////////////////////
    // [this] exec "GearBox.sqf"
    //////////////////////////////////////////////////////////////////
    
    _crate = _this select 0
    ~3
    #start
    _crate setdamage 0
    clearMagazineCargo _crate
    clearWeaponCargo _crate
    
    //Weapons
    _crate addWeaponCargo ["ACE_M16A4_Iron", 20]
    _crate addWeaponCargo ["M16A4", 20]
    _crate addWeaponCargo ["M4A1", 20]
    _crate addWeaponCargo ["M4A1_AIM", 20]
    _crate addWeaponCargo ["ACE_M4A1_Eotech", 20]
    _crate addWeaponCargo ["ACE_SOC_M4A1", 20]
    _crate addWeaponCargo ["ACE_SOC_M4A1_Aim", 20]
    _crate addWeaponCargo ["ACE_SOC_M4A1_Eotech", 20]
    _crate addWeaponCargo ["M249", 20]
    _crate addWeaponCargo ["ACE_M249Para", 20]
    _crate addWeaponCargo ["M136", 20]
    //Magazines
    _crate addMagazineCargo ["30Rnd_556x45_Stanag", 200]
    _crate addMagazineCargo ["ACE_30Rnd_556x45_T_Stanag", 200]
    _crate addMagazineCargo ["200Rnd_556x45_M249", 100]
    _crate addMagazineCargo ["ACE_200Rnd_556x45_T_M249", 100]
    //Explosives
    _crate addMagazineCargo ["Handgrenade_West", 50]
    _crate addMagazineCargo ["SmokeShell", 50]
    _crate addMagazineCargo ["SmokeShellRed", 50]
    _crate addMagazineCargo ["SmokeShellGreen", 50]
    _crate addMagazineCargo ["SmokeShellBlue", 50]
    _crate addMagazineCargo ["PipeBomb", 50]
    _crate addMagazineCargo ["ACE_C4_M", 50]
    ~300
    goto "start"
    And here's a crate to add in various goggles, nightvision, and a few rucksacks.
    Code:
    //////////////////////////////////////////////////////////////////
    // [this] exec "EquipmentBox.sqf"
    //////////////////////////////////////////////////////////////////
    
    _crate = _this select 0
    ~3
    #start
    _crate setdamage 0
    clearMagazineCargo _crate
    clearWeaponCargo _crate
    
    //Goggles
    _crate addWeaponCargo ["ACE_GlassesLHD_glasses", 50]
    _crate addWeaponCargo ["ACE_GlassesTactical", 50]
    _crate addWeaponCargo ["ACE_GlassesGasMask_US", 50]
    _crate addWeaponCargo ["ACE_Earplugs", 50]
    _crate addWeaponCargo ["Binocular", 50]
    _crate addWeaponCargo ["NVGoggles", 50]
    _crate addWeaponCargo ["LaserDesignator", 10]
    _crate addMagazineCargo ["LaserBatteries", 20]
    _crate addWeaponCargo ["ACE_Rangefinder_OD", 10]
    _crate addMagazineCargo ["ACE_Battery_Rangefinder", 20]
    //Rucks
    _crate addWeaponCargo ["ACE_Rucksack_MOLLE_Green", 50]
    _crate addWeaponCargo ["ACE_Rucksack_MOLLE_Green_Medic", 10]
    _crate addWeaponCargo ["ACE_ANPRC77", 10]
    ~300
    goto "start"
    I am pretty sure this works in multiplayer. However, I have not tested it. In any case I just feel that custom weapon crates in missions are much more organized in general. The fewer weapons in the crates the less time it should take to gear up.

    If you want to make your own custom crates and want to add in ACE equipment, here's the class lists.
    Also, you should probably check out the ACEX classnames here, since most of the weapons are ACEX features

    (As an unrelated bonus for you awesome people, place down your player in the editor and add
    Code:
    this addweapon "ACE_Combat_Pack"
    to his init line. Go into the game and go into third person view. :row__689: The thought of going into battle like that... is ridiculous! :row__581:)

    EDIT: I also feel it should be noted I don't know much at all about scripting.


  • #2
    Re: Custom crates with replenishing equipment

    Minus infinity points for using a goto.

    Comment


    • #3
      Re: Custom crates with replenishing equipment

      Well I've got no idea what I'm doing so if there's a better way to do it I wouldn't know. All I'm saying is that I would prefer to actually dump the 'preset' crates and make them a bit more mission-specific. The whole 'refilling' thing would ensure that no matter how many times people remove stuff from the crates it always has something inside them...

      Comment


      • #4
        Re: Custom crates with replenishing equipment

        A good initiative, but a few points:
        • You're using .sqs syntax but name the files .sqf. Probably not a big deal in practice because afaik the engine doesn't care about the postfix, but still it's always a good thing to use the proper postfix according to the type of syntax used.
        • The above scripts won't work in multiplayer unless everyone has their own local ammo crate, or the contents of the crates are the same on all clients at all times. At the start they are, but if things get out of sync during the 5 minutes sleeps there's gonna be trouble.
        • Sqf is said to be slightly more efficient than sqs, and is the way to go in Arma2. Sqs is OFP-era stuff. Especially if you're just starting on scripting there's no reason to start with .sqs, just go straight to .sqf. The first script in .sqf would be:
          Code:
          //////////////////////////////////////////////////////////////////
          // [this] execVM "MedicalBox.sqf"
          //////////////////////////////////////////////////////////////////
          _crate = _this select 0;
          sleep 3;
          while {true} do
          {
          	_crate setdamage 0;
          	clearMagazineCargo _crate;
          	clearWeaponCargo _crate;
          
          	//Medical
          	_crate addMagazineCargo ["ACE_Bandage", 100];
          	_crate addMagazineCargo ["ACE_Morphine", 100];
          	_crate addMagazineCargo ["ACE_Epinephrine", 100];
          	sleep 300;
          };

        Comment


        • #5
          Re: Custom crates with replenishing equipment

          Thanks for the constructive post Fin =) I don't think I'm planning on getting into scripting, but I was in my own little test mission and I didn't have the semicolons or tabs and it was working just fine, so I figured they weren't needed. o_o

          As for SQF and SQS I was trying to figure out the difference between them. They said that SQS is called every time that it's activated but an SQF is always in the memory... I think?

          Comment


          • #6
            Re: Custom crates with replenishing equipment

            Sqs is line-based, so there's no need for semicolons. A line-break does the job. Tabs server no other purpose in either syntax other than increase readability of the code.

            Here's a good breakdown on the most important differences between .sqf and .sqs:
            http://community.bistudio.com/wiki/S...SQF_conversion

            Comment


            • #7
              Re: Custom crates with replenishing equipment

              Sorry Ozy, I didn't mean to come across as an asshat -- more of a programmer's joke than dickery, I promise.

              PS: Finc, although it makes probably no difference, you can make that script slightly more efficient by using while{alive} do.

              Comment

              Connect

              Collapse

              TeamSpeak 3 Server

              Collapse

              Advertisement

              Collapse

              Twitter Feed

              Collapse

              Working...
              X