Forum Jump :

Author Message


Posts: 6
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2015-02-07 15:12        
     
i'm completely new to scripting especially within arma so please excuse any stupidity

I'm attempting to spawn an empty vehicle from an addAction but can't seem to get anything to spawn. I've used a hint to ensure the script is actually being executed at all, but nothing appears.

this addAction ["Request Lynx", "Vehicles\lynx.sqf"];; this allowdamage false; - is in the initialisation field of an object i'm using to spawn the vehicle

and lynx.sqf contains:
_pos = getmarkerpos "TransportHeliSpawn";
_lynx = createvehicle ["I_Heli_light_03_unarmed_F", _pos, [], 0, none];
_lynx setobjecttexture [0, "LynxTexture.jpg"];
hint "lynx spawned";

I get the hint but nothing else, i've also tried placing getmarkerpos with marker name in create vehicle, as well as trying the co-ordinates of the marker instead, even using position player; all with the same results.


Author Message


Posts: 1473
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#2 Posted at 2015-02-07 15:53        
     
_lynx = createvehicle ["I_Heli_light_03_unarmed_F", _pos, [], 0, "none"];//you had missing quotes around none

also you should have seen a error if not then you need to enable showscripterrors by using the launcher and choosing the option or follow this link showscripterrors


Advertisement


Author Message


Posts: 6
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2015-02-07 18:25        
     
thanks, i now feel that little more stupid but you sir are a saviour.


Author Message


Posts: 39
Rank:


Level: Member

Country: uk
Location: England
Occupation: Studying Software Development In College
Age: 19
In-game name: [MK]Martyn

 
#4 Posted at 2015-02-11 13:34        
     
Hello,

I tried to use your script Lewis360ful however do you guys know how to do it with different makers? And have it spawn at 3 of the 6 marker.

My example with your one was this....

_heliSpawn[TransportHeliSpawn1, TransportHeliSpawn2, TransportHeliSpawn3, TransportHeliSpawn4, TransportHeliSpawn5, TransportHeliSpawn6];
_lynx = createvehicle ["I_Heli_light_03_unarmed_F", _heliSpawn, [], 0, none];
hint "lynx spawned";

Could this work and what is _lynx ?

Check Out My Community
http://mercykillers-a3l.enjin.com/

How to make a Arma 3 Server ?
http://youtu.be/DGlzFKpn5O4

How to make a Teamspeak 3 Server ?
http://youtu.be/Kl27pWKT_Ac

Author Message


Posts: 635
Rank:


Level: Member

Country: uk
Location: N.W.
Occupation:
Age: 29
In-game name: big_wilk

 
#5 Posted at 2015-02-11 14:11        
     
for [{_i=0}, {_i<2}, {_i=_i++}] do
{
_markerArray = ["markerOne","markerTwo","markerThree","M4",","m5","m6"];
_marker = _markerArray call BIS_fnc_selectRandom;
_markerArray = _markerArray - [_marker];
_lynx = createvehicle ["I_Heli_light_03_unarmed_F", getmarkerpos _marker, [], 0, "none"];
};

_lynx is a variable containing you helicopters ID, a Lynx is a helicopter used by the British army that they have copy and pasted into arma3 from the BAF dlc from arma2 and given to the AAF. (this > I_Heli_light_03_unarmed_F).


Author Message


Posts: 39
Rank:


Level: Member

Country: uk
Location: England
Occupation: Studying Software Development In College
Age: 19
In-game name: [MK]Martyn

 
#6 Posted at 2015-02-11 15:00        
     
Ok thank so all i need to is put it into a script which will activate when the init.sqf is lauched. also could i make the helicopters random also...

First example
for [{_i=0}, {_i<2}, {_i=_i++}] do
{
_markerArray = ["markerOne","markerTwo","markerThree","M4","m5","m6"];
_heliArray = ["heliOne","heliTwo","heliThree","h4",","h5","h6"];
_marker = _markerArray call BIS_fnc_selectRandom;
_heli = _heliArray  call BIS_fnc_selectRandom;
_markerArray = _markerArray - [_marker];
_heliArray = _heliArray - [_heli];
_lynx = createvehicle [getArray _heli, getmarkerpos _marker, [], 0, "none"];
};

Second Example
if(!X_Server) exitWith {};
private ["_i","_markerArray","_marker","_lynx","_marker"];

_i = 0;

for [{_i=0}, {_i<2}, {_i=_i++}] do
{
_markerArray = ["heliSpawn_1","heliSpawn_2","heliSpawn_3","heliSpawn_4", "heliSpawn_5", "heliSpawn_6"];
_marker = _markerArray call BIS_fnc_selectRandom;
_markerArray = _markerArray - [_marker];
_lynx = createvehicle ["I_Heli_light_03_unarmed_F", getmarkerpos _marker, [], 0, "none"];
};

Could this work?
and
What are the _i=0 at the top of the script ?

Thanks big_wilk

This post was edited by martynfitz (2015-02-11 20:47, 982 days ago)

Check Out My Community
http://mercykillers-a3l.enjin.com/

How to make a Arma 3 Server ?
http://youtu.be/DGlzFKpn5O4

How to make a Teamspeak 3 Server ?
http://youtu.be/Kl27pWKT_Ac

Author Message


Posts: 635
Rank:


Level: Member

Country: uk
Location: N.W.
Occupation:
Age: 29
In-game name: big_wilk

 
#7 Posted at 2015-02-13 03:49        
     
Just put it into your init it should work or you can do this in your init to create an environment where loops will work and pauses will work:

[] spawn {/* code here */};

Useing _i in for loops is just traditional, you could use:

_AppleSauceTastesBadOverChips = 0;// Put this in the executed code part of the for loop

if you really wanted to.. any name for the variable will do.

for [{Executed Code}, {CONDITION}, {STEP}] do
{
    STATEMENT;
    ...
};

Condition: is when the loop ends, you want it to end when it has repeated itself 3 times so incrementing _AppleSauceTastesBadOverChips by 1 in the steps feild does this: 0,1,2

_AppleSauceTastesBadOverChips<2 // condition is true when _AppleSauceTastesBadOverChipsis less than 2 or larger

Step: this code is executed each time the loop happens, so we +1 to _AppleSauceTastesBadOverChips each time.
_AppleSauceTastesBadOverChips++ // or _AppleSauceTastesBadOverChips + 1 will work

Read this: https://community.bistudio.com/wiki/Control_Structures

for [{_AppleSauceTastesBadOverChips = 0}, {_AppleSauceTastesBadOverChips < 2}, {_AppleSauceTastesBadOverChips + 1}] do
{
hint str _AppleSauceTastesBadOverChips;
sleep 1;
};


Author Message


Posts: 39
Rank:


Level: Member

Country: uk
Location: England
Occupation: Studying Software Development In College
Age: 19
In-game name: [MK]Martyn

 
#8 Posted at 2015-02-13 13:12        
     
Thank big_wilk you have been a really good help for me. Have a great day bud.

Check Out My Community
http://mercykillers-a3l.enjin.com/

How to make a Arma 3 Server ?
http://youtu.be/DGlzFKpn5O4

How to make a Teamspeak 3 Server ?
http://youtu.be/Kl27pWKT_Ac