Jump to content

Recommended Posts

I'm trying to get a vehicle to act as a drop pod. When you get into a specific seat there is an addAction that will open your map and then when you click on a position on the map it will teleport the vehicle and all inhabitants to that location at 500m-1km above and remove the option to drop again. I already have a the action and part of the teleport working but I wanted suggestions on how to adjust height of the teleport and remove remove the action after its been done.

Share this post


Link to post
Share on other sites
42 minutes ago, minerminor79er2 said:

I already have a the action and part of the teleport working

 

Share your code.

 

43 minutes ago, minerminor79er2 said:

how to adjust height of the teleport

 

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

 

43 minutes ago, minerminor79er2 said:

and remove the action

 

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

Quote

 

params ["_target", "_caller", "_actionId", "_arguments"];

  • target: Object - the object which the action is assigned to
  • caller: Object - the unit that activated the action
  • actionID: Number - activated action's ID (same as addAction's return value)
  • arguments: Anything - arguments given to the script if you are using the extended syntax

 

 

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

this addAction
[
	"title",
	{
		params ["_target", "_caller", "_actionId", "_arguments"];
		_target removeAction _actionId;
	},
	nil,
	1.5,
	true,
	true,
	"",
	"true",
	50,
	false,
	"",
	""
];

 

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, Harzach said:

Share your code.

this addAction["Initiate Drop Sequence", {

openMap true;

onMapSingleClick {
 sleep 10;
 openMap false;
 drop_pod_1 setPos _pos
 onMapSingleClick ""; 
 };

}, [_tObject]];

To specify I want it to teleport to where they click on the map but adjust their height at the same time, if I can do that in one line I'd prefer it.

As for the remove action portion, thank you I'll add that.

Share this post


Link to post
Share on other sites

Another thing, I want all occupants of the vehicles screen to go black for a couple seconds when the drop starts. That's what this line is for but it doesn't seem to work.

sleep 10;

 

Share this post


Link to post
Share on other sites
1 hour ago, minerminor79er2 said:

That's what this line is for

 

That's not what sleep does.

 

You could try cutText or maybe BIS_fnc_fadeEffect. I've never used the latter.

 

For the position, from onMapSingleClick:

 

Quote

Syntax:            onMapSingleClick command

Parameters:   command: String or Code - Code executed on click. The following variables are available:

  • _pos: Array - Clicked position
  • _units: Array - Units which were selected (via function keys) before opening the map (may be non-functional in Arma)
  • _shift: Boolean - Whether ⇧ Shift was pressed when clicking on the map
  • _alt: Boolean - Whether Alt was pressed when clicking on the map

 

drop_pod_1 setPosATL [_pos#0, _pos#1, 1000];  //set spawn height 100 meters ATL

 

Share this post


Link to post
Share on other sites
this addAction["Initiate Drop Sequence", {5,

openMap true;

onMapSingleClick {
 [1,"BLACK",3,1] spawn BIS_fnc_fadeEffect;
 cutText ["", "BLACK OUT"];
 openMap false;
 drop_pod_1 setPosATL [(_pos#0), (_pos#1), 1000];
 drop_pod_1 removeAction 5;
 onMapSingleClick ""; 
 };

}, [_tObject]];

This is what I have now. Everything is working except I did something wrong with the removeAction line. Also how can I make it so only the person in the gunner seat of the vehicle can see the "Initiate Drop Sequence" action. And when it lands on the ground ejects all occupants from the vehicle and disables simulation?

Share this post


Link to post
Share on other sites
this addAction ["Initiate Drop Sequence", {5,

I'm not sure what you are trying to do with that "5." I gave you a working example and a link to the Biki entry which has all the info you need.

this addAction ["Initiate Drop Sequence", {
	params ["_target", "_caller", "_actionId", "_arguments"];
	_target removeAction _actionId;
	openMap true;
	onMapSingleClick {
		[1,"BLACK",3,1] spawn BIS_fnc_fadeEffect;
		cutText ["", "BLACK OUT"];
		openMap false;
		_target setPosATL [(_pos#0), (_pos#1), 1000];
		onMapSingleClick ""; 
	};
}, [_tObject]];

Also, what is that random array with the undefined local variable at the end?

 

6 hours ago, Harzach said:

You could try cutText or maybe BIS_fnc_fadeEffect.

 

OR. Not and. Choose one. The way you have it, the cutText is never removed, leading to a permanent black screen (which is either overridden by the BIS function's fade in, or is ignored for some other reason.)


To only allow the gunner to use the addAction, you need to add a condition:

//place in init field of vehicle

this addAction 
[
	"Initiate Drop Sequence", 
	{ 
		params ["_target", "_caller", "_actionId", "_arguments"]; 
		_target removeAction _actionId; 
		openMap true; 
		_target onMapSingleClick 
		{ 
			[1,"BLACK",3,1] spawn BIS_fnc_fadeEffect;
			openMap false; 
			_this setPosATL [(_pos#0), (_pos#1), 1000]; 
			onMapSingleClick "";  
		}; 
	}, 
	nil,  //  default values until we get to the condition parameter
	1.5, 
	true, 
	true, 
	"", 
	"_this == gunner _target"
];

 

Share this post


Link to post
Share on other sites

Thanks for your help everything is working now. Except I was trying to make it eject the players from the vehicle once it lands and I couldn't get anything to work, how could I do that. And one final thing is there a way I can have it place a new version of the vehicle when it gets used that still has the same functionality?

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

×