So after having my prior post answered for cursorTargets and arrays, Ive been able to progress my code further but cannot get it to reset my actions. All other parts of my code are working except for resetting it and while Ive had many mods and all of fn_selfActions.sqf to read through, ive been unable to solve it.
this is the code to modify Olmatechoc's chameleon skin changer to use wardrobes/closets to initialize the male/female dialogs (now seperated, no field sex changes!) to change skins, no sense in using a button or 40 lines of code to add the dialog to skins
Spoiler
if (VR_useWardrobe) then { //init variable set to true so one can decide if they want to use this or not
_cursorTarget = cursorTarget; //sets cursor target
_isWardrobe = (typeOf (_cursorTarget) in VR_arrayWardrobes); //returns if cursor target is defined in my array! thanks @Salival
_isFemale = (typeOf (player) in VR_femaleSkins); //returns if player is a female from array of skins
if ((_isWardrobe) && (player distance _cursorTarget < 5)) then { // if cursor target is in wardrobe array and if player is within 5m of it
if (s_changing_room < 0)) then { //self action variable
if (!_isFemale)) then { //if male then >
s_changing_room = _cursorTarget addAction ["Men's Room","dayz_code\actions\SkinMenu\Male_Dialog.sqf",_cursorTarget, 0, true, true]; //addaction to wardrobe olmatechocs chameleon skin changer for males
systemChat "Welcome to the Men's Room good sir!"; //just a little chat to show how many times its executing this! (there was a time it just kept executing)
//s_changing_room = 1; //moved this all over trying to break the chain and reset the action
};
if (_isFemale) then { //if female then >
s_changing_room = _cursorTarget addAction ["Gal's Room","dayz_code\actions\SkinMenu\Female_Dialog.sqf",_cursorTarget, 0, true, true]; //execute olmatechocs chameleon skin changer for females
systemChat "Welcome to the Lady's Room ma'am!"; //just a little chat to show how many times its executing this! (there was a time it just kept executing)
//s_changing_room = 1; //moved this all over trying to break the chain and reset the action
};
};
} else { //attempt to reset self action if cursorTarget is not wardrobe or if not within 5m
_cursorTarget removeAction s_changing_room; //remove the action! This part is not working
s_changing_room = -1; //reset the variable!
};
};
I have been working on this for the last few days and watched the code explode from a few lines to this jumbled mess, im at my wits end, i can get the code to either fire repeatedly and spam the action menu or just add the action every time you look at the object but it will not remove. I cannot figure out why and am looking for some explanation.
SO to clarify, code is working EXCEPT for removing the action, can someone help identify and explain where my code is wrong? TYVM!
Question
ViktorReznov
So after having my prior post answered for cursorTargets and arrays, Ive been able to progress my code further but cannot get it to reset my actions. All other parts of my code are working except for resetting it and while Ive had many mods and all of fn_selfActions.sqf to read through, ive been unable to solve it.
this is the code to modify Olmatechoc's chameleon skin changer to use wardrobes/closets to initialize the male/female dialogs (now seperated, no field sex changes!) to change skins, no sense in using a button or 40 lines of code to add the dialog to skins
if (VR_useWardrobe) then { //init variable set to true so one can decide if they want to use this or not _cursorTarget = cursorTarget; //sets cursor target _isWardrobe = (typeOf (_cursorTarget) in VR_arrayWardrobes); //returns if cursor target is defined in my array! thanks @Salival _isFemale = (typeOf (player) in VR_femaleSkins); //returns if player is a female from array of skins if ((_isWardrobe) && (player distance _cursorTarget < 5)) then { // if cursor target is in wardrobe array and if player is within 5m of it if (s_changing_room < 0)) then { //self action variable if (!_isFemale)) then { //if male then > s_changing_room = _cursorTarget addAction ["Men's Room","dayz_code\actions\SkinMenu\Male_Dialog.sqf",_cursorTarget, 0, true, true]; //addaction to wardrobe olmatechocs chameleon skin changer for males systemChat "Welcome to the Men's Room good sir!"; //just a little chat to show how many times its executing this! (there was a time it just kept executing) //s_changing_room = 1; //moved this all over trying to break the chain and reset the action }; if (_isFemale) then { //if female then > s_changing_room = _cursorTarget addAction ["Gal's Room","dayz_code\actions\SkinMenu\Female_Dialog.sqf",_cursorTarget, 0, true, true]; //execute olmatechocs chameleon skin changer for females systemChat "Welcome to the Lady's Room ma'am!"; //just a little chat to show how many times its executing this! (there was a time it just kept executing) //s_changing_room = 1; //moved this all over trying to break the chain and reset the action }; }; } else { //attempt to reset self action if cursorTarget is not wardrobe or if not within 5m _cursorTarget removeAction s_changing_room; //remove the action! This part is not working s_changing_room = -1; //reset the variable! }; };
I have been working on this for the last few days and watched the code explode from a few lines to this jumbled mess, im at my wits end, i can get the code to either fire repeatedly and spam the action menu or just add the action every time you look at the object but it will not remove. I cannot figure out why and am looking for some explanation.
SO to clarify, code is working EXCEPT for removing the action, can someone help identify and explain where my code is wrong? TYVM!
Link to comment
Share on other sites
11 answers to this question
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now