AZCoder 921 Posted November 27, 2015 I don't see _leaderGroup defined. Change the hint: hint format["%1", count (units group _leader)]; Share this post Link to post Share on other sites
kromka 40 Posted November 27, 2015 You are right. However it in your version i recieve "scalar". Share this post Link to post Share on other sites
AZCoder 921 Posted November 28, 2015 I would try doing the hint on just _leader to make sure it has a value, and maybe remove the ( ) part so it's just count units group _leader. You can also change _leader to player to prove that the hint works. Share this post Link to post Share on other sites
kromka 40 Posted November 28, 2015 AZCoder, forget about it. I figured out it was a complex bug. I just joined array of units to nullObj unit. It was happen because i didn't noticed that execVM which operate also on those units ran in separate thread. Clue of this problem is addition of "waitUntil {scriptDone _someHandle}. Now everything is right. Sorry for bothering you. Share this post Link to post Share on other sites
AZCoder 921 Posted November 28, 2015 I'm glad you got it sorted out. Share this post Link to post Share on other sites
kromka 40 Posted November 29, 2015 Another fancy question. I would like to ring a bell :) Really. Churches in A3 have they own sound of bells. Is it possible to extract it from libs somehow? I know how to play a sound, however i have no sound. Regards. --------------------- I know: playsound3d ["A3\sounds_f\ambient\objects\bell_big.wss", position]; Basic sounds are in soundds_f.pbo. Use PBOManager to figure out what is ther. Share this post Link to post Share on other sites
kromka 40 Posted December 14, 2015 I have MP mission (i don't know it is important). In this mission there is a boat and a pack of objects. I would like this boat go randomly from object to object. To do this on the very beginning of init.sqf file i've done: boatPatrolWPPool = [boat_wp, boat_wp_1, boat_wp_2, boat_wp_3, boat_wp_4, boat_wp_5, boat_wp_6, boat_wp_7, boat_wp_8, boat_wp_9, boat_wp_10, boat_wp_11, boat_wp_12, boat_wp_13, boat_wp_14, boat_wp_15, boat_wp_16, boat_wp_17]; an array of this objects and in init field of the boat: null = [this, boatPatrolWPPool] execVM "scripts\moveToRandomFromPool.sqf"; Hovewer problem is that in the moment of first passing this array seems to be empty. It seems "init" of vehicle occurs before init.sqf. Am i right and is some workaround? Share this post Link to post Share on other sites
shuko 59 Posted December 14, 2015 You are correct, init fields are processed before init.sqf. Name the boat and run the script from init.sqf: [NameOfTheBoat, boatPatrolWPPool] execVM "scripts\moveToRandomFromPool.sqf"; Of course, nothing prevents you from moving that array definition to the boat's init field. Share this post Link to post Share on other sites
kromka 40 Posted December 15, 2015 This is clear. But... I think it is quiet expected to have all variables ready before anything else. In this case i see a problem, because definition of variable may happen AFTER usage of this variable. Is any way to make a block of code that will be executed before everything to be sure all vars will be declared and defined in proper order? I ask because for convenience i've made couple of pools of object i would like to inject in some different places (eg. condition of trigger, init of object). But those fields are executed before my pools will be set up. I've noticed there is something like preInit but i am not sure how to use this and where (it seems preInit should be used in desccription.ext). Or maybe there is better aproach to this problem? Share this post Link to post Share on other sites
Larrow 2821 Posted December 15, 2015 Two possible solutions.. As you say there is the preInit option for CfgFuncions.. //Description.ext class CfgFunctions { class MyTag { class Variables { class WPPools { file "fn_WPPools.sqf"; preInit = 1; }; }; }; }; //fn_WPpools.sqf boatPatrolWPPool = [boat_wp, boat_wp_1, boat_wp_2, boat_wp_3, boat_wp_4, boat_wp_5, boat_wp_6, boat_wp_7, boat_wp_8, boat_wp_9, boat_wp_10, boat_wp_11, boat_wp_12, boat_wp_13, boat_wp_14, boat_wp_15, boat_wp_16, boat_wp_17];Would make sure the file fn_WPPools.sqf was run before any object inits are done. The only trouble is you say your WPs are objects so i dont think they exist at this point and the array would be full of undefined ANY, you could turn them into strings and use them as marker names.Or you could just add a waituntil to the top of your boat script to make sure the variables are available. //scripts\moveToRandomFromPool.sqf waituntil { !isnil "boatPatrolWPPool" }; Share this post Link to post Share on other sites
kromka 40 Posted December 15, 2015 First method is quiet elegant, but you are right, i have array full of "any". I suppose purpose of "preInit" is different than initialization of own variables :) Second method is also bad, because apparently boatPatrolWPPool itself isn't null, just contains nothing. It seems shuko's advice is the safest. Thank you for hints. Share this post Link to post Share on other sites
Larrow 2821 Posted December 15, 2015 Second method is also bad, because apparently boatPatrolWPPool itself isn't null, just contains nothing.Thats why its says !isNil ..... not !isNull Share this post Link to post Share on other sites
kromka 40 Posted December 16, 2015 Thats why its says !isNil ..... not !isNull When i try to use waitUntil {!isNil "boatPatrolWPPool"}; hint "something"; I recieve: 10:26:37 Error in expression <waitUntil {!isNil "boatPatrolWPPool"}; hint "something> 10:26:37 Error position: <!isNil "boatPatrolWPPool"}; hint "something> 10:26:37 Error Generic error in expression but when I change it to waitUntil {isNil "boatPatrolWPPool"}; hint "something"; there is no error. Apparently negation doesn't work as i expect. Share this post Link to post Share on other sites
Larrow 2821 Posted December 16, 2015 The error you are seeing is because you are calling this code somewhere from a non scheduled environment. In previous post you said you were execVM "scripts\moveToRandomFromPool.sqf"; which is scheduled and should not cause the error you are seeing with the waitUntil. For example try these simple steps as a test. Players init box nul = this execvm "test.sqf";test.sqf waitUntil{ !isnil "myWPs" }; hint format["My name is %1 and i have WPs %2", name _this, myWPs];init.sqf myWPs = ["wp1","wp2","wp3"];Mission starts, player object is spawned that execvm "test.sqf, which then waits until myWPs is not nil, init.sqf runs defines the variable myWPs, test.sqf continues hinting player name and the contents of myWPs. Share this post Link to post Share on other sites
kromka 40 Posted December 16, 2015 Your example generally and logically is similar to my situation. I run code with "!isNil" in an init of vehicle placed in the editor: // init of vehicle waitUntil {!isNil "boatPatrolWPPool"}; hint "something"; I've just changed calling of "scripts\moveToRandomFromPool.sqf" with a "hint ...", to show you that those script itself isn't a problem. First time "boatPatrolWPPool" appears in init.sqf. It means first check of "boatPatrolWPPool" (in init of vehicle) is made when there is no "boatPatrolWPPool": // from init.sqf boatPatrolWPPool = [ /*some objects placed also in the editor*/ ]; Maybe this is cause and condition should look like this: // init of vehicle waitUntil (!isNul ... && !isNil ...) then isNil will be checked only if "boatPatrolWPPool" exists. I am not sure is it allowed for waitUntil. From the debugger I have strict info, problem is with "!isNil" (it is preceded by #) however i really don't see why. Share this post Link to post Share on other sites
Larrow 2821 Posted December 16, 2015 I run code with "!isNil" in an init of vehicle placed in the editor:You can not place a waitUntil in an objects init as the code there is run unscheduled and code suspension is not allowed. Thats why i said place it in the top of your execvm'ed script, your execvm'ed code will be running in a scheduled environment where code suspension is allowed. Share this post Link to post Share on other sites
kromka 40 Posted December 16, 2015 Ok. Now everything is clear. I will fix it and inform what happen. Thank you. Share this post Link to post Share on other sites
kromka 40 Posted December 29, 2015 Larrow, you were right. Boat script works properly. ---- Are block comments allowed in files that are compiled? jamTfar = compile loadFile "scripts_specific\jamTfar.sqf"; When i do this i have still an error in "jamTfar.sqf" 12:15:36 Error in expression </** some comment **/ private ["_parameters"> 12:15:36 Error position: </** some comment **/ private ["_parameters"> 12:15:36 Error Invalid number in expression But when i don't compile this sqf, just execVM it everything is all right. Do i missed something? Regards. Share this post Link to post Share on other sites
killzone_kid 1330 Posted December 29, 2015 you need to preprocessFile, preprocessor removes comments. Share this post Link to post Share on other sites
kromka 40 Posted January 18, 2016 Hello. I've noticed two strange behaviours of choppers: 1. When chopper have a waypoint AND his altitude is set with "veh setPosASL alt" AND alt > 800 (about) chopper starts making circles and dosn't proceed to the waypoint. 2. When chopper flies over Altis from one edge to another (using doMove command) AND his route goes above central airfield (this SE of Gravia), when he arrive to this airfield he starts circling without any reason. Well, i've just observed chopper that was about 1 km NE from airfields and it turned back (!!!) to the airfield despite specific waypoint. Are these behaviours features or bugs? Regards. Share this post Link to post Share on other sites
f2k sel 164 Posted January 19, 2016 Aircraft do have a height limit set by the game engine which is extremely low and has been an issue forever. They will fly straight above 800 meters if instead of waypoints or domoves you have the chopper join another unit on the other side of the Island. It seems to override the height limit at least it did last time I tried it. Share this post Link to post Share on other sites
kromka 40 Posted January 19, 2016 @f2k sel Thank you for info. This is weard. I still wonder why BI fixes some small bugs and left such hudge. Do you have any idea what with this airfield? Or maybe you can reproduce it? (just put heli in one edge of map and add to his init "doMove" to the opposite edge - path should go above airfield). Regards. Share this post Link to post Share on other sites
f2k sel 164 Posted January 19, 2016 Sorry couldn't reproduce the second issue. Share this post Link to post Share on other sites
kromka 40 Posted January 20, 2016 Look at this clip: https://www.youtube.com/watch?v=7aGsdLysAPE I use this code (in console is showned something else, but effect is the same - you can directly copy it into your console): _cargoVeh = [[10000, 0, 300], [10000, 0, 300] getDir [16544, 30720, 300], "I_Heli_Transport_02_F", CIVILIAN] call bis_fnc_spawnVehicle select 0; _cargoVeh setPosASL [10000, 0, 300]; _cargoVeh flyInHeight 300; _cargoVeh allowDamage false; (group _cargoVeh) addWaypoint [[12485, 13355, 300], 0]; (group _cargoVeh) addWaypoint [[16544, 30720, 300], 0]; [_cargoVeh, null, [12485, 13355, 300], [16544, 30720, 300]] spawn { while{(_this select 0) distance2D (_this select 2) > 200} do { sleep 0.5; }; hint "drop"; while{(_this select 0) distance2D (_this select 3) > 200} do { sleep 0.5; }; { deleteVehicle _x; } forEach crew (_this select 0); deleteVehicle (_this select 0); }; As you can see, above airfield (3:53 in the movie) chopper starts some acrobations. But when i will use the same code with clear map (just me, zeus module and chopper) everything goes right. What can cause such behaviour? Probably something placed on airfield but have no idea what. Regards Share this post Link to post Share on other sites
f2k sel 164 Posted January 21, 2016 Only thing I can think of is that the chopper is returning for the guy that jumped out, maybe try it with the jumps disabled and see it the issue persists. Share this post Link to post Share on other sites