Jump to content
avibird 1

Need some help I forgot how to how to add these two code lines together.

Recommended Posts

Hello been away from the game for a while and I forgot how to add these two code lines together.  I am using Vcom AI and using Jebus with GAiA.

 

Both codes work fine but forgot how to add  together  very frustrating!!!

 

Call {0 = [ this, "DELAY=" ,300, "INIT=",{dostop _x} forEach (units _ProxyThis)", "EXIT=", myExitTrigger6, PAUSE=, 25] spawn jebus_fnc_main; } 

 

This spawn the group while holding them in position until contact is made and then they will move to engage.

 

Call {O = [this, DELAY=" ,300, "GAIA_NOFOLLOW=","2", "PAUSE=" ,25, "EXIT=", myExitTrigger6,"INIT=","(group_ProxyThis)setVariable['Vcm_Disable', true]"] spawn jebus_fnc_main;}

 

 

Both work fine by themselves and I used to know how to add them together but I forgot help appreciate it. 

 

 

Share this post


Link to post
Share on other sites

First, let's look at the Jebus params:

Quote

 

Parameters:

  • this = Leader of a group
  • "LIVES=" - Number of times group should respawn. Integer or array [minLives, maxLives]. Default is infinite lives
  • "DELAY=" - Delay in seconds before respawning. Number or array [minTime, maxTime]. Default is 30 seconds
  • "CACHE=" - Group will cache until players are within "CACHE=" metres. Default is no caching
  • "REDUCE=" - Group will cache until players are within "REDUCE=" metres. Default is no reducing
  • "START=" - Initial spawning delay. Use if you spawn multiple groups by one trigger to avoid spawn lag. Default is 0.
  • "GAIA_MOVE=" - Group added to GAIA with "MOVE" parameter
  • "GAIA_NOFOLLOW=" - Group added to GAIA with "NOFOLLOW" parameter
  • "GAIA_FORTIFY=" - Group added to GAIA with "FORTIFY" parameter
  • "FLYING" - Air vehicles will spawn already flying
  • "RESPAWNMARKERS=" - Array of alternate respawn positions
  • "PAUSE=" - Radius in which enemies will pause the spawner. Default is 200.
  • "EXIT=" - Name of exit trigger. Group will not respawn again once trigger is activated
  • "INIT=" - Init string to run upon spawning. (Use "_proxyThis" where you would usually use "this" in a script or function call). Default is empty string.
  • "DEBUG" - Will provide debugging information 

 

 

I find it helps to expand these big arrays to the vertical. I have also cleaned up a few syntax errors:

//FIRST
0 = [ 
this, 
"DELAY=", 
300, 
"PAUSE=", 
25,
"EXIT=", 
myExitTrigger6, 
"INIT=", 
"{dostop _x} forEach (units _ProxyThis)"
] spawn jebus_fnc_main;

//SECOND
O = [
this, 
"DELAY=", 
300, 
"GAIA_NOFOLLOW=", 
"2", 
"PAUSE=", 
25, 
"EXIT=", 
myExitTrigger6, 
"INIT=", 
"(group_ProxyThis) setVariable ['Vcm_Disable', true]"
] spawn jebus_fnc_main;

Now we can merge the two more easily:

//MERGED
0 = [ 
this, 
"DELAY=", 
300, 
"GAIA_NOFOLLOW=", 
"2", 
"PAUSE=", 
25,
"EXIT=", 
myExitTrigger6, 
"INIT=", 
"{dostop _x} forEach (units _ProxyThis); (group _ProxyThis) setVariable ['Vcm_Disable', true]"
] spawn jebus_fnc_main;

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks I will give it a go tomorrow to see if it works greatly appreciated brother. 

Share this post


Link to post
Share on other sites

@ Harzach code is not working says its init missing ]

Share this post


Link to post
Share on other sites

I missed an error in your initial code. There was a space missing in the second init string. Fixed above.

  • Thanks 1

Share this post


Link to post
Share on other sites

@Harzach can you highlight the missing space. I was looking at the code for a while and I couldn't find an error. I would like to see what I was missing. Thank you very much greatly appreciate it.

Share this post


Link to post
Share on other sites
"INIT=", 
"(group_ProxyThis) setVariable ['Vcm_Disable', true]"
] spawn jebus_fnc_main;

group_ProxyThis should be group _ProxyThis

Share this post


Link to post
Share on other sites

I see. The new code line does not throw any errors so that works fine but it does not run as it should. I asked the author of Jebus if you could use two codes in different init parameters within jebus script. He is away from arma3 at this time.  The waypoints get generated but the units never move to the zone. 

 

If I use the script with just the dostop and Gaia the units will move to Gaia zone once contact is made contact brakes that dostop command.

 

If I use the script with Gaia and allow VCom the units will move to GAIA zone but also utilize Vcom when in combat.

 

My question is are you able to use two different init codes within his script? 

Share this post


Link to post
Share on other sites

I can't imagine why not. The "INIT=" parameter takes code as a string which is then executed as the init of the units spawned, same as placing code in the init field of a unit in the editor, or the deprecated setVehicleinit command from A2. Separating your statements/expressions with a semicolon should work fine. But then I don't know how Jebus is handling these under the hood. If for some reason it can only handle a single statement, that seems like an oversight. 

A workaround would be to instead execute a script:

//...continued...
"INIT=", 
"[_proxyThis] execVm 'AVB_JebusScript.sqf'"
] spawn jebus_fnc_main;

Obviously, adjust the script path for however you store your mission scripts.

 

AVB_JebusScript.sqf:

params ["_proxyThis"];

{dostop _x} forEach (units _ProxyThis); 
(group _ProxyThis) setVariable ["Vcm_Disable", true];

 

Untested, but should work in theory.

Share this post


Link to post
Share on other sites

So I add this to the Jebus script they goes into the group leader init and 

 

params ["_proxyThis"]; {dostop _x} forEach (units _ProxyThis);  (group _ProxyThis) setVariable ["Vcm_Disable", true];

 

And then added this to my script folder in my mission folder 

 

..continued... "INIT=",  "[_proxyThis] execVm 'AVB_JebusScript.sqf'" ] spawn jebus_fnc_main; 

 

