Jump to content
Sign in to follow this  
JIMMI DEE BILLY BOB

Createvehicle and AttachTO projectile and rotor vehicle it.

Recommended Posts

hi.

I'm trying to make a mine dispenser vehicle to be able to quickly make a minefield.

 

I use "AT_Mine_155mm_AMOS_range" & "Mine_155mm_AMOS_range" as the create vehicle, the problem is that the projectile flies straight out, or 45 degrees down from where i point it, it causes the shell to fly in that direction as well, and it causes the mines to be dispensed uncontrollably, I need the shell be able to it ends up pointing down off at 90 degrees, so the spred mines end up in a circle area.

 

 

this addEventHandler["Fired",     
{     
  params ["_unit","_weapon","_muzzle","_mode","_ammo","_magazine","_projectile","_vehicle"];     
  _sphere = "AT_Mine_155mm_AMOS_range" createVehicle (getPosATL _projectile);     
  _sphere attachTo [_projectile,[0,0,40]];     
}];   

 

________________________________________________________________________________________  

I've tried with the one below, but it doesn't work, the projectile doesn't turn, only if I attach it to a vehicle, the shell also doesn't work correctly

________________________________________________________________________________________

this addEventHandler["Fired",     
{     
  params ["_unit","_weapon","_muzzle","_mode","_ammo","_magazine","_projectile","_vehicle"];     
  _sphere = "Mine_155mm_AMOS_range" createVehicle (getPosATL _projectile);  
  _sphere attachTo [_projectile,[0,0,40]];   
  _sphere setVectorDirAndUp [[0,0,-1], [0,1,0]]; 
}];   
____________________________________________________________________________________________

Don't really care how the mines end up out there, but artillery shells work great, the version does not work ether.

--------------------------------------------------------------------------------------------------------------------------------------------------

 

this addAction
[
  "Dispense mines",
  {
    params ["_target", "_caller", "_actionId", "_arguments"];
  _sphere = "AT_Mine_155mm_AMOS_range" createVehicle (getPosATL _caller);  
  _sphere attachTo [_caller,[0,40,30]];  
 _sphere setVectorDirAndUp [[0,0,-1], [0,1,0]]; 
  }];


 

 

 

----------------------------------

My plan is to make the bobcat into a combined breaching mine dispenser and recovery vehicle 

 

Using plank scrip.   

 

first attempt, not very practical

 

Share this post


Link to post
Share on other sites

Regarding "rotation" and stuff related with createVehicle + attachTo, I have been pretty happy lately by using
BIS_fnc_setObjectRotation . It has been the most effective way to mix pitch, yaw and roll for attached objects for me.
https://community.bistudio.com/wiki/BIS_fnc_setObjectRotation

Let's say, for creating an inner night-light for a helicopter:
    _objLowLight1 = createVehicle ["reflector_cone_01_narrow_red_f",[0,0,0], [], 0, "NONE"];
    _objLowLight1 attachTo [_currentVehicle, [0, -1.2, 1.1]];
    [_objLowLight1, [0,-65,180]] call BIS_fnc_setObjectRotation;

Maybe you could try:
 

[_sphere, [0,-90,0]] call BIS_fnc_setObjectRotation;	

 

Edited by JCataclisma

Share this post


Link to post
Share on other sites

Also, maybe this one helps you to improve (or not!) the positioning AND speed of released bombs. This is what I use for a "Launch flares" action from my helicopters:

 

flareN = "F_20mm_Green" createvehicle ((player) ModelToWorld [0,50,150]); 
			flareN setVelocity [0,25,-5];
			flareNE = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [15,25,150]);
			flareNE setVelocity [5,15,-15];
			flareE = "F_20mm_Red" createvehicle ((player) ModelToWorld [15,0,150]);
			flareE setVelocity [10,25,-5];
			flareSE = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [15,-25,150]);
			flareSE setVelocity [-5,-15,-15];
			flareS = "F_20mm_Green" createvehicle ((player) ModelToWorld [0,-50,150]);
			flareS setVelocity [0,-25,-5];
			flareSW = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [-15,-25,150]);
			flareSW setVelocity [-5,-15,-15];
			flareW = "F_20mm_Red" createvehicle ((player) ModelToWorld [-15,0,150]);
			flareW setVelocity [-10,25,-5];
			flareNW = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [-15,25,150]);
			flareNW setVelocity [-5,15,-15];

 

