Home   Help Search Login Register  

Author Topic: calling a para-drop vehicle by radio  (Read 1925 times)

0 Members and 1 Guest are viewing this topic.

sinchi runa

  • Guest
calling a para-drop vehicle by radio
« on: 01 Nov 2007, 00:02:21 »
greetings once again,

i have been using this script for calling in para troopers with no problems...

Code: [Select]
; *****************************************************
; ** call in a radio trigger w/ [] exec "spawn_west_paratroopers.sqs"
; *****************************************************

if (! isServer) exitwith {};
_num_chutes = 5
_radius = 30
_i = 0
_delta = 360 / _num_chutes
#create_formation
_pos = [(getPos (vehicle player) select 0)+sin(_delta * _i)*_radius,(getPos (vehicle player) select 1)+cos(_delta * _i)*_radius,getPos (vehicle player) select 2]
chute = createVehicle ["ParachuteWest", _pos, [], 0, "FLY"];
~0.1
"SoldierWSaboteurMarksman"createUnit [position chute,group player,"this moveindriver chute"];
_i = _i + 1
?_i < _num_chutes: goto "create_formation"


so.. i tried to make a HMMWV50 instead of a player...

Code: [Select]
; *****************************************************
; ** call in a radio trigger w/ [] exec "spawn_west_paraHMMWV50.sqs"
; *****************************************************
if (! isServer) exitwith {};
_num_chutes = 1
_radius = 30
_i = 0
_delta = 360 / _num_chutes
#create_formation
_pos = [(getPos (vehicle player) select 0)+sin(_delta * _i)*_radius,(getPos (vehicle player) select 1)+cos(_delta * _i)*_radius,getPos (vehicle player) select 2]
chute = createVehicle ["ParachuteWest", _pos, [], 0, "FLY"];
~0.1
"HMMWV50" createVehicle [position chute,group player,"this moveinvehicle chute"];
_i = _i + 1
?_i < _num_chutes: goto "create_formation"


what am i doing wrong? the chute spawns empty...

and if this worked, i assume it creates a vehicle with soldiers....how do i make it an empty vehicle?

 :)
« Last Edit: 01 Nov 2007, 00:53:10 by sinchi runa »

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: calling a para-drop vehicle by radio
« Reply #1 on: 01 Nov 2007, 00:25:07 »
Use createVehicle to create a vehicle, createUnit is for units (doh).

Created vehicles are always empty.

Chutes don't have "cargo" space so moveincargo will not work.

And last: you can't put a vehicle into another vehicle.


To get usable result you have to "simulate" a paradrop for vehicles. It would need a script that gets the position of the chute (to the point of creating the chute you can use the code you have) and then loop a setpos command every 0.1 second or even faster.

I'm pretty sure this has been done before, use the search function in the forums, i bet my balls you'll get some results on this.
Didn't found anything by searching, look out for airlift scripts, they may include drop options you could use for.

Myke out
« Last Edit: 01 Nov 2007, 00:34:34 by myke13021 »

sinchi runa

  • Guest
Re: calling a para-drop vehicle by radio
« Reply #2 on: 01 Nov 2007, 00:41:10 »
lol.. i was just writing to say that i'd hate to take your balls... - this subject has less than 1 page of results.

i also looked at those... there are some scripts that kinda work... however.. i don't want all the extra baggage.. code wise.. i am trying to learn the basics of code.

can you please show an example of how:
Quote
To get usable result you have to "simulate" a paradrop for vehicles. It would need a script that gets the position of the chute (to the point of creating the chute you can use the code you have) and then loop a setpos command every 0.1 second or even faster.

with the script i have..

i edited the above script for the mistakes so far... however, you stated that only that chute part is ok..
« Last Edit: 01 Nov 2007, 00:55:09 by sinchi runa »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: calling a para-drop vehicle by radio
« Reply #3 on: 01 Nov 2007, 00:54:39 »
Try
Code: [Select]
// vehicleinchute.sqf
// Example: res = [heli1, 5, 30, "HMMWV50", 0.5]execVM"vehicleinchute.sqf"

private["_vehicle", "_num_chutes", "_radius", "_type", "_delay", "_delta", "_pos", "_mycar", "_mychute"];

_vehicle    = _this select 0;
_num_chutes = _this select 1;
_radius     = _this select 2;
_type       = _this select 3;
_delay      = _this select 4;

if (!isServer) exitWith{};

_delta = 360 / _num_chutes;

for [{_i = 0},{_i < _num_chutes},{_i = _i + 1}] do
{
   _pos = [(getPos _vehicle select 0)+sin(_delta * _i)*_radius,(getPos _vehicle select 1)+cos(_delta * _i)*_radius,getPos

_vehicle select 2];
   _mycar = _type createVehicle _pos;
   _mycar setPos _pos;
   _mycar setVectorDir (vectorDir _vehicle);
   _mycar setVectorUp (vectorUp _vehicle);
   _mycar setVelocity (velocity _vehicle);

   _mychute = "ParachuteWest" createVehicle _pos;
   _mychute setPos _pos;
   _mychute setVectorDir (vectorDir _vehicle);
   _mychute setVectorUp (vectorUp _vehicle);
   _mychute setVelocity (velocity _vehicle);
   [_mycar, _mychute] spawn
   {
      _mycar = _this select 0;
      _mychute = _this select 1;
      while {(getPos _mycar select 2) > 0} do
      {
         _mycar setPos (_mychute modelToWorld [0,0,-3]);
         _mycar SetVectorUp (vectorUp _mychute);
         sleep 0.01;
      };
   };
   Sleep _delay;
};

