PDA

View Full Version : Array expected Object



Op4 BuhBye
Apr 18 2007, 17:40
I keep getting the error "Array expected Object" with this line. Do I have a typo or can you not do this with these commands?

[i1,i2,i3,i4,i5] addweapon ["ak74"]]#;[i1,i2,i3,i4,i5] addmagazinepool ["30Rnd_545x39_AK",[8]]

I have tried it 50 differant ways and cant get this to work.

With what I have up top I get missing ; at the # sign?

Platoon_Patton
Apr 18 2007, 17:56
Try

{_x addmagazine "30Rnd_545x39_AK"}ForEach [i1,i2,i3,i4,i5]

{_x addweapon "ak74"}ForEach [i1,i2,i3,i4,i5]

Op4 BuhBye
Apr 18 2007, 21:59
That worked thanx, but you cant use the "addmagazinepool" command with the quantity?

fasad
Apr 19 2007, 01:07
see the wiki : addMagazinePool (http://community.bistudio.com/wiki/addMagazinePool)

Op4 BuhBye
Apr 19 2007, 04:08
Yes I have that and have read it. This is using the same command in a differant context.

This works: {_x addmagazine "30Rnd_545x39_AK"}ForEach{i1,i2,i3,i4,i5]


This doesn't: {_x addmagazinepool ["30Rnd_545x39_AK"[,8]}ForEach [i1,i2,i3,i4,i5]

It works with AddWeapon" but I want to use it to add mags to multiple units and I cant get it to work. So I wanted to know if Im typing it wrong or if it cant be used this way and you need to type it 8 times for each unit with the "AddMagazine" command.

Thanx for the pointer though.

fasad
Apr 19 2007, 04:38
You can't use the addMagazinePool command in any context other than it's purpose - adding magazines to the campaign magazine pool, not to individual units.

It's unfortunate, but there is no addMagazine [type,number] command. You need to repeat addMagazine type x times. It's a bit ugly but has no other negative impact.

Big Dawg KS
Apr 19 2007, 05:25
{_x addmagazinepool ["30Rnd_545x39_AK"[,8]}ForEach [i1,i2,i3,i4,i5]
Aside from what fasad said, your syntax there is messed up, it should simply look like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">addmagazinepool &#91;&#34;30Rnd_545x39_AK&#34;,8&#93;[/QUOTE]

And you can&#39;t try to change the sytnax if it&#39;s not listed as a proper one on the Biki, each command has it&#39;s own syntax so don&#39;t try to be creative with the syntax you use.

Op4 BuhBye
Apr 19 2007, 05:42
If I dont put the L/R brackets around the quanity I get an error. It only works with them.

And thanx Fasad

Big Dawg KS
Apr 20 2007, 11:11
If I dont put the L/R brackets around the quanity I get an error. It only works with them.

And thanx Fasad
You&#39;re probably getting an error from something else, because putting brackets around it turns it into an array, where it should be a number.

Op4 BuhBye
Apr 20 2007, 22:59
w1 addmagazinepool ["30Rnd_545x39_AK",8]

I got this to work screwing around with the syntax and I cant figure out how I did it. If I do it again Ill post it here.

Big Dawg KS
Apr 21 2007, 02:20
w1 addmagazinepool ["30Rnd_545x39_AK",8]

I got this to work screwing around with the syntax and I cant figure out how I did it. If I do it again Ill post it here.
That syntax is STILL wrong... addMagazinePool does not take any unit/object as an arguement, since it&#39;s adding weapons into a campaign weapon pool; there&#39;s no target unit here, thus NOTHING goes before the command. Get rid of that w1 and it will work. I suggest you start paying attention to the Biki (by actually READING it), because it clearly explains how to use this command and what it does (which you obviously don&#39;t seem to understand).

Op4 BuhBye
Apr 21 2007, 03:50
Since you feel like getting snooty. I am aware of the syntax and of the wiki.

What I said WAS I got this command to work,(work meaning that I used a variant of this to add muliple mags to a soldier) and I cant figure out how I did it again. IT WORKED&#33; No not in that syntax, but I did add multiple mags with a single command.

Big Dawg KS
Apr 21 2007, 19:24
No not in that syntax, but I did add multiple mags with a single command.
I guarantee you it wasn&#39;t addWeaponPool, because that command doesn&#39;t do anything regarding a unit&#39;s weapons. You probably did something like:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{this addMagazine &#34;30Rnd_545x39_AK&#34;} forEach &#91;1,2,3,4,5,6,7,8&#93;[/QUOTE]