Share this post


Link to post
Share on other sites
6 minutes ago, JCataclisma said:

Regarding "rotation" and stuff related with createVehicle + attachTo, I have been pretty happy lately by using
BIS_fnc_setObjectRotation . It has been the most effective way to mix pitch, yaw and roll for attached objects for me.
https://community.bistudio.com/wiki/BIS_fnc_setObjectRotation

Let's say, for creating an inner night-light for a helicopter:
    _objLowLight1 = createVehicle ["reflector_cone_01_narrow_red_f",[0,0,0], [], 0, "NONE"];
    _objLowLight1 attachTo [_currentVehicle, [0, -1.2, 1.1]];
    [_objLowLight1, [0,-65,180]] call BIS_fnc_setObjectRotation;

Maybe you could try:
 


[_sphere, [0,-90,0]] call BIS_fnc_setObjectRotation;	

---------------------------------------------------------------------------

It didn't work, I don't think you can rotate the object with attachto, I read somewhere that it's not possible

Share this post


Link to post
Share on other sites
7 minutes ago, JCataclisma said:

Also, maybe this one helps you to improve (or not!) the positioning AND speed of released bombs. This is what I use for a "Launch flares" action from my helicopters:

 


flareN = "F_20mm_Green" createvehicle ((player) ModelToWorld [0,50,150]); 
			flareN setVelocity [0,25,-5];
			flareNE = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [15,25,150]);
			flareNE setVelocity [5,15,-15];
			flareE = "F_20mm_Red" createvehicle ((player) ModelToWorld [15,0,150]);
			flareE setVelocity [10,25,-5];
			flareSE = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [15,-25,150]);
			flareSE setVelocity [-5,-15,-15];
			flareS = "F_20mm_Green" createvehicle ((player) ModelToWorld [0,-50,150]);
			flareS setVelocity [0,-25,-5];
			flareSW = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [-15,-25,150]);
			flareSW setVelocity [-5,-15,-15];
			flareW = "F_20mm_Red" createvehicle ((player) ModelToWorld [-15,0,150]);
			flareW setVelocity [-10,25,-5];
			flareNW = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [-15,25,150]);
			flareNW setVelocity [-5,15,-15];

 

I think it will definitely be useful, I will try to make it work with event handler, or add action.

Thank you very much, I will share the result when I succeeded

Share this post


Link to post
Share on other sites

I cannot think of why the fnc_rotations doesn't work for you. Did you get any error messages, or it just didn't do anything at all?
Because it's working fine in both editor and dedicated MP for us.

If you take a look at the videos, the red-and-white towbars are created by script (createVehicle at position 0,0,0), attached and rotated with such BIS function.

Towbars attached under the Huron:
 



And here, towbars attached to the red container
 


 

Share this post


Link to post
Share on other sites
4 hours ago, JIMMI DEE BILLY BOB said:

 

 

 

  _sphere = "AT_Mine_155mm_AMOS_range" createVehicle (getPosATL _caller);  

 

 


Now that I have noticed: instead of creating objects in a specific position, create them at [0,0,0] and then in the following command line, use "attachTo" upon them to the position you want - this was one of the best tips I found here in forums and always works great for me.. I´m quite sure it will make things work better for your 😉


Also, as you are trying to attache them to a memory point, try also enable "bone rotation", so that they will be forced to follow the projectile movements - although I have never done that with projectiles, but works great when attached to tank's turrets, muzzles and even when I attached portable lamps at player's hands 😄
 

Share this post


Link to post
Share on other sites

