PDA

View Full Version : createCenter and createGroup



5133p39
Dec 11 2006, 03:33
14.12.2006 23:33 EDIT: Problem solved:
After you create the unit, you must Join the unit with the group.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">NPC_SIDE = CreateCenter Civilian;
NPC_GRP = CreateGroup NPC_SIDE;
_u = NPC_GRP createUnit &#91;_type, _pos, &#91;&#93;, _r, &#34;NONE&#34;&#93;;
&#91;_u&#93; Join NPC_GRP;
[/QUOTE]



Problem description:
I am creating new units with the following lines of code:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">NPC_SIDE = CreateCenter Civilian;
NPC_GRP = CreateGroup NPC_SIDE;
_u = NPC_GRP createUnit &#91;_type, _pos, &#91;&#93;, _r, &#34;NONE&#34;&#93;;[/QUOTE]
The problem is that the command ...<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Side Group _u[/QUOTE]... is returning UNKNOWN side as it&#39;s result - i would expect it would return the CIV side.
(all the units are really created, so it&#39;s not a problem with referencing nonexisting unit, also, when i join the units with west player as their leader, then it returns the correct WEST side - so the problem lies somewhere within the scope of createCenter and createGroup commands)

What am i doing wrong?

b1sh0p
Dec 11 2006, 05:20
This is just a stab in the dark, but might the "side" in the side group _u command refer to a particular side? In which case, "side group _u" wouldn&#39;t refer to any side in particular... I would think that "side" would refer to east, west, or any "center" that you created.

perhaps try

NPC_SIDE group _u

Again, just a stab in the dark, since I&#39;ve not used these commands before. But just at first glance, that&#39;s what came to mind.

5133p39
Dec 11 2006, 10:36
This is just a stab in the dark, but might the "side" in the side group _u command refer to a particular side? In which case, "side group _u" wouldn&#39;t refer to any side in particular... I would think that "side" would refer to east, west, or any "center" that you created.

perhaps try

NPC_SIDE group _u

Again, just a stab in the dark, since I&#39;ve not used these commands before. But just at first glance, that&#39;s what came to mind.
I don&#39;t think so - look at the example i wrote, when i join the unit with player&#39;s group (which is West), then it returns the correct value (West).
And the usage is: _side = Side group&#124;unit
The expression "Side" is a command, not a variable so you can&#39;t substitute it with the "NPC_SIDE" as you wrote.
Or maybe i didn&#39;t quite understood what you meant?

UNN
Dec 11 2006, 16:42
Are you sure NPC_GRP is valid? If you display it with Hint Format, you can soon see.

If you are getting a valid group, then perhaps it&#39;s the new CreateUnit (http://community.bistudio.com/wiki/createUnit_array) comamnd?

Why not try the old method to make sure:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">NPC_SIDE = CreateCenter Civilian;
NPC_GRP = CreateGroup NPC_SIDE;
_Type createUnit &#91;_pos,NPC_GRP&#93;;

WaitUntil {Count &#40;Units NPC_GRP&#41;&#62;0};

_u=&#40;Units NPC_GRP&#41; Select 0;[/QUOTE]

5133p39
Dec 13 2006, 20:51
Are you sure NPC_GRP is valid? If you display it with Hint Format, you can soon see.

If you are getting a valid group, then perhaps it&#39;s the new CreateUnit (http://community.bistudio.com/wiki/createUnit_array) comamnd?

Why not try the old method to make sure:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">NPC_SIDE = CreateCenter Civilian;
NPC_GRP = CreateGroup NPC_SIDE;
_Type createUnit &#91;_pos,NPC_GRP&#93;;

WaitUntil {Count &#40;Units NPC_GRP&#41;&#62;0};

_u=&#40;Units NPC_GRP&#41; Select 0;[/QUOTE]
NPC_GRP is vaild, and i can use it like usual (i can count units in the group, etc.)

But you were right - it is the new createUnit command.
With the old one it works (Side NPC_GRP returns CIV side).
So either the Biki info on this command is wrong, or i am doing something wrong, but i can&#39;t see it.

5133p39
Dec 14 2006, 21:37
PROBLEM SOLVED - check the first post.