j_murphy 10 Posted October 7, 2015 Hi, I am making a rifle range script for arma 3 and I am getting 2 problems: 1) When I run this the debugger returns ""Invalid number in expression on line 13", here is the function. targetPool = [tar1,tar2]; _numTargets = count targetPool; monitorTargets = false; hitNumber = 0; if (_numTargets > 0) then { monitorTargets = true; }; //Loop while we are being asked to while {monitorTargets} do { { if (animationState == "terc" && animationPhase == 1) { hitNumber = hitNumber + 1; hintSilent format["Hit number: %1", hitNumber]; } else if (animationState = "terc" && animationPhase == 0) { _this animate["terc",1]; } else { hintSilent "Miss!"; }; }forEach targetPool; }; 2) This not a fatal issue but it's not ideal. I can't call the function even though I have defined the class in a c++ header file. my description.ext: #include "Functions.h" and my Functions.h: class CfgFunctions { class crane { file = "functions\"; tags = "crane"; class PreTasks { //For funtions to be initialised before init obj's preInit = 1; class setWarInventory{}; class setRidgebackInventory{}; class startRange{}; }; class PostTasks { //for functions to be initialised after init obj's postInit = 1; class stopRange{}; }; }; }; //I forgot to end the CfgFunctions class with }; Thank you for any help. Share this post Link to post Share on other sites
R3vo 2654 Posted October 7, 2015 targetPool = [tar1,tar2]; _numTargets = count targetPool; monitorTargets = false; hitNumber = 0; if (_numTargets > 0) then { monitorTargets = true; }; //Loop while we are being asked to while {monitorTargets} do { { if (animationState == "terc" && animationPhase == 1) then { hitNumber = hitNumber + 1; hintSilent format["Hit number: %1", hitNumber]; } else { if (animationState = "terc" && animationPhase == 0) { _this animate["terc",1]; } else { hintSilent "Miss!"; }; }; }forEach targetPool; }; This should work if I didn't miss something. You forgot a "then" and some brackets Edit: ninja'd @OP, report your other post to a mod via the report button so it can be deleted. Edit: Also, add a sleep to your while loop, otherwise it will run on each frame. 1 Share this post Link to post Share on other sites
j_murphy 10 Posted October 7, 2015 Thank you for your help. EDIT: It still doesn't work, it says that the error is in line 13 in the condition. Share this post Link to post Share on other sites
killzone_kid 1331 Posted October 7, 2015 animationState of what? animationPhase of what?https://community.bistudio.com/wiki/animationState https://community.bistudio.com/wiki/animationPhase Share this post Link to post Share on other sites
j_murphy 10 Posted October 8, 2015 @killzone_kid thank you for that. Share this post Link to post Share on other sites