Jump to content

Recommended Posts

Hello everyone,

 

i hope you can help me with my problem......

 

i try to rotate my Objects from a simple Script that when ever i press a button it rotate a little bit  but if i just letting stay it without pressing anything the Object move back at it Start Position.....

 

my Script when i roatiting it is in my keyhandler the folowing :

 case 18: {
            _Dir = getDir MoveObj ;
           _NewDir = _Dir + 0.3;
           
           MoveObj setDir _NewDir;
};

 

 

Share this post


Link to post
Share on other sites

Post the entire script. I can't seem your problem at all.

Share this post


Link to post
Share on other sites

Okey first it started with a AddAction here the Code :

        life_actions = [player addAction["Möbel verschieben",life_fnc_MoebelBeweg,"",0,false,false,"",'
        typeOf CursorObject in life_moebelobj && (player distance CursorObject < 3) && (speed player < 1 && speed CursorObject < 1)']];
 

then the File "MoebelBeweg" is the following : 
 

#include "..\..\script_macros.hpp"
/*
	Filename : fn_MobelBeweg
	Description: kappa
	Author : JohnsenGodwill
	Copyright : Kavala-Life
*/
private ["Beweg","_attachPos"];


/*Beweg = param [1,objNull,[objNull]];
_unit = _this select 0;*/
life_bewegen = true;
if (!life_bewegen) exitWith {};
//if (life_Schrank_Obj == objNull) exitWith {};
//if (!((typeOf life_Schrank_Obj) in ["Land_OfficeCabinet_01_F"])) exitWith {};
if (!(nearestObject [player, "House"] in syn_haus)) exitWith {hint localize "STR_ISTR_Box_NotinHouse";};

if (typeOf cursorObject in life_moebelobj) then {
_sender = player;
_ID = owner _sender;
Beweg = cursorObject;
_attachPos = [0, 1, ((boundingBoxReal Beweg) select 1) select 2];
//Beweg attachTo [player,[0,1.5,0.5]];
Beweg enableSimulation true;
NeuZ = 0.4;

/*_hoch = 0;

moebelhoch = _hoch;
_ID publicVariableClient "moebelhoch";*/

moebelstuck = Beweg;
_ID publicVariableClient "moebelstuck";
};


life_Schrank_Obj = Beweg;

titleText [localize "STR_NOTF_PlaceContainer", "PLAIN"];



and then my KeyHandler part whitch its Switching to is the Following :

 


if (life_bewegen) then {

    switch (_code) do {
	 //space key
        case 18: {
		           _Dir = getDir Beweg;
		   _NeuDir = _Dir + 0.3;
		   
		   Beweg setDir _NeuDir;
		hint format["E Taste AlteDir = %1 NeueDir = %2 Moebel = %3",_Dir,_NeuDir,Beweg];

        };
		
		case 16: {
		if (NeuZ < 1.2) then {
			detach Beweg;
		   NeuZ = NeuZ + 0.4;
		   Beweg setPosATL ((getPosATL Beweg) vectorAdd [0,0,0.2]);
		   
		};
        };
		
		case 20: {
		if (NeuZ > 0.2) then {
			detach Beweg;
		   NeuZ = NeuZ - 0.4;
		   Beweg setPosATL ((getPosATL Beweg) vectorAdd [0,0,-0.2]);
		   
		};
        };
        //space key
        case 57: {
            [Beweg] spawn life_fnc_MoebelUpdate;
        };
    };
    true;
};

 

and last when i press the Spacebar so the file "MoebelUpdate" is : 

 

#include "..\..\script_macros.hpp"
/*
    File : fn_MoebelUpdate.sqf
    Author: JohnsenGodwill

    Description:
    Place and set Position and Direction of the Object

*/
/*detach _moebel;
hint format ["%1", _moebel];*/

private ["_moebel","_isFloating"];
_moebel = life_Schrank_Obj;

_moebelID = _moebel getVariable ["moebel_id", -1];
_Dir = getDir _moebel;
_pos = getPos _moebel;
_moebel enableSimulation false;


_moebel setDir _Dir;
_moebel setPos _pos;
hint format ["%1", _moebelID];
[_moebelID,_moebel] remoteExec ["TON_fnc_updateMoebelPos",RSERV];
life_bewegen = false;


i hope i could show you now all that you want to know! :)

Share this post


Link to post
Share on other sites

So, what exactly are your goal and your current problem? Move furniture? Push Space to rotate for what? When you release Space and it goes to its original position? And, how do you call your “KeyHandler”?

Share this post


Link to post
Share on other sites

I rotate my Objects that i placed in the House ans this works very well only if press spacebar the object rotate to the startposition and the keyhandler getting called within the Mission Start so all works perfect but the rotatet object that i rotate with my Key rotating back Alter i press spacebar

 

 

 

 

p.s if you have Steam we Can write There and i can Show you my Problem over Teamviewer or anydesk

Share this post


Link to post
Share on other sites

Update : This Topic can be closed the whole misstake was the follwing....... i forgot that i have to setDir first and then setPos because otherwise the object just rotate back like the wiki tells it in setDir..... 

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

×