sinchi runa

  • Guest
Re: calling a para-drop vehicle by radio
« Reply #4 on: 01 Nov 2007, 01:23:20 »
wow.. thanks for the time..

works great for what it does... :good:

though this is not what i meant... after adding heli1 and figuring out that i'd have to either have set fixed markers or somehow add onmapclick code to the script... in order to have a vehicle air dropped to the player location.

way over my head..*sigh  ::)

just imagine you're out in the middle of the map, 50 clicks from base, and you want a humvee dropped at your location so you don't have to walk.


Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: calling a para-drop vehicle by radio
« Reply #5 on: 01 Nov 2007, 01:28:45 »
*grml*....as usual, while i was fighting through the code, Mandoble presents a fast solution.  ::)

Anyway, for completeness, here what i did based on your code:
Code: (drop_vehi.sqf) [Select]
if (! isServer) exitwith {};
_num_chutes = _this select 0;
_radius = _this select 1;
_offset = _this select 2;
_i = 0;
_delta = 360 / _num_chutes;
while {_i < _num_chutes} do
{
_pos = [(getPos player select 0)+sin(_delta * _i)*_radius,(getPos player select 1)+cos(_delta * _i)*_radius,getPos player select 2];
_chute = createVehicle ["ParachuteWest", _pos, [], 0, "FLY"];
_vehicle = "HMMWV50" createVehicle position _chute;
_nul = [_chute, _vehicle, _offset] execVM "vehidrop.sqf";
_i = _i + 1;
};
Code: (vehidrop.sqf) [Select]
_chute = _this select 0;
_vehicle = _this select 1;
_offset = _this select 2;
_pos = [getpos _chute select 0, getpos _chute select 1, (getpos _chute select 2)-_offset];
_vehicle setpos _pos;
while {(getpos _vehicle select 2) >1} do
{
_pos = [getpos _chute select 0, getpos _chute select 1, (getpos _chute select 2)-_offset];
_vehicle setpos _pos;
_vehicle setVectorDir (vectorDir _chute);
_vehicle setVectorUp (vectorUp _chute);
_vehicle setVelocity (velocity _chute);
sleep 0.01;
};

You call this:
nul = [1, 30, 2.5] execVM "drop_vehi.sqf"

1 and 30 are the variables _num_chutes and _radius as used in your original code, just put them in the scriptcall for easier testing and tweaking. The last parameter (2.5) defines the position of the vehicle relative to the chute. You might have to try what looks best for you.

One thing though: i saw u mixed up .sqf code and .sqs code...exitwith {} is .sqf style.

Now you have 2 solutions to deal with but i bet Mandobles is the better one.
I just posted it to give you some material you can learn from, as it is based on your initial code.


@Mandoble:
Sometimes, really only sometimes, i hate you.  :D


Myke out

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: calling a para-drop vehicle by radio
« Reply #6 on: 01 Nov 2007, 01:37:48 »
Sinchi, these scripts are using exactly what you have in spawn_west_paratroopers.sqs, just change heli1 as parameter by vehicle player which is what you used hardcoded in your first script. That is, a script that spawns chutes and vehicles around the indicated position.

Quote
just imagine you're out in the middle of the map, 50 clicks from base, and you want a humvee dropped at your location so you don't have to walk.

This has little to do with your first post, so now I dont know what you are really looking for  :blink:

But, if what you want is just to have cars falling down just over player's head, just use vehicle player as parameter instead of any heli1 and then change
Code: [Select]
_pos = [(getPos _vehicle select 0)+sin(_delta * _i)*_radius,(getPos _vehicle select 1)+cos(_delta * _i)*_radius,getPos _vehicle select 2];
by
Code: [Select]
_pos = [(getPos _vehicle select 0)+sin(_delta * _i)*_radius,(getPos _vehicle select 1)+cos(_delta * _i)*_radius,getPos (_vehicle select 2)+100];

So the cars and chutes will be created just over the player.

sinchi runa

  • Guest
Re: calling a para-drop vehicle by radio
« Reply #7 on: 01 Nov 2007, 02:31:47 »
ya know...

just figured out.. that for some reason.. ';' does not comment out in .sqf files...

arma edit puts that in a new scripts by default....

; *****************************************************
; ** Armed Assault Script File
; *****************************************************

i kept getting error in line 1...

no wonder i couldn't get any .sqf's to work.

thanks to both of you for you help.. both are equally worth having. thank you.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: calling a para-drop vehicle by radio
« Reply #8 on: 01 Nov 2007, 02:37:22 »
Use "Function file" for .sqf scripts instead of "Script file", then the comments are formatted correctly.

Myke out