Jump to content
Sign in to follow this  
Op4 BuhBye

Array expected Object

Recommended Posts

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?

Share this post


Link to post
Share on other sites

That worked thanx, but you cant use the "addmagazinepool" command with the quantity?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
{_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 ["30Rnd_545x39_AK",8]

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

Share this post


Link to post
Share on other sites

If I dont put the L/R brackets around the quanity I get an error. It only works with them.

And thanx Fasad

Share this post


Link to post
Share on other sites
If I dont put the L/R brackets around the quanity I get an error. It only works with them.

And thanx Fasad

You're probably getting an error from something else, because putting brackets around it turns it into an array, where it should be a number.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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's adding weapons into a campaign weapon pool; there'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't seem to understand).

Share this post


Link to post
Share on other sites

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! No not in that syntax, but I did add multiple mags with a single command.

Share this post


Link to post
Share on other sites
No not in that syntax, but I did add multiple mags with a single command.

I guarantee you it wasn't addWeaponPool, because that command doesn't do anything regarding a unit'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 "30Rnd_545x39_AK"} forEach [1,2,3,4,5,6,7,8]

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×