Jump to content
Sign in to follow this  
meveld

Really irritated newbie

Recommended Posts

I feel really stupid asking this cause it sounds so easy.

I've got a group of two people grouped together into group aP.

When I run this script with a radio code I keep getting an error

------------------------------------------------------------

_i = count units group aP;

exit

-----------------------------------------------

the script used to be a lot longer but this is the part that keeps screwing up, it keep saying 'expected object' when it messes up.

Could someone please tell me what the problem is, I'm ready to pull my hair out here.

I'm trying to get the game to recognize the group, sounds so easy.

Share this post


Link to post
Share on other sites

Haven't really used count command yet, but I don't think you need the group keyword in there. If I knew why you wanted to count then I might be able to help you more.

Share this post


Link to post
Share on other sites

I wanted to write a mission using the new script commands in Resistance that let you carry over soldiers from previous missions.

This is the only way I could figure to do it.

BIS uses that command alot in their scripts.

Share this post


Link to post
Share on other sites

meveld, I'm not sure what your going to use the count for, but this was successful in getting the count to show up as a Hint:

  Two soldiers created and grouped. In leader's init field:

   group aP = group this

  Then a radio trigger: Init: [] exec "count.sqs"

   count.sqs

   </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_i = count units aP

hint format ["There are %1", _i]

exit<span id='postcolor'>

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Crassus @ Aug. 02 2002,02:17)</td></tr><tr><td id="QUOTE">  Two soldiers created and grouped. In leader's init field:

   group aP = group this<span id='postcolor'>

To me it seems this code can never work. You can assign only to variable, not to the complex expression.

Valid assignment looks like:

groupAP = group this

This is invalid assignment:

group aP = group this

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (meveld @ Aug. 02 2002,00:01)</td></tr><tr><td id="QUOTE">I've got a group of two people grouped together into group aP.

When I run this script with a radio code I keep getting an error

------------------------------------------------------------

_i = count units group aP;<span id='postcolor'>

What is in the aP variable (how is it initialized)? Group or unit? If group, you should not use _i = count units group aP, but _i = count units aP;

Share this post


Link to post
Share on other sites

meveld, did we help you?

Suma, yeah thanks. Actually I did assign the group the correctly in the test run in OFP, I just didn't type it correctly in the Reply...Doh!!

Share this post


Link to post
Share on other sites

Thanks for all your help but in the hint it keeps saying 'there are <null>'

biggrin.gif  biggrin.gif

Sorry for the tone of my initial post, I had just spent an hour trying to get it to work and I was really frustrated.

Share this post


Link to post
Share on other sites

"Null" eh? Allow me to repost the code:

Again, I create and group two soldiers, and in the leader's/player's init field:

   </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">ap = group this<span id='postcolor'>

Now, a trigger:

   </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] exec "count.sqs"<span id='postcolor'>

count.sqs

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">c= count units aP

 hint format ["There are %1 in your team",c]

 exit<span id='postcolor'>

http://www.smartgroups.com/groups/crassusfile

The above link is where I've posted the mission.sqm and .sqs, in zip format. (Joining Smartgroups is free...)

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (meveld @ Aug. 03 2002,22:05)</td></tr><tr><td id="QUOTE">Thanks for all your help but in the hint it keeps saying 'there are <null>'<span id='postcolor'>

<null> is used when you try to print uninitialized variable. Variable may be uninitialized even after an assignment - if another unitialized variable was used in the assignment. Be sure you initialize all your variables properly.

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  

×