Jump to content

Recommended Posts

Hey :)
 
I have a strange problem. I am trying to make the teleportscript for going on the roof of buildings work via addon.
I have a condition and an action set up to teleport up and down a certain building.
the problem is that the math does not seem to work out...
have a look

class CfgVehicles {
	class House_F;
	class Land_MultistoryBuilding_01_F : House_F {
		class UserActions {
			class DES_GetUpBalcony {
				displayName = "Go to balcony";
				displayNameDefault = "Go to balcony";
				priority = 3;
				radius = 40;
				position = "camera";
				showWindow = 1;
				onlyForPlayer = 1;
				shortcut = "";
                                // the first position is a door. i made a vector (rotateable around z depending on the direction of the building) pointing to it. i check the distance between the player and the doorposition.
				// if the house is at pos [0,0,0] and has dir 0°: [-17.502,17.920,1] is a little bit in front of the door.
                                // strangely they always have an random offset [x+, y+, z+]. also with the teleport pos.
                                condition = "
				[ 
					(getPos this select 0) + ((-17.502) * cos (-getDir this) - (-17.920) * sin (-getDir this)), 
					(getPos this select 1) + ((-17.502) * sin (-getDir this) + (-17.920) * cos (-getDir this)), 
					1 
				] distance getPos player <= 8
				";
				statement = "player setPos [ (getPos this select 0) + ((-12.77) * cos (-getDir this) - (-17.7124) * sin (-getDir this)), (getPos this select 1) + ((-12.77) * sin (-getDir this) + (-17.7124) * cos (-getDir this)), 6.37 ]";
			};
			class DES_GetDownBalcony {
				displayName = "Go downstairs";
				displayNameDefault = "Go downstairs";
				priority = 3;
				radius = 40;
				position = "camera";
				showWindow = 1;
				onlyForPlayer = 1;
				shortcut = "";
				condition = "[ (getPos this select 0) + ((-12.385) * cos (-getDir this) - (-17.991) * sin (-getDir this)), (getPos this select 1) + ((-12.385) * sin (-getDir this) + (-17.991) * cos (-getDir this)), 7.4 ] distance getPos player <= 8";
				statement = "player setPos [ (getPos this select 0) + ((-17.502) * cos (-getDir this) - (-17.920) * sin (-getDir this)), (getPos this select 1) + ((-17.502) * sin (-getDir this) + (-17.920) * cos (-getDir this)), 0 ]";
			};

			.
                        .
                        .

		};
	};
};

Share this post


Link to post
Share on other sites

Resolved. I will use modelToWorld instead in some crazy vector calculatuons.

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

×