meveld 0 Posted August 1, 2002 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
Sexacutioner 0 Posted August 1, 2002 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
meveld 0 Posted August 1, 2002 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
crassus 0 Posted August 2, 2002 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
suma 8 Posted August 2, 2002 </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
suma 8 Posted August 2, 2002 </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
crassus 0 Posted August 2, 2002 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
meveld 0 Posted August 3, 2002 Thanks for all your help but in the hint it keeps saying 'there are <null>' Â 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
crassus 0 Posted August 4, 2002 "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
suma 8 Posted August 5, 2002 </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