Results 1 to 6 of 6

Thread: createCenter and createGroup

  1. #1
    Master Gunnery Sergeant 5133p39's Avatar
    Join Date
    Feb 2 2004
    Location
    Czech Republic
    Posts
    1,383

    Unhappy

    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?



    MSI P55-GD65 | Core i5 750 @ 2.67GHz | 4GB DDR3 | ATI HD 5970 (Asus EAH5970​/G​/2DIS​/2GD5) | OCZ Revo 120GB PCIe SSD | 2x OCZ Vertex 4 120GB |
    Windows 7 64bit Home Premium | Catalysts 13.1 | ArmA2 OA 1.62.0.101480 (beta) +BAF +PMC +ACR | ArmA2 1.11.0.86734 | ArmA 1.18.0.5281 | OFP 1.0.0.96

    Be smart, use Sprocket!

  2. #2
    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.

  3. #3
    Master Gunnery Sergeant 5133p39's Avatar
    Join Date
    Feb 2 2004
    Location
    Czech Republic
    Posts
    1,383
    Author of the Thread
    Quote Originally Posted by (b1sh0p @ Dec. 11 2006,07: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.
    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?

  4. #4
    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 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]

  5. #5
    Master Gunnery Sergeant 5133p39's Avatar
    Join Date
    Feb 2 2004
    Location
    Czech Republic
    Posts
    1,383
    Author of the Thread
    Quote Originally Posted by (UNN @ Dec. 11 2006,18: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 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.

  6. #6
    Master Gunnery Sergeant 5133p39's Avatar
    Join Date
    Feb 2 2004
    Location
    Czech Republic
    Posts
    1,383
    Author of the Thread
    PROBLEM SOLVED - check the first post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •