Jump to content
Coladebote

Launch of supplies by parachute

Recommended Posts

Hello guys:
This little code I insert into the trigger to parachute a supply net. There is only one problem, that a single network is not generated, several are generated. Can anyone tell me what it is due to?

Code that I insert in 'ON ACTIVATE' of the trigger:

 

cargo = "I_E_CargoNet_01_ammo_F" createVehicle getpos thistrigger;cargo setPos [getPos thistrigger select 0, getPos thistrigger select 1, 300];[objnull, cargo] call BIS_fnc_curatorobjectedited; 
["AmmoboxInit",[cargo,true,{true}]] spawn BIS_fnc_arsenal;

 

Thanks.

Share this post


Link to post
Share on other sites

Check the "Server Only" box in the trigger dialogue? Sounds like the trigger is firing for every client. Hard to say. Post the full details of the trigger.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Hello Harzach,
Indeed, it is necessary to activate the option 'ONLY ON THE SERVER'. In a mission that I did more than a year ago, I already did it as you have indicated, but I did not remember it.

I am attaching the link to download the EDITING TEST, to which I have incorporated the sound of an airplane passing, which is activated at the same time. The trigger has a 30 second delay.

 

LINK TO DOWNLOAD:

https://drive.google.com/file/d/1Mv9wBIB2M8LmPG4Xqd-TzS4C2SaR5XuD/view?usp=sharing

 

So if someone is interested, they can also download it.
Greetings Harzach and thank you very much.

  • Like 1

Share this post


Link to post
Share on other sites

You need to create your box on server only but the arsenal must be global (for each clients) So, a trigger NOT server only and:

 0 = thisTrigger spawn {
   if (isServer) then {
     cargo =  createVehicle ["I_E_CargoNet_01_ammo_F",getpos _this vectorAdd [0,0, 300], [], 0, "none"];
    publicVariable "cargo";
    [objnull, cargo] call BIS_fnc_curatorobjectedited;
  };
   waitUntil {sleep 1; !isNil "cargo"};
   [ "AmmoboxInit", [cargo, true] ] call BIS_fnc_arsenal;
 };

 

CORRECTED

  • Like 3

Share this post


Link to post
Share on other sites

Hi Pierre,
Is that code correct? When I insert it into the trigger it tells me: 'invalid number in expression', and doesn't accept it.
I'm sure I'm doing something wrong, right?

Can you be a little more didactic?
Thank you.

 

Share this post


Link to post
Share on other sites

Need quotes around PV,  and arsenal wasn't initializing due to incorrect condition:

0 = thisTrigger spawn {  
  
  if (isServer) then {  
  
    cargo = "I_E_CargoNet_01_ammo_F" createVehicle (getpos _this vectorAdd [0,0, 300]);  
  
    publicVariable "cargo";  
    [objnull, cargo] call BIS_fnc_curatorobjectedited;  
  };  
  
  waitUntil {sleep 1; !isNil "cargo"};  
  
  ["AmmoboxInit", [cargo, true, {true}]] spawn BIS_fnc_arsenal;  
  
};

 

  • Like 3

Share this post


Link to post
Share on other sites

My bad. I wrote publicVariable cargo instead of publicVariable "cargo".  I tested the code and had also to change the syntax of createVehicle (see above) because the first one spawned at ground.

 

So, to be more precise, your trigger is running a code for all clients + server. The server part is for spawning a crate (so just one) and make it dropped with parachute. This code is not for every client (your problem), but the result is OK for them (effect global)

On the other hand, you need to run the arsenal function on each client, to be accessed. For that, the client's PC must know the variable name cargo . When you write cargo as varaible name in the init of an object (editor), it's OK because everyone runs this code at start. Here cargo is a "global" variable (so known by all scripts on server) but not broadcast, so you need to public variable it.

  • Like 1

Share this post


Link to post
Share on other sites

Oh! And I'm getting copy/paste corruption from your original post, so that was also a thing.

 

If you copy code from the forums, be sure do a quick check for corruption by pasting it into a code block - any red dots represent bad characters:


UwZ2991.png

  • Like 1

Share this post


Link to post
Share on other sites

How do you obtain the red dot? I'm always struggling with a copy/paste in notepad ++ with multiple try with UTF-8 or other language syntax.

Share this post


Link to post
Share on other sites

I believe it's a forum bug. It's nothing on your end.

Share this post


Link to post
Share on other sites
12 minutes ago, Harzach said:

I believe it's a forum bug. It's nothing on your end.

I know, but at least the red dot could be fine. It's non visible for me. Any hint for that?

Share this post


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

I know, but at least the red dot could be fine. It's non visible for me. Any hint for that?

 

It indicates that the preceding character is corrupted. Just delete the red dot in the code block, or retype the character in your editor.

Share this post


Link to post
Share on other sites
2 hours ago, Harzach said:

 

It indicates that the preceding character is corrupted. Just delete the red dot in the code block, or retype the character in your editor.

Yes..... I know that. My problem is: I don't have any red dot at all. Just an invisible character and the only way to "find" it is to move the cursor from character to character until it stutters once. I'd love to see any red dot!

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Hello guys:

With this code:

 

0 = thisTrigger spawn {  
  
  if (isServer) then {  
  
    cargo = "I_E_CargoNet_01_ammo_F" createVehicle (getpos _this vectorAdd [0,0, 300]);  
  
    publicVariable "cargo";  
    [objnull, cargo] call BIS_fnc_curatorobjectedited;  
  };  
  
  waitUntil {sleep 1; !isNil "cargo"};  
  
  ["AmmoboxInit", [cargo, true, {true}]] spawn BIS_fnc_arsenal;  
  
};

 

the supply network appears directly on the ground, right at the point where the trigger is. It does not parachute. The result is the same locally and on the server. I think the first option, with the activation of 'ONLY ON SERVER', works fine, although everything can be improved.

Share this post


Link to post
Share on other sites
7 hours ago, Coladebote said:

the supply network appears directly on the ground, right at the point where the trigger is. It does not parachute. The result is the same locally and on the server. I think the first option, with the activation of 'ONLY ON SERVER', works fine, although everything can be improved.

 

The reason why I gave you the new code with the alternate syntax for createVehicle. But there was this stupid bug on forum editor.

 

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

×