Jump to content
Sign in to follow this  
Ed!

Simultaneous remoteControl?

Recommended Posts

Is there a way to simultaneously control multiple units at the same time?

 

Example: Controlling both the turret and driver units in a vehicle. (there is a post already on this, but too much flaming to revive).

 

remoteControl seemed like the answer, but I failed.

 

The closest I got was by switching control to the driver and gunner on each frame, but it was cancer for my eyes.

Share this post


Link to post
Share on other sites

Or perhaps is there a scripting command to force a unit to turn left or right, accelerate, brake etc?

 

Maybe a magic switchMove or animate that can be called on the vehicle just like with doors etc?

Share this post


Link to post
Share on other sites

here's a shitty hack that might get you somewhere. not taken care of shooting but only aiming so far.

_agent = createAgent [typeof player, [0,0,0], [], 0, "FORM"]; 

_agent moveingunner vehicle player; 

_target = "Box_NATO_Wps_F" createVehicleLocal [0,0,0];
_target allowdamage false;

[_agent, _target] spawn 
{
	params ["_agent", "_target"];
	
	while {true} do 
	{
		_target setpos (positioncameratoworld [0,0,100]); 
		_agent lookat _target;
		sleep 0.1;
	} 
};

run this in the consoel after entering an empty tank as a driver. you can use free look to aim the turret. it's just a simple test but works good enough already.

 

check these to make the firing happen:

 

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

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

 

this could also help when confused in combat:

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

 

your "animate" idea is great too. just not sure how universial it would be or if you'd need special values for each single tank. i'd imagine the approach would be similar. getting the camera vector and then using the aniamte command to align the turret with it.

 

 

EDIT:

 

this works great for making the gunner fire:

player addaction ["FIRE", 
{
   vehicle player action ["UseWeapon", vehicle player, gunner vehicle player, 0];
}];

Share this post


Link to post
Share on other sites

 

here's a shitty hack that might get you somewhere. not taken care of shooting but only aiming so far.

A very good idea.

 

I changed it a bit so you don't need the target.

 

The next stumbling block is using the camera of the agent in the gunner seat. Aiming via the vehicle optics would be epic.

 

Here is what I did:

testcar addEventHandler ["GetIn", {_this execVM "carin.sqf";}];

///////////////////////////
//carin.sqf

params ["_vehicle", "_position", "_unit", "_turret"];

handleClick = {
_handled = false; 
if(_this select 1 == 0) then {
	vehicle player action ["UseWeapon", vehicle player, gunner vehicle player, 0]; 
	_handled = true;
}; 
_handled;
};

if (driver _vehicle == player) then
{
	(findDisplay 46) displayAddEventHandler ["MouseButtonDown", "_this call handleClick;"];
	(findDisplay 46) displayAddEventHandler ["MouseButtonDown", ""];

	DummyGunner = createAgent [typeof player, [0,0,0], [], 0, "FORM"]; 

	DummyGunner moveingunner _vehicle; 

	[_vehicle] spawn 
	{
		params ["_vehicle"];
		
		while {driver _vehicle == player} do 
		{
			DummyGunner doWatch (positioncameratoworld [0,0,100]);
			sleep 0.1;			
		}; 
		deleteVehicle DummyGunner;
		(findDisplay 46) displayAddEventHandler ["MouseButtonDown", ""];
	};
};

Share this post


Link to post
Share on other sites

afaik optics are engine controlled 3d dialogs.

 

so you could go ahead and use something like this (pseudo code):

_modelpath = getText (configfile >> "CfgWeapons" >> _tankweap >> "optics" >> "model"); //not a real path...pseudo...too lazy to look it up lol

and then create a dialog that has that model in it.

 

alternatively ctrlCreate could potentially be enough to make it show up. haven't tested that with 3d stuff.

 

get this for working examples of 3d controls in dialogs: http://steamcommunity.com/sharedfiles/filedetails/?id=287378519

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
Sign in to follow this  

×