OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: madwolfnemesis on 12 Jul 2003, 08:54:25

Title: Function for counting magazine?
Post by: madwolfnemesis on 12 Jul 2003, 08:54:25
Is there a function to count the number of magazines left for a unit? I know there's a ammo count function, but it seems like there's no magazine count function eh? Anyone?
Title: Re:Function for counting magazine?
Post by: Sui on 12 Jul 2003, 12:43:46
If you use the command:

magazines unit

it will return an array of all magazines that unit is carrying...

You can use a count on that to get how many magazines the unit is carrying.... eg.

count (magazines unit)

That what you're after?
Title: Re:Function for counting magazine?
Post by: madwolfnemesis on 12 Jul 2003, 14:15:28
Do you know of any ways to expand the 10 magazine slots capped to perhaps, 20 or even more? Seems like having 10 magazine slots for each unit aren't enuff.
Title: Re:Function for counting magazine?
Post by: Tomb on 12 Jul 2003, 15:05:30
 :) Can do, but it'll take a tweaked unit if it is supposed to glide.

It's about tweaking the config (cpp) file of a soldier; read the tutes on the addons boards, m8  ;)
In short, what U need to do is to define the # of "weaponSlots" in a cpp file.


Ah well, wtf.  ::) ;D here's how:


WeaponSlots="1 + 16 + 2*4096 + 10*256";

This (in the "cfgVehicles" part of a cpp file) would make sure that our trooper has got
1 primary weapon, 1 Secondary WeaponSlot, 2 itemSlots (binocs & NV gogs) and 10 magazineSlots

What YOU need is to change the 10 to 14 or alike  :-* ;)



Title: Re:Function for counting magazine?
Post by: madwolfnemesis on 12 Jul 2003, 15:21:03
hey, thanks for the great help, I'll serahc for the tutorial. Anyway, I can't make my unit reload.

SC1 action["Reload Steyr"]

What's wrong with my script? SC1 is the name of the unit. I put this line in "SOP.sqs" and in init.sqs, I called it.

Basically, what SOP.sqs does is that it removes all weapons and add the weapon that I configured. It just can't reload.
Title: Re:Function for counting magazine?
Post by: KTottE on 12 Jul 2003, 16:30:28
Reload Steyr is not a valid action. You don't specify the weapon he reloads, just that he should reload. Why don't you try it with:

SC1 action["reload"]

edit

I've messed about with what Tomby told us here, and I found some things  out.

You can never exceed 15 for the number of items (WeaponSlotItem or 256), because then you will be left with only your primary + binoc-slots.
I'm also experiencing random crashes when I run it at 15. I will experiment more to see where the problem lies. Let's just hope it doesn't auto-crash if you go more than 10.

edit2
Okay, 14 seems stable enough. Need to check this some more, as I can't pick up any MGs. Might be that I've left out a slot or something.

edit3
Yup, if you have primary + secondary slots you can get MGs. And so far, 14 slots is stable. So you get 4 extra slots. *Drools over the thought of a BAS M249 SPW with 1400 rounds*

edit4
Okay, I like OFP now. *Really* like it.
Same PBO that worked 100% last night doesn't work at all today, it crashes the game.
*Kicks OFP and goes back to bed*
Title: Re:Function for counting magazine?
Post by: madwolfnemesis on 13 Jul 2003, 16:11:42
Hey, thanks but it didn't work. I treied putting it ina  script, SC1 action["reload"], it just didn't wanna reload! I'm going crazy!!!!
Title: Re:Function for counting magazine?
Post by: madwolfnemesis on 14 Jul 2003, 03:55:54
:) Can do, but it'll take a tweaked unit if it is supposed to glide.

It's about tweaking the config (cpp) file of a soldier; read the tutes on the addons boards, m8  ;)
In short, what U need to do is to define the # of "weaponSlots" in a cpp file.


Ah well, wtf.  ::) ;D here's how:


WeaponSlots="1 + 16 + 2*4096 + 10*256";

This (in the "cfgVehicles" part of a cpp file) would make sure that our trooper has got
1 primary weapon, 1 Secondary WeaponSlot, 2 itemSlots (binocs & NV gogs) and 10 magazineSlots

What YOU need is to change the 10 to 14 or alike  :-* ;)





Do it means that in my config.cpp file, under the CfgVehicles, I changed it and in my CfgNonAIvehicles, I put something like this:

class CfgNonAIVehicles
{
class proxyVehicles {};
class proxyMyNamedNewAIUnit : class proxyVehicles {};
}

Is this a way to do it?
Title: Re:Function for counting magazine?
Post by: deaddog on 14 Jul 2003, 04:44:00
If you want to just simply simulate being able to carry more M16 mags (for example) then use a script:

;addmagazine.sqs

_u=_this select 0

_ma=0

#check
~2
_c={_x=="m16"} count (magazines _u)
?_c >= 4:goto "check"

_u addmagazine "M16"
_u sidechat "magazine added"
_ma=_ma+1

?_ma<10:goto "check"

exit


Add,  [this] exec "addmagazine.sqs" to the init line of the unit you want to carry more mags.

This will automatically add 10 more mags to the unit.  That would be a total of 14 for a standard soldier.