Maybe give it another try?

 

 	_sphere = "AT_Mine_155mm_AMOS_range" createVehicle [0, 0, 0];
	_sphere attachTo [_projectile, [0,40,30], "usti", true]; // usti means muzzle
	[_sphere, [0,90,0]] call BIS_fnc_setObjectRotation;	//yaw, pitch, roll;
	_sphere enableSimulation true;

 

Share this post


Link to post
Share on other sites
6 hours ago, JCataclisma said:

I cannot think of why the fnc_rotations doesn't work for you. Did you get any error messages, or it just didn't do anything at all?
Because it's working fine in both editor and dedicated MP for us.

If you take a look at the videos, the red-and-white towbars are created by script (createVehicle at position 0,0,0), attached and rotated with such BIS function.

Towbars attached under the Huron:
 



And here, towbars attached to the red container
 


 

I read in another thread that you couldn't because the projectile moved so fast that it wouldn't work, I've used attachTO where my game has shut itself down, doesn't say that they will do it 🙂

Share this post


Link to post
Share on other sites
11 hours ago, JIMMI DEE BILLY BOB said:

I think it will definitely be useful, I will try to make it work with event handler, or add action.

Thank you very much, I will share the result when I succeeded

if (!isServer) exitWith {};
                                    

_veh = _this #0; _veh lockCargo true;    
_veh = _this #0; _veh removeWeaponTurret ["LMG_RCWS", [0]];       
_veh = _this #0; _veh lockturret [[0,0],true];                  
_veh = _this #0; _veh lockturret [[0],true];                                            
_veh = _this #0; _veh animate ["HideTurret", 1];   
_veh = _this #0; _veh allowCrewInImmobile true;   

_veh = _this #0; _veh addAction
[

  "Dispense mines :Fire slugs in driver,and 110m south from vehicle AP/AT mines will be covering a radius of 40m ",   //The shell will only fly in one direction, not in the vehicles direction, but it is much better than before 😄 
  {}];


_veh = _this #0; _veh addWeaponTurret ["sgun_HunterShotgun_01_sawedoff_F",[-1]];       
{ _veh addMagazineTurret ["2Rnd_12Gauge_Slug",[-1]] } count [1,2,3,4,5,6,7,8,9,10];  


_veh = _this #0; _veh addEventHandler ["Fired", { 
      flareN = "AT_Mine_155mm_AMOS_range" createvehicle ((player) ModelToWorld [0,0,100]); 
      flareN setVelocity [0,25,-5];
      flareNE = "Mine_155mm_AMOS_range" createvehicle ((player) ModelToWorld [0,0,100]);
      flareNE setVelocity [0,25,-5];
}];

nul = _veh spawn { while {alive _this} do { _this setVehicleAmmo 1; sleep 1200} };


_veh = _this #0;  call compile preprocessFileLineNumbers "plank\plank_init.sqf"; 
[_veh, [0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0]] call plank_api_fnc_forceAddFortifications;

[West, -24] call BIS_fnc_respawnTickets;

east addScoreSide 2;

  • Like 1

Share this post


Link to post
Share on other sites
On 9/15/2023 at 5:29 AM, JIMMI DEE BILLY BOB said:

I read in another thread that you couldn't because the projectile moved so fast that it wouldn't work, I've used attachTO where my game has shut itself down, doesn't say that they will do it 🙂


Oh, I wasn't aware of that. Such a pity. Well, at least you have a somehow working option for now. But there must be a way to make it perform just like you want: I have recently read a post which the guy was able to to some kind of bullet-cam - so technically it would be the same effect that you need, but as he attached a camera upon a very fast bullet, you will attach a bomb into other very fast projectile. 🤔

Share this post


Link to post
Share on other sites

By the way, maybe if your let aside (for now) the visual effect as your main goal here, you could also have an effective destruction by creating the real exploding bombs already in a predefined position (based on caller's position).
If that helps you with more crazy ideas to pollute your mind 😁, here are some topics:

1.) In this one, PierreMGI gives the recipe for a destructive thunderbolt:

And I have add a turbo on it with things like this:

Spoiler

 



