Hendo/Sandbox – User

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "\[ *((ftp|http)s?:\/\/[^ ]+)([^{])=([^}])([^ ]+)" to "[$1$3{{=}}$4$5")
 
(22 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Modeling==
{{TOC|side}}
== Modeling ==


[[Hendo:Modeling|Modeling tips, links, and tutorials]]
* [http://tactical.nekromantix.com/tactical/wiki/doku.php?id{{=}}arma:editing_beginners Nice beginner's guide]
* {{Link|link= http://ofp.gamepark.cz/_hosted/brsseb/tutorials.htm|text= Great Modeling Tutorials}}
* [[Oxygen_Keyboard_Shortcuts]]
* [http://www.sparrowstudio.net/armavdv/toolbox/install.html 3DS P3D Addon]


== VBS2 ==
==== Cockpit Modeling ====
I think we are going to need a {{Link|link= http://ofp.gamepark.cz/_hosted/brsseb/tutorials/lesson4/lesson4_h.htm|text= PilotView LOD}}


[[Hendo:VBS2Specific|VBS2 Specific Stuff]]


== Links ==
== Links ==


 
=== Projects ===
 
 
 
=== HowTo ===


[[GetAListOfEntityIDs]]
[[GetAListOfEntityIDs]]


[[TheCrucible]]
=== Make pilot fly to waypoints ===


[[HendoMakePilotFollowWaypoints|Make Pilot fly to waypoints]]
# Create a helipilot (player, playable)
# Create a UH60L.  Name it mychopper
# Make a new waypoint for the player
# Create a pilot. Place this in init statement:<code style="display: block">this assignAsDriver mychopper</code>
# Group the pilot to the player
# Create a stand alone wp near the chopper
# Assign the pilot this waypoint
This only works if the player is in the backseat!


=== Scripting ===
=== Scripting ===
==== Command Reference ====
[[VBS2_Scripting_Commands_by_Functionality|VBS2 Commands by Function]]


==== Multiplayer ====
==== Multiplayer ====
 
[[Multiplayer Scripting]]
[[Multiplayer_scripting|Multiplayer Scripting]]
 
==== VBS2 Directory ====
 
[http://community.bistudio.com/wiki/VBS2:_CfgVehicles Object Names and Handles in VBS2]


==== Debugging ====
==== Debugging ====
 
<code style="display: block">[[hint]] [[format]] ["Hello %1", [[player]]];</code>
<code>
hint format["Hello %1",player]
</code>


==== Tools ====
==== Tools ====


[http://www.armedassault.info/index.php?game=0&cat=utilities&id=16 ScriptEdit IDE]
[http://www.armedassault.info/index.php?game{{=}}0&cat{{=}}utilities&id=16 ScriptEdit IDE]


==== Links ====
==== Links ====
* [http://www.kronzky.info/ Some nice tools from Kronzky]
* [[Hooahman%27s_Sandbox]]
* [[SQF Syntax|SQF Syntax]]]
* [http://www.armedassault.info/index.php?game{{=}}0&cat{{=}}articles&class=tutorials&id=17 Scripting Tutorial]]
* {{Link|https://en.wikipedia.org/wiki/Event-driven_architecture|Event Driven Architecture}}
* [[Script File|Script as threads]]
* [http://www.ofpec.com/ed_depot/index.php?action{{=}}list&cat{{=}}sc&type=xyz Bunch of scripts]
* [[:Category:Scripting_Functions_VBS2|VBS2 specific script info (OLD)]]
* [[Event_Scripts|Event scripts]]
* [http://tactical.nekromantix.com/tactical/wiki/doku.php?id{{=}}arma:scripting Nice third-party scripting blog]
* [http://www.dftos.dk/arma_scripting.html|Simple script example]
* [http://forums.bistudio.com/showthread.php?t{{=}}89257|FAQ by How To (i.e. CAS)]
* [http://forums.bistudio.com/showthread.php?t{{=}}65413&highlight{{=}}global+variables+team | Team and Local Variables]


[[Hooahman%27s_Sandbox]]
[http://community.bistudio.com/wiki/SQF_syntax SQF Syntax]]
[http://www.armedassault.info/index.php?game=0&cat=articles&class=tutorials&id=17 Scripting Tutorial]]
[http://en.wikipedia.org/wiki/Event-driven_architecture Event Driven Architecture]
[http://community.bistudio.com/wiki/Script_(File) Script as threads]
[http://www.ofpec.com/ed_depot/index.php?action=list&cat=sc&type=xyz Bunch of scripts]
[http://community.bistudio.com/wiki/Category:Scripting_Functions_VBS2 VBS2 specific script info]
[http://community.bistudio.com/wiki/Event_Scripts Event scripts]
[http://tactical.nekromantix.com/tactical/wiki/doku.php?id=arma:scripting Nice third-party scripting blog]
[http://www.dftos.dk/arma_scripting.html|Simple script example]
[http://forums.bistudio.com/showthread.php?t=89257|FAQ by How To (i.e. CAS)]
[http://forums.bistudio.com/showthread.php?t=65413&highlight=global+variables+team | Team and Local Variables]


== Example Scripts ==
== Example Scripts ==
Line 85: Line 70:
fgh2050 animate ["Trunk",1];
fgh2050 animate ["Trunk",1];
//fgh2050 action ["OpenTrunk", fgh2050];
//fgh2050 action ["OpenTrunk", fgh2050];
 
_forever = true;
_forever = true;


Line 93: Line 78:
_cam cameraEffect["internal","FRONT"];
_cam cameraEffect["internal","FRONT"];


 
_grp = group _cam;
_grp = group _cam;


Line 99: Line 84:


while {(_forever)} do {
while {(_forever)} do {
 
_locationPosition = fgh2050 modelToWorld [0,-4.5,1.5];
_locationPosition = fgh2050 modelToWorld [0,-4.5,1.5];
//_locationPosition = fgh2050 modelToWorld [0,5.9,2.5]; //CPG EYES
//_locationPosition = fgh2050 modelToWorld [0,5.9,2.5]; //CPG EYES
_targetPosition = fgh2050 modelToWorld [0,100,0];
_targetPosition = fgh2050 modelToWorld [0,100,0];
_cam SetPos _locationPosition;
_cam SetPos _locationPosition;
 
_fgh2050PB = fgh2050 call fn_vbs_getPitchBank;
_fgh2050PB = fgh2050 call fn_vbs_getPitchBank;
_fgh2050Dir = getDir fgh2050;
_fgh2050Dir = getDir fgh2050;
Line 112: Line 97:
myPitch = -1 * myPitch-5;
myPitch = -1 * myPitch-5;
myBank = -1 * myBank;
myBank = -1 * myBank;
 
//hint "my pitch and bank ";
//hint "my pitch and bank ";
//hint format["pitch %1, bank %2",myPitch, myBank];
//hint format["pitch %1, bank %2",myPitch, myBank];
 
[_cam, myPitch, myBank] call fn_vbs_setPitchBank;
[_cam, myPitch, myBank] call fn_vbs_setPitchBank;
 
_cam CamCommit 0;
_cam CamCommit 0;
sleep 0.005;
sleep 0.005;
showCinemaBorder false
showCinemaBorder false
};
};
}
};
</pre>
</pre>


Line 133: Line 116:
To use:
To use:


1.  Make a mission with a token player on the ground, an an apache w/ AI crew
# Make a mission with a token player on the ground, an an apache w/ AI crew
 
# Save the mission
2.  Save the mission
# Find the mission folder in My Documents/VBS2/mpmission/the_new_mission
 
# Create a new sqf filed (text) named ''player.sqf''
3.  Find the mission folder in My Documents/VBS2/mpmission/the_new_mission
# Save the file
 
# In the initialization text box for the player, place:
4.  Create a new sqf filed (text) named ''player.sqf''
 
5.  Save the file
 
6.  In the initialization text box for the player, place:


<pre>
<pre>
Line 170: Line 148:


while {(_forever)} do {
while {(_forever)} do {
 
//_locationPosition = apache modelToWorld [0,3.8,2.0]; //CPG EYES
//_locationPosition = apache modelToWorld [0,3.8,2.0]; //CPG EYES
_locationPosition = apache modelToWorld [0,5.9,2.0]; //CPG EYES
_locationPosition = apache modelToWorld [0,5.9,2.0]; //CPG EYES
_targetPosition = apache modelToWorld [0,100,0];
_targetPosition = apache modelToWorld [0,100,0];
_cam SetPos _locationPosition;
_cam SetPos _locationPosition;
 
_apachePB = apache call fn_vbs_getPitchBank;
_apachePB = apache call fn_vbs_getPitchBank;
_apacheDir = getDir apache;
_apacheDir = getDir apache;
_cam setDir _apacheDir;
_cam setDir _apacheDir;
[_cam, _apachePB select 0, _apachePB select 1] call fn_vbs_setPitchBank;
[_cam, _apachePB select 0, _apachePB select 1] call fn_vbs_setPitchBank;
 
_cam CamCommit 0;
_cam CamCommit 0;
sleep 0.005;
sleep 0.005;
};
};
</pre>
</pre>


=== Nose Camera (No Bank) ===
=== Nose Camera (No Bank) ===


This script place a camera on the nose of an apache.
This script place a camera on the nose of an apache.


To use:
To use:
# Make a mission with a token player on the ground, an an apache w/ AI crew
# Save the mission
# Find the mission folder in My Documents/VBS2/mpmission/the_new_mission
# Create a new sqf filed (text) named ''apache.txt''
# Save the file
# In the initialization text box for the apache, place:


1.  Make a mission with a token player on the ground, an an apache w/ AI crew
<code style="display: block">call {apache execVM "apache.sqf";}
 
2.  Save the mission
 
3.  Find the mission folder in My Documents/VBS2/mpmission/the_new_mission
 
4.  Create a new sqf filed (text) named ''apache.txt''
 
5.  Save the file
 
6.  In the initialization text box for the apache, place:
 
<code>
call {apache execVM "apache.sqf";}
</code>
</code>


Line 236: Line 204:


while {(_forever)} do {
while {(_forever)} do {
 
_locationPosition = GetPos apache;
_locationPosition = GetPos apache;
_locationPosition = apache modelToWorld [0,6,2];
_locationPosition = apache modelToWorld [0,6,2];
Line 245: Line 213:
sleep 0.005;
sleep 0.005;
};
};
</pre>
</pre>


Notes:
Notes:
   * For the life of me I could not control the bank angle of the camera.  Tried to use CamSetBank but no dice!
   * For the life of me I could not control the bank angle of the camera.  Tried to use CamSetBank but no dice!


Line 270: Line 235:
sleep 1;
sleep 1;
};
};
</pre>
</pre>


Line 277: Line 241:
<pre>
<pre>
/*
/*
Purpose: Trigger demo
Purpose: Trigger demo


Line 290: Line 253:


Author:  Henderson
Author:  Henderson
*/
*/


Line 325: Line 286:
//Cue the A10s
//Cue the A10s
hog commandMove (position player);  
hog commandMove (position player);  
</pre>
</pre>


=== Killer AH1Z ===
=== Killer AH1Z ===
Line 354: Line 309:
call {player execVM "snake.sqf";}
call {player execVM "snake.sqf";}


Run like the dickens!
Run like the dickens!
*/
*/


Line 375: Line 328:
};
};
hint "Snake killed player!";
hint "Snake killed player!";
</pre>


=== AH6 ===
<pre>
/*
Purpose: Create an AH6 with pilot and have him fly you around
Preconditions: 
- Create some waypoints where you want the pilot to fly
Activator:  player
Author:  Henderson
TO USE:
Save this file in C:\Documents and Settings\user\My Documents\VBS2\mpmissions\missionname\
Make a pilot
- use the following initialization script for snake
call {player execVM "fly.sqf";}
*/


</pre>


=== AH6 ===
//Feedback on script start
hint "Fly Started!";


[[HendoAH6|here]]
_grp = group player;
_ah6 = "AH6" createVehicle (position player);
_ah6 flyInHeight 50;
//Create a pilot
//See: http://community.bistudio.com/wiki/VBS2:_CfgVehicles
"VBS2_US_MC_HeliPilot_W_BerettaM9" createUnit [position player, _grp, "pilot = this ;"];


pilot action ["getInPilot", _ah6];
player action ["getInCargo", _ah6];
_ah6 flyInHeight 50;
pilot commandMove (getMarkerPos "m1");
waitUntil {!alive pilot || pilot distance (getMarkerPos "m1") <= 150};
_ah6 flyInHeight 20;
pilot commandMove (position h1);
waitUntil {!alive pilot || pilot distance (position h1) <= 100};
_ah6 land "GET OUT";
pilot action ["Land", _ah6];
</pre>




[[Category:Sandbox]]
[[Category:Sandbox]]

Latest revision as of 17:27, 28 April 2023

Modeling

Cockpit Modeling

I think we are going to need a PilotView LOD link courtesy of
OFP-Faguss.com


Links

Projects

GetAListOfEntityIDs

Make pilot fly to waypoints

  1. Create a helipilot (player, playable)
  2. Create a UH60L. Name it mychopper
  3. Make a new waypoint for the player
  4. Create a pilot. Place this in init statement:this assignAsDriver mychopper
  5. Group the pilot to the player
  6. Create a stand alone wp near the chopper
  7. Assign the pilot this waypoint

This only works if the player is in the backseat!

Scripting

Multiplayer

Multiplayer Scripting

Debugging

hint format ["Hello %1", player];

Tools

ScriptEdit IDE

Links


Example Scripts

Tail Camera (with Bank)

Note the reciprocal math:

#include "\vbs2\headers\function_library.hpp" 


If (local rex) then {

	fgh2050 animate ["Trunk",1];
	//fgh2050 action ["OpenTrunk", fgh2050];

	_forever = true;

	_locationPosition = GetPos fgh2050;

	_cam = "seagull" camCreate (position  fgh2050);
	_cam cameraEffect["internal","FRONT"];


	_grp = group _cam;

	selectPlayer _cam;

	while {(_forever)} do {

		_locationPosition = fgh2050 modelToWorld [0,-4.5,1.5];	
		//_locationPosition = fgh2050 modelToWorld [0,5.9,2.5];	//CPG EYES
		_targetPosition = fgh2050 modelToWorld [0,100,0];	
		_cam SetPos _locationPosition;		

		_fgh2050PB = fgh2050 call fn_vbs_getPitchBank;
		_fgh2050Dir = getDir fgh2050;
		_cam setDir _fgh2050Dir+180;
		myPitch = _fgh2050PB select 0;
		myBank = _fgh2050PB select 1;
		myPitch = -1 * myPitch-5;
		myBank = -1 * myBank;

		//hint "my pitch and bank ";
		//hint format["pitch %1, bank %2",myPitch, myBank];

		[_cam, myPitch, myBank] call fn_vbs_setPitchBank;

		_cam CamCommit 0;
		sleep 0.005;
		showCinemaBorder false
	};
};

Nose Camera (with Bank)

Here's a script that will put the player on the nose of the apache.

To use:

  1. Make a mission with a token player on the ground, an an apache w/ AI crew
  2. Save the mission
  3. Find the mission folder in My Documents/VBS2/mpmission/the_new_mission
  4. Create a new sqf filed (text) named player.sqf
  5. Save the file
  6. In the initialization text box for the player, place:
call {apache execVM "player.sqf";}

Tested: VBS2 v1.23

Note: this script uses VBS2 functions (see header below). You may be able to modify use of the fn_vbs_setPitchBankcommand with something that works in ARMA (camSetBank).


#include "\vbs2\headers\function_library.hpp" 

_forever = true;

_locationPosition = GetPos apache;

_cam = "seagull" camCreate (position  apache);
_cam cameraEffect["internal","back"];


_grp = group _cam;

selectPlayer _cam;

while {(_forever)} do {

	//_locationPosition = apache modelToWorld [0,3.8,2.0];	//CPG EYES
	_locationPosition = apache modelToWorld [0,5.9,2.0];	//CPG EYES
	_targetPosition = apache modelToWorld [0,100,0];	
	_cam SetPos _locationPosition;		

	_apachePB = apache call fn_vbs_getPitchBank;
	_apacheDir = getDir apache;
	_cam setDir _apacheDir;
	[_cam, _apachePB select 0, _apachePB select 1] call fn_vbs_setPitchBank;

	_cam CamCommit 0;
	sleep 0.005;
};

Nose Camera (No Bank)

This script place a camera on the nose of an apache.

To use:

  1. Make a mission with a token player on the ground, an an apache w/ AI crew
  2. Save the mission
  3. Find the mission folder in My Documents/VBS2/mpmission/the_new_mission
  4. Create a new sqf filed (text) named apache.txt
  5. Save the file
  6. In the initialization text box for the apache, place:

call {apache execVM "apache.sqf";}


Tested w/ VBS2 1.23


#include "\vbs2\headers\function_library.hpp" 

_forever = true;

_locationPosition = GetPos apache;

_camera = "camera" camcreate _locationPosition;
_camera cameraEffect["internal","back"];
//_camera CamSetDir 0;
_camera CamSetFOV 1;


_camera camSetTarget _locationPosition;
//_camera CamSetPos [_locationPosition Select 0,(_locationPosition Select 1) + 2, 5];
_camera CamSetPos _locationPosition;
_camera CamSetFOV 0.7;
_camera CamCommit 0;


while {(_forever)} do {

	_locationPosition = GetPos apache;
	_locationPosition = apache modelToWorld [0,6,2];
	_targetPosition = apache modelToWorld [0,100,0];	
	_camera camsettarget _targetPosition;
	_camera CamSetPos _locationPosition;
	_camera CamCommit 0;
	
	sleep 0.005;
};

Notes:

 * For the life of me I could not control the bank angle of the camera.  Tried to use CamSetBank but no dice!

UAV Shadow

_forever = true;
while {(_forever)} do {
	_pos = position player;
	_x = 100+(_pos select 0);
	_y = (_pos select 1);
	_z = 1000+(_pos select 2);
	_dest = [_x,_y,_z];
	uav_1 flyInHeight 33;	
	uav_1 setDestination [_dest, "LeaderPlanned", true];
	_wPosArray = waypoints uav_1;
	hint format ["uav has %1 waypoint..%2",(count _wPosArray), _wPosArray];
	sleep 1;
};

Melee

/*
Purpose: Trigger demo

Preconditions:  

- Create a T72 platoon 
- Create an A10 team
- Create a playable USMC marine
- Create a Trigger where you want the ambush

Activator:  trigger

Author:  Henderson
*/

//Feedback on script start
hint "Fly Started!";

_grp = group player;

//Create a tank
_myTank1 = "M1Abrams" createVehicle (position player);

//Create a driver
//See: http://community.bistudio.com/wiki/VBS2:_CfgVehicles
"SquadLeaderW" createUnit [position player, _grp, "pilot = this ;"];

//Place them in the tank
pilot action ["getInDriver", _myTank1];
player action ["getInGunner", _myTank1];

//Create a tank
_myTank2 = "M1Abrams" createVehicle (position player);

//Create a driver
//See: http://community.bistudio.com/wiki/VBS2:_CfgVehicles
"SquadLeaderW" createUnit [position player, _grp, "pilot2 = this ;"];
"SquadLeaderW" createUnit [position player, _grp, "gunner2 = this ;"];

//Place them in the tank
pilot2 action ["getInDriver", _myTank2];
gunner2 action ["getInGunner", _myTank2];


//Cue the A10s
hog commandMove (position player); 

Killer AH1Z

/*

Purpose: Have A1Z engage player

Preconditions:  A1Z (snake) spawn

Activator:  snake

Author:  Henderson

TO USE:

Save this file in C:\Documents and Settings\user\My Documents\VBS2\mpmissions\missionname\
Make an M1A1 and name it player
Make an AH1Z and name it snake
	- use the following initialization script for snake
	
	 call {player execVM "snake.sqf";}

Run like the dickens!
*/


//Feedback on script start
hint "Snake Started!";
this flyInHeight 200; 


while {alive player} do 
{
	snake doMove getPos player;
	snake doTarget player;
	//hsnake selectWeapon "HellfireLauncher";
	snake doFire player;	
	sleep 1;
};
hint "Snake killed player!";

AH6

/*
Purpose: Create an AH6 with pilot and have him fly you around

Preconditions:  

- Create some waypoints where you want the pilot to fly

Activator:  player

Author:  Henderson

TO USE:

Save this file in C:\Documents and Settings\user\My Documents\VBS2\mpmissions\missionname\
Make a pilot
	- use the following initialization script for snake

	 call {player execVM "fly.sqf";}
*/


//Feedback on script start
hint "Fly Started!";

_grp = group player;
_ah6 = "AH6" createVehicle (position player);
_ah6 flyInHeight 50;
//Create a pilot
//See: http://community.bistudio.com/wiki/VBS2:_CfgVehicles
"VBS2_US_MC_HeliPilot_W_BerettaM9" createUnit [position player, _grp, "pilot = this ;"];

pilot action ["getInPilot", _ah6];
player action ["getInCargo", _ah6];
_ah6 flyInHeight 50;
pilot commandMove (getMarkerPos "m1"); 
waitUntil {!alive pilot || pilot distance (getMarkerPos "m1") <= 150};
_ah6 flyInHeight 20;
pilot commandMove (position h1); 
waitUntil {!alive pilot || pilot distance (position h1) <= 100};
_ah6 land "GET OUT";
pilot action ["Land", _ah6];