Jump to content
avibird 1

Need help to remove this commands- call{doStop this;}

Recommended Posts

Need some assist. I use this two commands in units init to stop movements of units within a group for placement in the AO at mission start. the dostop the units in a group will still move but not at mission start the units will still move to engage the enemy at some point. The DisableAI will not move to engage at all . I use the these commands in a trigger to delete the commands  call{_units = [AI1,AI2,AI3]; _units apply {_x enableAI "PATH"};}  and all the group members will move again but this commode in a trigger does not work to delete the commode  call{{ _x doFollow (leader _x); } forEach [AI4,AI5,AI6];}.  I  can setup a trigger for a distance or if a unit in the group is killed. How can I remove the call{{ _x doFollow (leader _x); } forEach [AI4,AI5,AI6];} to allow the group to move or follow its waypoints. it works great with the call{_units = [AI1,AI2,AI3]; _units apply {_x enableAI "PATH"};}  but can't remove the call{doStop this;} 

 

this two commands to stop unit movements into formations at mission start.

call{doStop this;} 

call{this disableAI "PATH";}

Share this post


Link to post
Share on other sites

Hello,

First of all, you don't need to wrap all codes into call {..} (but perhaps it's something automated with one of your mod).

Are you writing for SP? (because in MP, avoid writing in the init field of units). In MP, as you wrote, you could experience some weird behavior, by repeat of code and/or locality issue)
On my mind, the disabling "PATH" for AIs is enough and you don't have to use doStop. If you disable only "Path", there is no reason for the units to hold fire. They will engage enemies...

Share this post


Link to post
Share on other sites

This is for coop play/MP. I am not sure why I write the code this way I don't know any other way lol. I don't really read or write code I can merge codes together to get what I need. 

 

DoStop command is very different the disable path. DoStop works when I want to split up a group into different areas at mission strat. The units will move to engage when contact occurs but the group leader will hold its position but other units in the group will move. This works great with sentry hold and guard waypoints. 

 

 

With the disable I usually have a trigger setup that will remove the command if a units is killed or a unit moves into a trigger area. I can't remove the DoStop using a trigger like I do with the disable path command. 

 

I don't know if the commands work the someway..I just want to setup a trigger to remove the command if a unit is killed or a area is reached by a unit. Hope you understand. 

 

Can you explain why I should not use call {..} 

Share this post


Link to post
Share on other sites

call {...} just call a code you can run without it.

If I remember (not sure), this was a mean for avoiding compatibility errors between old and new editor (at 3den start If I'm right). Then CBA kept that for all trigger's conditions and act/deact or even init fields... Sure some people could explain that here, better than me.

 

In MP, you need to pay attention for where and where the codes are running. For example, all init fields of all units will run at server start AND each time a player joins. That can be fine or ugly, depending on what you intent to do: Running a code for loadout on some unit (no matter which one)  can re-initialize this loadout when a player joins. But also any script with setCaptive, setPos (teleportation)....  Fine?

You can avoid that by  if (isServer) then {<your code here>}; // running on server only...

 

Another important point is how commands (and functions) work and where. The commands can be "Argument local or global" and have "local or global effects".

Start here:

https://community.bistudio.com/wiki/Multiplayer_Scripting

 

By chance, here, doStop is AG EG, so the easiest case. You don't need to remoteExec it. As shown in BIKI, the right way for overwriting a doStop is doFollow (leader). This command is AL EG. That means you need to run it on same PC as (both) units (parameters). For AIs on server, run it on server (only).

So, let's say you wrote :  if (isServer) then {doStop this};   // in init field of units belonging to group1, supposed to follow some waypoints (edited).

The code runs at server start, and not at player(s) start(s).

Now, changing that, Any "server only" trigger can run:
{_x doFollow leader _x} forEach units group1;

You can test it by a radio trigger. I can't help about your trigger if you don't share it.

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites
21 minutes ago, pierremgi said:

Sure some people could explain that here, better than me.

 

Certainly not better, but I think that what happened was as you said - at some point there was an update to the game, after which if you opened a mission made prior to that update, you would see these call wrappers in init fields. I think it would also show up in mission.sqm, in the init entries for those objects.

 

Then people started copy/pasting their code with the wrapper, and now some people think it's necessary.

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

×