2.) In this video, Gunther's shown how to create a triggered hidden bomb/explosion:



3.) and a nice concept of a detonating "cord" 😎

 

Share this post


Link to post
Share on other sites
On 9/15/2023 at 4:20 AM, JCataclisma said:

Maybe give it another try?

 


 	_sphere = "AT_Mine_155mm_AMOS_range" createVehicle [0, 0, 0];
	_sphere attachTo [_projectile, [0,40,30], "usti", true]; // usti means muzzle
	[_sphere, [0,90,0]] call BIS_fnc_setObjectRotation;	//yaw, pitch, roll;
	_sphere enableSimulation true;

 

_veh = _this #0; _veh addAction
[
  "Dispense AT/AP mines : Fire slugs in driver seat, to the right side of vehicle, mines will be covering a 40m radius 65 meters out ",
  {}];


_veh = _this #0; _veh removeWeaponTurret ["SmokeLauncher",[0,0]];

_veh = _this #0; _veh addWeaponTurret ["sgun_HunterShotgun_01_sawedoff_F",[-1]];
{ _veh addMagazineTurret ["2Rnd_12Gauge_Slug",[-1]] } count [1,2,3,4,5,6,7,8,9,10];


_veh = _this #0; _veh addEventHandler ["Fired", {
      flareN = "AT_Mine_155mm_AMOS_range" createvehicle ((player) ModelToWorld [65,0,150]); 
      flareN setVelocity [0,0,-01];
      flareNE = "Mine_155mm_AMOS_range" createvehicle ((player) ModelToWorld [65,0,150]); 
      flareNE setVelocity [0,0,-01];
}];

 

 

I wanted to reply to you a little earlier, something got in the way, I figured out how to get the mines in the right direction, I still don't understand the system of Y X Z.

 

Share this post


Link to post
Share on other sites

Oh, yeah. The first time I adapted that script (flares), I kind of mixed up the ideas of direction vs. position. It took me a while to actually pay attention to the word WORLD in modeltoWorld 😁
I don't know if you misspelled or not, just please note they are X Y Z, not y x z.

For the "modelToWorld", think of them as you were looking at the 2D map, from above: X would be North (+) and South (-), Y for East (+) and West (-), Z would be for the height (+ and - ). But as we created those flares using "player" as their relative/initial position, the script will create them STARTING from player, but adding that respective distance in every specific direction OF WORLD.

For instance, using those lines from your last post:
 

flareN = "AT_Mine_155mm_AMOS_range" createvehicle ((player) ModelToWorld [65,0,150]);  // starting from player, 65 meters NORTH, no displacement E/W and 150 meters higher;


Now looking at another line from a previous post of mine:
 

flareNW = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [-15,25,150]); // starting from player, 15 meters SOUTH, 25 meters EAST (is a positive value) and 150 meters higher


In the other things I have posted like setVelocity, it's a similar concept: script will not just create the flares, but get them moving in different speeds towards those specific directions (north+, south-, east+, west-, up+, down- .

Note the difference: they will be created in a place relative to the POSITION of player, but NOT relative to the DIRECTION player is looking.


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

Edited by JCataclisma

Share this post


Link to post
Share on other sites

But if your doubt is regarding attachTo, it's not that different. It works in a very similar way, but instead of cardinal directions, X = forward(+)/backwards(-), Y = right(+)/left(-), Z = above(+)/below(-) relative to the CENTER of the vehicle/unit you are attaching things to.

  • Like 1

Share this post


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

But if your doubt is regarding attachTo, it's not that different. It works in a very similar way, but instead of cardinal directions, X = forward(+)/backwards(-), Y = right(+)/left(-), Z = above(+)/below(-) relative to the CENTER of the vehicle/unit you are attaching things to.

 

 

My biggest problems are the language in these scripts themselves, I'm a bit dyslexic, I am use to collect all the scrips I get in missions so I can reuse them or manipulate them, I spell badly in English, I use Google to check typos 😄 i dont have a chance to learn this, it gives me a headache 😄 

  • Confused 1

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  

×