Jump to content
johnnyboy

What's the difference between getOut and getOutMan Eventhandlers?

Recommended Posts

GetOut applies to vehicles, no matter the unit/player getting out. It's OK for locking /unlocking... (for seat management, see also seatswitched)

getOutMan applies to unit, no matter the vehicle. It's OK for gear, backpack... managing (for seat, see also seatSwitchedMan)

 

  • Like 3

Share this post


Link to post
Share on other sites

Hello, i would like to take advantage of this topic to ask a similar question. It's also about the "getOut" and "getOutMan".
What the variable _turret means and how should I fill in with? I managed to work but still appear error.
I'm using like this in the init of player unit.

this addEventHandler ["GetOutMan", {
	params [player, "cargo", dropship1, _turret];
	[west, "tsk1", ["Paradrop inside the designated Drop Zone. Assault and secure the village of Athus. Enemy occupy the village with garrison", "Seize Athus","mrk1"], "mrk1", 1, 2, true, "attack", true] call BIS_fnc_taskCreate;
	player removeEventHandler ["GetOutMan", 0];
}];

I am doing it right?

Share this post


Link to post
Share on other sites

You can't do what you want with params .

 

this addEventHandler ["GetOutMan", {

params ["_unit", "_role", "_vehicle", "_turret"]; // passed in this EH. You can change the name the local variables, not what they concern

}];

  • Thanks 1

Share this post


Link to post
Share on other sites
On 6/29/2021 at 11:12 PM, pierremgi said:

You can change the name of local variables, not what they concern

☝️

 

@RommelBr,

The error outputting is due to using global variables and privates without quotation marks inside params.

Params only takes strings or arrays.

Quote

If String then it is the name of a private variable (must begin with underscore _, e.g. "_myVar")

 

There's also an error on BIS_fnc_taskCreate.

Quote

destination (Optional): Task destination

  • Object - Use objNull to set no position
  • Array - Either position in format [x,y,z], or [object,precision] as used by setSimpleTaskTarget command

 

On 6/29/2021 at 10:18 PM, RommelBr said:

What the variable _turret means

Quote

 

On 6/29/2021 at 10:18 PM, RommelBr said:

how should I fill in with?

You don't need it.

 

Try this, not tested:

0 = this spawn {
	if !(hasInterface) exitWith{};  
	waitUntil {isPlayer _this}; 
	_this addEventHandler ["GetOutMan", { 
		params ["_unit", "_role", "_vehicle", "_turret"];
		[west, "tsk1", ["Paradrop inside the designated Drop Zone. Assault and secure the village of Athus. Enemy occupy the village with garrison.", "Seize Athus","mrk1"], (getMarkerPos "mrk1"), 1, 2, true, "attack", true] call BIS_fnc_taskCreate;
		_unit removeEventHandler ["GetOutMan", _thisEventHandler];
	}];
};

 

Edited by RCA3
fixed script initialization thanks to pierremgi.
  • Thanks 1

Share this post


Link to post
Share on other sites

The problem with :

if (local this) then {this addEventHandler [...]...};

the init fields of edited objects/units are called before the usual event scripts (init.sqf, initserver.sqf, initPlayerLocal.sqf... see initialization order)  If I'm right, that means the playable unit still belongs to server when this init script runs. So the EH is on server.
Probably same as if (isServer) then {...}; in this case.

NOTE : But if the task is for any West, there is a chance that the specific function bis_fnc_taskCreate broadcasts the task on due PCs.

 

For any local script on player from init field, try something like that:
0 = this spawn { waitUntil {isPlayer _this}; _this addEventHandler [...]...};
 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Great thread!  Regarding getOut vs getOutMan, I very prominently recall during dev of my dynamic mission, that getOut fires in pretty much all cases (of man exiting a vehicle in pretty much any manner), whereas getOutMan misses at least one important case.  I recall having to abandon getOutMan and instead exclusively use getOut because of this.  Wish I recalled the specifics for you guys (perhaps getOutMan misses it when you teleport the man out?  Although, I think it was more than just that, b/c I wasn't really teleporting men out of vehics, so some other super important case too).  Anyhow slept too much since then.

 

If you want to catch the greatest number of vehicle exiting cases, stick with getOut.  Bummer too, because getOutMan seemed promising & definitely would have been easier to use in most situations.

 

Share this post


Link to post
Share on other sites
8 minutes ago, preserver833 said:

Stop suggesting to peoples things which does not work!  Try for yourself first before you losing the time of others!

Wow, dude, you know how to make a good first impression with your 3rd post (vs. Pierre's 3626 posts).   Pierre is one of the top most helpful guys on this forum, and a great scripter.  

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
On 6/30/2021 at 6:47 AM, pierremgi said:

If I'm right, that means the playable unit still belongs to server when this init script runs. So the EH is on server.

Yep, you're right. Thanks.

Fixed above with one small addition so it won't run on dedicated and HCs.

 

Edit:

Thinking about this again and the above code will still run on every client, although not on the server/HCs anymore. So in order to fix that we need to check (again) for locality. We also get around the remote false positives from isPlayer and getPlayerUID using !isNull findDisplay 46 instead.

There's got to be a better way to run code locally from init fields on dedicated MP...

Tested:

0 = this spawn {
	if !(hasInterface) exitWith{};
	waitUntil {!isNull findDisplay 46};
	if !(local _this) exitWith{};
	_this addEventHandler ["GetOutMan", { 
		params ["_unit", "_role", "_vehicle", "_turret"];
		[west, "tsk1", ["Paradrop inside the designated Drop Zone. Assault and secure the village of Athus. Enemy occupy the village with garrison", "Seize Athus","mrk1"], (getMarkerPos "mrk1"), 1, 2, true, "attack", true] call BIS_fnc_taskCreate;
		_unit removeEventHandler ["GetOutMan", _thisEventHandler];
	}];
};

Edit2:

Still a bit of text and won't fire on SP but i'm derailing offtopic.

this addEventHandler ["Local", {
	params ["_entity", "_isLocal"];
	if (_isLocal && !isNull findDisplay 46) then{
		//code
	};
}];

Edit3:

Initializes on every computer, EH code is executed where unit is local.

this addEventHandler ["GetOutMan", { 
	params ["_unit", "_role", "_vehicle", "_turret"];
	if !(local _unit) exitWith {};
	//code
}];
  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Wow! Thanks for every response guys, except for that one deleted 😅. The answers went even for more than i tought. I'm very noob into scripting but learned some insights from all reply's.
Backstory is, I'm making a simple single-player mission for fun with a scripted mass StaticLine paradrop at beginning. I had thought about that "getOutMan" eventHandler to make the mission task, containing the objective, only create after the player unit jumps only when out of plane, with the objective appearing not until descending in air.

  • Like 5

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

×