Jump to content
Sign in to follow this  
rrores

CREATECENTER

Recommended Posts

Hello

I create a single mission with the side the west.

In order to be able to create units of the east use CREATECENTER (before createUnit).

Result: the units of the east do not attack

somebody knows that it happens?

Share this post


Link to post
Share on other sites

You need to use join or joinSilent to join the created unit into the group.

I don't know whether its a bug, or intended behaviour, but simply using:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _group createUnit ["SoldierWB", _position, [], 0, "NONE"]...does not work, you need to use join after that, like this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _group createUnit ["SoldierWB", _position, [], 0, "NONE"];

[_unit] join _group;

edit: by saying "it does not work", i mean that it does work (the unit is created) but then you have the problem you described, such as the unit isnt able to acquire targets.

btw. i already reported this as a bug some time ago.

edit 2: ooops! i am sorry, i got a little confused - either it is that you need to use the join, or that you need to use setFriend or place some unit of the appropriate side (see the comments on the bug report).

I am sorry, i am little "tired" and i am not sure which is which smile_o.gif

Share this post


Link to post
Share on other sites

I found that one out as well. It made no sense to me and it seems that no matter what i did they never attacked. I could get the east and west to fight but never the racs.

Share this post


Link to post
Share on other sites

thank you very much, I work well

Share this post


Link to post
Share on other sites
Quote[/b] ]I found that one out as well. I made no sense to me and it seems that no matter what i did they never attacked. I could get the east and west to fight but never the racs.

This will setup all three sides as hostile to each other. Run the script with just you as a civilian and no other units present.

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

_ECenter=CreateCenter EAST;

_RCenter=CreateCenter RESISTANCE;

_WCenter=CreateCenter WEST;

_EGroup=CreateGroup EAST;

_RGroup=CreateGroup RESISTANCE;

_WGroup=CreateGroup WEST;

_EUnit=_EGroup CreateUnit ["SoldierEB",GetPos Player,[],0,"FORM"];

_RUnit=_RGroup CreateUnit ["SoldierGB",GetPos Player,[],0,"FORM"];

_WUnit=_WGroup CreateUnit ["SoldierWB",GetPos Player,[],0,"FORM"];

EAST SetFriend [WEST,_Hostility];

WEST SetFriend [EAST,_Hostility];

EAST SetFriend [RESISTANCE,_Hostility];

RESISTANCE SetFriend [EAST,_Hostility];

WEST SetFriend [RESISTANCE,_Hostility];

RESISTANCE SetFriend [WEST,_Hostility];

_EUnit Reveal _WUnit;

_WUnit Reveal _EUnit;

_EUnit Reveal _RUnit;

_RUnit Reveal _EUnit;

_WUnit Reveal _RUnit;

_RUnit Reveal _WUnit;

It works for me, they all start shooting at each other.

@5133p39

I did not want to use the BTS as a forum. So I never replied to:

Quote[/b] ](btw. i don't get the part about "You cant determine how the mission designer sets up the friendly sides ..... simple command to read the mission settings", why would you need a command for that? and how come you don't know how mission designer set those settings??? - you are the mission designer, you are making the mission, so you know what the settings are - if the use of setFriend can help, then ok, no need for anything else.

ATM I'm not a mission maker, I'm making addons. So I have no control over how the mission is setup by the designer.

AFAIK it's impossible to identify who is friendly to who, if the sides do not exist when the mission starts i.e. like the code above. If the units are placed in the mission editor then it's easy enough.

Share this post


Link to post
Share on other sites

What about nearest enemy? that should say who is friendly or not i would think.

Share this post


Link to post
Share on other sites
Quote[/b] ]What about nearest enemy? that should say who is friendly or not i would think.

I'm currently using CountEnemy but you will still have the same problem with the nearest command to. When you create an AI center, it's friendly to everyone until told otherwise. Units placed in the editor get assign automaticaly.

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  

×