Jump to content

Elevator Script for Players and Vehicles [WIP/Prototype]


Axe Cop

Recommended Posts

@Axe Cop and @Users.

 

If you want i can make an elevator manaager?. 

 

Cyberwarden did a good job showing you how to bind it to plotmangement.

 

But if you guys want to add poeple to particular elevators, i can make something easy (simular to )

Sure that sounds good if you want to do that :)

 

@Havoc302: with my tests all types of vehicles should work, also helicopters!?

Link to comment
Share on other sites

sneakpeak for axecop

AC_fnc_swapObject = {
	private ["_obj","_objectCharacterID","_objectID","_objectUID","_classname","_location","_dir","_object"];
	_obj = _this select 0;
	_objectCharacterID = if (count _this >= 2) then [{_this select 1}, {_obj getVariable ["CharacterID","0"]}];
	_objectID = _obj getVariable ["ObjectID","0"];
	_objectUID = _obj getVariable ["ObjectUID","0"];
	_ownerUID = _obj getVariable ["ownerPUID","0"];
	_playerUID = getPlayerUID player;
	_playerName = name player;
	_elevatorFriends = _obj getVariable ["elevatorfriends",[]];
	if (_objectID == "0" && _objectUID == "0") exitWith { nil };
	_classname = if (count _this >= 3) then [{_this select 2}, {typeOf _obj}];
	_location = _obj getVariable ["OEMPos",(getPosATL _obj)];
	_dir = getDir _obj;
	_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];
	_object setDir _dir;
	_object setPosATL _location;	
	if(!isNil "_elevatorFriends" || count(_elevatorFriends) != 0)then{
	_object setVariable ["elevatorfriends",_elevatorFriends,true];
	}else{
	_object setVariable ["elevatorfriends",[[_playerUID,_playerName]],true];
	};
	if( !isNil "_ownerUID" && _ownerUID != "0") then{
		PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_ownerUID],_classname,_obj,player];
	}else{
		PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,player];
	};
	publicVariableServer "PVDZE_obj_Swap";
	player reveal _object;
	_object
};
Link to comment
Share on other sites

I don't know if this is way outside the scope but I had an idea to use this with a cinder block wall to make a sliding opening door system, would that be too hard to do? I figured it'd be identical to a lift in every way just not snap objects to it obviously.

Link to comment
Share on other sites

Can i ask why you never continued the project?

 

And Whats your stand on full server performances on this?

I guess that question is directed at me!? :D

firstly I think the script was more or less completed as it is, the elevator worked like it should be (at least on my server with several tests),

the performance issues are part of the Arma engine and the scripting interface is limited.. I've never seen any script trying to do "animations" like this, but in the end its like anything in arma, with more desync the elevator will jump around like vehicles do (for everyone but the driver/activator of the elevator)..  also saving custom data without modifying the Hive is very hard and you see with my multi char mod there are many problems with a custom HiveExt.dll, also it greatly complicated the installation for admins.

Those are just a few things, I have no idea how do you save the friend list in the database, I didn't look at the code for plot4life or anything :)

 

I don't know if this is way outside the scope but I had an idea to use this with a cinder block wall to make a sliding opening door system, would that be too hard to do? I figured it'd be identical to a lift in every way just not snap objects to it obviously.

correct, you can remove the attach object code and just set the ELE_PlatformClass and ELE_StopClass to other objects I think, that should work.

Link to comment
Share on other sites

correct, you can remove the attach object code and just set the ELE_PlatformClass and ELE_StopClass to other objects I think, that should work.

Awesome, so just copy another instance of this to another folder and rename some stuff to have both a lift and sliding door system?

Link to comment
Share on other sites

Awesome, so just copy another instance of this to another folder and rename some stuff to have both a lift and sliding door system?

yeah well you need to be careful my elevator script uses some global variables, those are known in the whole scripting environment (all script files share the same variable),

essentially all variables starting with "ELE_" are global, like ELE_PlatformClass, so you cant use that variable with two different values..  easy solution would be so just replace that "ELE_" prefix with something else :D

Link to comment
Share on other sites

  • 2 weeks later...

Just an idea thrown out there. Do you think this could be adapted or something else writen, instead of an elevator, you get a transporter/Teleport. 

 

- Same Building materials etc

- Teleports you instead :)

 

Just to maybe cut down on the animations :)

I think there already was a discussion about that in this topic, sure it is possible but teleportation is blacklisted by all anti hack tools obviously, but you can try that yourself :)

it is pretty easy to teleport players and vehicles in Arma script:

player setPos (getPos _elevator);

that's all to teleport the current player to the elevator :p

Link to comment
Share on other sites

I have this error client side everytime i look at an elevator.

 

Error in expression <earObjects [ELE_StopClass, _maxRange]);
_stop
};
ELE_fnc_hasNextStop = {
priv>
  Error position: <_stop
};
ELE_fnc_hasNextStop = {
priv>
  Error Undefined variable in expression: _stop
File mpmissions\__CUR_MP.Lingor\custom\elevator\elevator_functions.sqf, line 101
Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
  • 1 month later...

If you are experiencing issues with players still appearing at the start location to other players, or when multiple people/vehicles are on the elevator and don't get transported correctly, add the following code to the ELE_fnc_activateElevator as per below:

 

find

	{ 
		detach _x; 
	} forEach _attachments;

replace with

	{ 
		detach _x; 
		_dest = getPosATL _x;
		_x setPosATL _dest;
	} forEach _attachments;
Link to comment
Share on other sites

I'm trying to keep things like cinder block walls and doors from attaching to the elevator. I've tried wrapping my head around how to do that, however, I just can't understand the syntax of the loop used enough to modify it. Any help from someone with more experience would be greatly appreciated.

Link to comment
Share on other sites

I'm trying to keep things like cinder block walls and doors from attaching to the elevator. I've tried wrapping my head around how to do that, however, I just can't understand the syntax of the loop used enough to modify it. Any help from someone with more experience would be greatly appreciated.

Hi, I thought it would only attach movable entities to the elevator, but with the Epoch objects your never know.. anyway you can modify this simple loop if you like:

{ _x attachTo [_elevator]; _attachments set [count _attachments, _x]; } forEach (_elevator nearEntities ELE_Size);

the nearEntities function has an optional parameter for the type names (see doc here https://community.bistudio.com/wiki/nearEntities )

{ _x attachTo [_elevator]; _attachments set [count _attachments, _x]; } forEach (_elevator nearEntities [["Man", "Car"], ELE_Size]);

that example will only attach objects of type "Man" and "Car", so players (possibly also NPC like zombies not sure they might be agents and not "Man") and ground vehicles.. you can play around with some values if that helps.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...