Hendo/Sandbox – User

From Bohemia Interactive Community
< User:Hendo
Revision as of 14:40, 4 November 2011 by Shendoo (talk | contribs)
Jump to navigation Jump to search

Modeling

Modeling tips, links, and tutorials

VBS2

VBS2 Specific Stuff

Links

HowTo

TheCrucible

Make Pilot fly to waypoints

Scripting

Command Reference

VBS2 Commands by Function

Multiplayer

Multiplayer Scripting

VBS2 Directory

Object Names and Handles in VBS2

Debugging

hint format["Hello %1",player]

Tools

ScriptEdit IDE

Links

Hooahman's_Sandbox

SQF Syntax]

Scripting Tutorial]

Event Driven Architecture

Script as threads

Bunch of scripts

VBS2 specific script info

Event scripts

Nice third-party scripting blog

script example

by How To (i.e. CAS)

| Team and Local Variables

Example Scripts

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

here