Jump to content
Sign in to follow this  
Shark111

Groups, groups, groups!

Recommended Posts

Hello everyone. biggrin.gif First of all I'll tell you that I am new to mission editing in OFP, also if I have some experience about editing and programming. In my first serious mission (in development) I encountered these problems:

1) I didn't understand how to deal with groups and distinguish them from single objects. For example I created an infantry squadron, named the leader "patrol1". Then I wrote in the init of one of his men: team=group this; elem=count[team]; titletext[format["the number of elements in the group is %1", elem],"plain down"]

The preview of the mission answered: "the number of elements in group is 1". Why? They were 9 at least! mad.gif

2) I tried to use setgroupid in the init camp of the group leader, but the group resulted to be "Alpha Black" whatever I wrote. Is there any good guy who can explain me how to define groups and get their properties (number of elems, name etc.)?

Thank you (me setbehavoiour "Grateful!")

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 </td></tr><tr><td id="QUOTE">I wrote in the init of one of his men: team=group this; elem=count[team]; titletext[format["the number of elements in the group is %1", elem],"plain down"]

The preview of the mission answered: "the number of elements in group is 1". Why? <span id='postcolor'>

You were counting the number of arrays inside the element []

The result was: 1, because inside element [] was only the segment "team".

With your method, you placed the whole group (team) into

an array called "elem" as only one segment.

You should have used: elem=team

:this way you can transfer the whole array into the new name

(elem)

: OK, first to say: you don't need to put the result of counting

"team" into another string (elem=count[team]

Rather you can do this:

titletext[format["the number of elements in the group is %1", count team],"plain down"]

If you want to use the array elem, you could do this:

elem=team

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">

2) I tried to use setgroupid in the init camp of the group leader, but the group resulted to be "Alpha Black" whatever I wrote. Is there any good guy who can explain me how to define groups and get their properties (number of elems, name etc.)?<span id='postcolor'>

have you tried this?;

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

group setGroupId id

Operand types:

group: Object or Group

id: Array

Type of returned value:

None

Description:

Set group identity. Id format is [letter,color,picture] or [letter,color]. Letter is one of: "Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "Kilo", color is one of "GroupColor0" to "GroupColor7".

Example:

setGroupId ["Alpha", "GroupColor0"]<span id='postcolor'>

~S~ CD

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  

×