Jump to content

Recommended Posts

The command seems to work as one would except, but there is one objection one might have.

 

Most SQF commands that do stuff with arrays modify the already existing array instead of creating a new one.

 

Examples:

set, resize, pushBack, append, deleteAt, reverse, sort, deleteRange...

 

This behaviour of returning a new array is only shared with arrayIntersect (which is weird too), so the command feels out of place.

The name "apply" also kinda implies that the CODE is "applied" to the already existing array.

 

This is done in such a way because select and apply could be used together in sequence if needed

​[1,2,3,4,5] select {_x < 3} apply {_x ^ 2} select 0
  • Like 1

Share this post


Link to post
Share on other sites

You can do this with XEH InitPost (requires CBA)

// description.ext
class Extended_InitPost_EventHandlers {
  class CAManBase {
      class CUL_doStuff { init = "_this call CUL_doStuff;"; };
  };
}; 

You can change CAManBase to a specific classname etc 

There's also the upcoming CBA_fnc_addClassEventHandler

I realise CBA has extended init handlers but it is not what i am looking for. I would like a vanilla way to handle this, rather than a mod loading up the classes with eventhandlers. Obviously the RV engine knows when it creates an object so shouldnt be to hard to add a mission event that gives us access to this information.

Share this post


Link to post
Share on other sites

 

This is done in such a way because select and apply could be used together in sequence if needed

​[1,2,3,4,5] select {_x < 3} apply {_x ^ 2} select 0

 

As opposed to:

​([1,2,3,4,5] pushBack 6) apply {_x ^ 2} select 0

?

 

Also what's wrong with:

_arr = [1,2,3,4,5] select {_x < 3};
_arr apply {_x ^ 2};
_arr select 0

?

Share this post


Link to post
Share on other sites

As opposed to:

​([1,2,3,4,5] pushBack 6) apply {_x ^ 2} select 0

?

 

Also what's wrong with:

_arr = [1,2,3,4,5] select {_x < 3};
_arr apply {_x ^ 2};
_arr select 0

?

 

Where to start, where to start, so many questions... ;)

Apart form being obviously able to sequence commands for convenience, this also appears to be faster (lets pretend commands modify array):

arr = [1,2,3,4,5]; 
arr select {_x < 6}; 
arr apply {_x ^ 2}; 
arr select 0
//0.0498047 ms

arr = [1,2,3,4,5]; 
arr select {_x < 6} apply {_x ^ 2} select 0
//0.0469971 ms

Of course you will say, the commands still produce copies so they still have overhead in comparison with commands that modify array, therefore they will be faster. True, here is how much faster:

[1,2,3,4,5,6] append [1,2,3,4,5,6]
//0.0114014 ms

[1,2,3,4,5,6] + [1,2,3,4,5,6]
//0.012207 ms

Same operation, one modifies, another one makes a copy. As you can see not much of a difference. And of course, commands that modify array instead of returning copies, are not "safe" for beginners. So all and all, current implementation is justified.

Share this post


Link to post
Share on other sites

hi,

 

It would be nice to be able to modify those config values in mission:

 

- Audible (How loud a unit is when moving)
- Camouflage (How easy a unit is to see)
- Sensitivity (How well and how far the given unit senses other units)
- SensitivityEar (How well can the given unit hear others units)

 

cya.

 

Nikiller.

Share this post


Link to post
Share on other sites

quick test on pushBackUnique:

arr = [1];_numb= arr pushBackUnique 1; diag_log format ["arr %1, returned numb %2",arr,_numb];
18:53:53 "arr [1], returned numb -1"

arr = [1];_numb= arr pushBackUnique 2; diag_log format ["arr %1, returned numb %2",arr,_numb];
18:54:55 "arr [1,2], returned numb 1"

So it seems it returns index for added element unless already in array and then returns -1 (failure, did not add).

 

Also, looks like it works with multi-dimensional arrays too:

arr = [[1,1]];_numb= arr pushBackUnique [1,1]; diag_log format ["arr %1, returned numb %2",arr,_numb];
18:58:19 "arr [[1,1]], returned numb -1"

arr = [[1,1]];_numb= arr pushBackUnique [1,2]; diag_log format ["arr %1, returned numb %2",arr,_numb];
19:05:40 "arr [[1,1],[1,2]], returned numb 1"
 

 

 

And if array has elements of different type:

arr = [[1,"str"]];_numb= arr pushBackUnique [1,"str"]; diag_log format ["arr %1, returned numb %2",arr,_numb];
18:59:47 "arr [[1,"str"]], returned numb -1"

arr = [[1,"str"]];_numb= arr pushBackUnique [1,"strX"]; diag_log format ["arr %1, returned numb %2",arr,_numb];
19:09:14 "arr [[1,"str"],[1,"strX"]], returned numb 1"

Also, null elements do not seem to confuse it:

arr = [[1,"string",objNull]];_numb= arr pushBackUnique [1,"string",objNull]; diag_log format ["arr %1, returned numb %2",arr,_numb];
19:02:57 "arr [[1,"string",<NULL-object>]], returned numb -1"

