Sakuie 1 Posted July 4, 2016 Hey guys/girls, now, I am not completely new to coding and such, but I am relatively new to the SQF syntax. So I need a little assistance here. :) Anyhow, I have been looking through actions and functions in A3 and I wanted to make a unit call BIS_fnc_ambientAnim (in this special case BRIEFING) and later, when it detect's threat, the ambientAnim should terminate. I got this to work, thanks to "Pierre MGI", BUT this particular animation bothered me a little bit, because on execution the primary weapon of the unit get's removed, and that's a bummer, when the unit is a road guard. :D So, I tried some things, such as setUnitLoadout, but it won't work, so I made an if-statement, and there's the problem. Here's the code: (I execute the code via console and the command execVM "units_scripts_apk.sqf"; and I use 3DEN, just so you know) // Unit apk_rogain_bottomGuard_bunker ! \\ _apk_rogain_bottomGuard_bunker_loadout = getUnitLoadout apk_rogain_bottomGuard_bunker; //Let's get his loadout, shall we _apk_rogain_bottomGuard_bunker_weapons = weapons apk_rogain_bottomGuard_bunker; // Get his weapons sleep 0.9; //Wait virtually a second [apk_rogain_bottomGuard_bunker,"BRIEFING","ASIS"] call BIS_fnc_ambientAnim; //Let's make him have some nice animations while idle-state 0 = apk_rogain_bottomGuard_bunker spawn {waitUntil {behaviour _this == "combat"}; //Wait until he see's threat apk_rogain_bottomGuard_bunker call BIS_fnc_ambientAnim__terminate;}; //And now end the animation and get to normal mode //At this point I saw, that when this particular animation is initiated, the primary weapon will be removed from the unit, so let's fix it sleep 0.9; apk_rogain_bottomGuard_bunker setUnitLoadout _apk_rogain_bottomGuard_bunker_loadout; //Once again, wait nearly a second apk_rogain_bottomGuard_bunker setUnitLoadout _apk_rogain_bottomGuard_bunker_loadout //Reassign his original loadout if (primaryWeapon == "") or (primaryWeapon isNil) then {apk_rogain_bottomGuard_bunker addWeapon format ["%1", _apk_rogain_bottomGuard_bunker_weapons]} else {apk_rogain_bottomGuard_bunker addWeapon "arifle_MX_ACO_pointer_F"}; //Just in case the above doesn't work And here's the exact error line: |#|if (primaryWeapon == "") or (primaryWeap...' Error Missing ; My understanding is that the |#| symbolize's the approximate location where something is missing, but feel free to teach me. ^^ Greetings! Share this post Link to post Share on other sites
zooloo75 834 Posted July 4, 2016 Try changing: if (primaryWeapon == "") or (primaryWeapon isNil) to if ((primaryWeapon == "") || (primaryWeapon isNil)) Good luck! Share this post Link to post Share on other sites
MATTXYO 1 Posted July 4, 2016 Should it not be: If ((primaryWeapon apk_rogain_bottomGuard_bunker == "" ) or (primaryWeapon apk_rogain_bottomGuard_bunker isNil)) Share this post Link to post Share on other sites
kylania 568 Posted July 4, 2016 if (primaryWeapon apk_rogain_bottomGuard_bunker == "") then { /* use one or the other */ if (isNil primaryWeapon apk_rogain_bottomGuard_bunker) then { Both evaluations are the same, use one or the other, not both. Also notice it's: isNil <value> not <value> isNIl. Share this post Link to post Share on other sites
Sakuie 1 Posted July 4, 2016 @Mattxyo @zooloo75 Well yeah, I just realised that I did miss out on parameters. Thanks for taking a look into it. Also thought about those bracket's, but the change didn't do anything, as I expected. ^^ @kylania Aye, gotcha man. Imma fiddle around with only one check. Gonna reply again, when I found something out. But so far it didn't do anything, it still throws errors. 1 Share this post Link to post Share on other sites
kylania 568 Posted July 4, 2016 // [apk_rogain_bottomGuard_bunker] call fnc_reactiveBriefingAnim; fnc_reactiveBriefingAnim = { params["_unit", ["_anim", "BRIEFING"]]; _loadout = getUnitLoadout _unit; [_unit,_anim,"ASIS"] call BIS_fnc_ambientAnim; 0 = [_unit, _loadout] spawn { params ["_unit", "_loadout"]; waitUntil {behaviour _unit == "combat"}; _unit call BIS_fnc_ambientAnim__terminate; _unit setUnitLoadout _loadout; }; }; [apk_rogain_bottomGuard_bunker] call fnc_reactiveBriefingAnim; 1 Share this post Link to post Share on other sites
Sakuie 1 Posted July 4, 2016 @kylania Yeah I was clever enough to see, that the call had to be used. > :D Well, works like butter now. Thank's lad. Have a lot to learn in SQF :D I guess I will work on my written crippled thing anyways, just so to learn, obviously. Once again: thank ya, lad! ^^ Share this post Link to post Share on other sites
kylania 568 Posted July 4, 2016 Absolutely, try to figure out how the version I posted works compared to how you had it. :) One thing to compare closely is the use of spawn in each version. Share this post Link to post Share on other sites
Sakuie 1 Posted July 4, 2016 @kylania Yeah, gonna take a closer look on that one! :) ^_^ Share this post Link to post Share on other sites