Just to clarify

Share this post


Link to post
Share on other sites

Yes, except the opposite. The script goes into the script folder, call the script from the unit init.

 

Create the file AVB_JebusScript.sqf (or whatever you want to call it) and place it in your mission folder.

 

AVB_JebusScript.sqf:

params ["_proxyThis"];

{dostop _x} forEach (units _ProxyThis); 
(group _ProxyThis) setVariable ["Vcm_Disable", true];

 

Call the script from the unit init:

0 = [ 
this, 
"DELAY=", 
300, 
"GAIA_NOFOLLOW=", 
"2", 
"PAUSE=", 
25,
"EXIT=", 
myExitTrigger6, 
"INIT=", 
"[_proxyThis] execVm 'AVB_JebusScript.sqf'"] spawn jebus_fnc_main; 
] spawn jebus_fnc_main;

Again, if you place your script file in a folder other than the mission root folder, you need to adjust the script call. For example, if you place the .sqf into a folder called "Scripts" then the call would be:

0 = [ 
this, 
"DELAY=", 
300, 
"GAIA_NOFOLLOW=", 
"2", 
"PAUSE=", 
25,
"EXIT=", 
myExitTrigger6, 
"INIT=", 
"[_proxyThis] execVm 'Scripts\AVB_JebusScript.sqf'"] spawn jebus_fnc_main; 
] spawn jebus_fnc_main;

 

Share this post


Link to post
Share on other sites

I see I will test later and also retest the original to see if something else is preventing it from working. Thank you sir.

Share this post


Link to post
Share on other sites
1 hour ago, avibird 1 said:

something else

 

I will say that every piece of code you have pasted has come up with corrupted characters when I copy them. These characters are invisible (or have zero width) and will break code. This is a known forum bug but I don't think anyone knows its nature or how/when it actually strikes. It's easy to test for and fix though.

 

To clean a piece of code, just copy it, paste it into a code block here on the forum, then delete any red dots you see. Re-copy the now clean code and you're good to go. Don't click "Insert into post," just do it all in the open dialog. No need to post anything. Here's an example of what it looks like:


D81lXjj.png

Share this post


Link to post
Share on other sites

@Harzach got it to work but needed to adjust the script parameters a little

 

 

 

call{ 0= [this,"DELAY=",300,"PAUSE=",50,"EXIT=",myExitTrigger6, "INIT=","{dostop _x} forEach (units _ProxyThis);(group _ProxyThis) setVariable ['Vcm_Disable', true]"] spawn jebus_fnc_main; }

for what ever reason some of the units would move out of position before contact was made by the group using the 0 = [ ...ECT. This setup of the parameters of JEBUS. When I used the setup call { 0 = ...ECT. All the units say in placement throughout the FOB base I am using the script setup including elevation and on towers. ARMA scripting hurts my head lol. I still don't know what is the best way to call Jebus script is his example use the first setup but it does not work 100% using the init parameter twice in the same codelines   "INIT=" - Init string to run upon spawning. (Use "_proxyThis" where you would usually use "this" in a script or function call). Default is empty string. @dreadpirate is taking some time away from ARMA I did ask he and asked in the JEBUS page.  Well in any event I got what I needed Thank you sir!!!

 

question for you. Where can I get access to that code box you posted above to see any of the red dots to clean of the code? I never know about that and could you suggest any good programs to help me read/write code and to identify errors. The main things I use are type.SQF and Eliteness.

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

×