arr = [[1,"string",objNull]];_numb= arr pushBackUnique [2,"string",objNull]; diag_log format ["arr %1, returned numb %2",arr,_numb];
19:11:52 "arr [[1,"string",<NULL-object>],[2,"string",<NULL-object>]], returned numb 1"

Good job BIS, looks useful   :)

  • Like 1

Share this post


Link to post
Share on other sites

The clientOwner command from the dev build breaks when used in a resumed MP game.

 

1. Start LAN game.

[clientOwner, owner player]
-> [2,2]

2. As host / server return to lobby (save) and resume game.

[clientOwner, owner player]
-> [3,2]

Same happens on all clients that connect to the game. Should I report this on the feedback tracker?

 

Also, onPlayerConnected is not serialized, which means that you have to add a dummy event with BIS_fnc_addStackedEventHandler with a "Load" missionEvent.

Share this post


Link to post
Share on other sites

The clientOwner command from the dev build breaks when used in a resumed MP game.

 

1. Start LAN game.

[clientOwner, owner player]
-> [2,2]

2. As host / server return to lobby (save) and resume game.

[clientOwner, owner player]
-> [3,2]

Same happens on all clients that connect to the game. Should I report this on the feedback tracker?

 

Also, onPlayerConnected is not serialized, which means that you have to add a dummy event with BIS_fnc_addStackedEventHandler with a "Load" missionEvent.

 

Both cases are worth reporting and both cases will need solid repro. Thank you.

Share this post


Link to post
Share on other sites

  • Added: disableAI / enableAI "AUTOCOMBAT"

Is it what I think it is? Is it really happening?  :zapat feeling excited:

  • Like 1

Share this post


Link to post
Share on other sites

So what do you think it is?

Share this post


Link to post
Share on other sites

Confirmation just came in: Disables automatic switching to combat mode, unit will respect behaviour as set by player / waypoint.

 

Greatest positive change in recent years!!

  • Like 1

Share this post


Link to post
Share on other sites

 

Yes, indeed. It does what you expect :)

Please discuss it in AI thread: https://forums.bistu...ion-dev-branch/

 

Confirmation just came in: Disables automatic switching to combat mode, unit will respect behaviour as set by player / waypoint.

 

Greatest positive change in recent years!!

 

Finally a Missionmakers dream came true.

Share this post


Link to post
Share on other sites

I can't find anything and am not sure enough to create a feedback tracker - did the append commmand stop working? Doesn't seem to return anything in vanilla or Dev build.

Share this post


Link to post
Share on other sites

append modifies the original array

_array = [1,2,3];
_array append [127];
_array

-> [1,2,3,127]

append itself has no return value.

 

What you are looking for is +

_array = [1,2,3];
_array + [127]

-> [1,2,3,127]

Share this post


Link to post
Share on other sites

oh okay i misunderstood, I thought "append" was supposed to be a faster way to combine arrays. Got it, thx :)
 

Share this post


Link to post
Share on other sites

oh okay i misunderstood, I thought "append" was supposed to be a faster way to combine arrays. Got it, thx :)

 

It is faster, but that is _because_ it works differently.

Share this post


Link to post
Share on other sites

I can't find anything and am not sure enough to create a feedback tracker - did the append commmand stop working? Doesn't seem to return anything in vanilla or Dev build.

Usually it is better to ask questions like this on scripting and editing forum instead of feedback tracker. However the link you are so kindly included does contain all the up to date information answering your question. The return type of append command is Nothing, which means it doesnt return anything by design and the note in description of the command that suggests using + instead, if you need result returned.

Share this post


Link to post
Share on other sites

Is it just me or loadMagazine doesn't work for player. I try to reload launcher and nothing happens. Similar to the example:
    vehicle player loadMagazine [[0],"m256","20Rnd_120mmHE_M1A2"];
But with RHS RPG7 ("rhs_weap_rpg7_pgo") and "rhs_rpg7_PG7VL_mag".

Got nothing with loadmagazine action too https://community.bistudio.com/wiki/Arma_3_Actions#LoadMagazine

 

UPD: Also there are problems with launchers reload delay http://feedback.arma3.com/view.php?id=27559

Share this post


Link to post
Share on other sites

Thank you, Killzone_kid. Just tried to load specific ammo into an RPG with weapon specific reload animation played. But cannot find a solution. It is possible to load magazine but without animation.

Share this post


Link to post
Share on other sites

Thank you, Killzone_kid. Just tried to load specific ammo into an RPG with weapon specific reload animation played. But cannot find a solution. It possible to load magazine but without animation.

 

addWeaponItem might work but there is a bug for launchers that still plays reloading sound and has delay

Share this post


Link to post
Share on other sites

Can anyone tell me the difference between the command

saveGame

and the function

BIS_fnc_saveGame

The function seems to check a few conditions before it actually saves, but I always thought the command saveGame would take care of that already. If that's not the case, it would mean using saveGame command alone is kinda risky.

Share this post


Link to post
Share on other sites

Can anyone tell me the difference between the command

saveGame

and the function

BIS_fnc_saveGame

The function seems to check a few conditions before it actually saves, but I always thought the command saveGame would take care of that already. If that's not the case, it would mean using saveGame command alone is kinda risky.

 

you answered your own question :)

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

×