-
Content Count
27 -
Joined
-
Last visited
-
Medals
Everything posted by swift39
-
Scripting a Group of Protesting Civilians
swift39 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Happy Easter Everyone, I am currently attempting to create a mission that involves a group of Protesters (Civilians) that initially use animations, then when the situation escalates they become armed and go on the offensive. Unfortunately my scripting skills are less than novice and reading the Forums am struggling with it. Using IndeedPete's example in this thread https://forums.bohemia.net/forums/topic/175237-arma-3-animations/ and trying various examples from other posts can only seem to make this work. _animation = ["c7a_bravoTOerc_idle8", "c7a_bravo_dovadeni1", "c7a_bravoTleskani_idle5", "c7a_bravo_dovadeni3"] call BIS_fnc_selectRandom; Protester switchMove _animation; Protester_1 switchMove _animation; Protester_2 switchMove _animation; Protester_3 switchMove _animation; On testing this seems to work intermittently and does not appear to "randomize" on the AI, I mean they all seem to get the same animation. I have created a unit called Protesters and set the Composition:Init to the following What I would like to have happen is to ensure the animations play and are truly random amongst the group, each one playing a different animation. Also would like to set it up that I don't have to add each civilian into the script and just being able to add them to the unit, I plan on a lot of protestors. Group and Unit seem to cause scripting errors, which I am sure I have missed something. Also would like the animations to randomize continually so each protester changes their animation at times. Any assistance is greatly appreciated and thank you in advance Greg -
playSound Issues - Much to everyones joy
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thank you... It turned out it was a bad .ogg file. I had built and rebuilt a couple times earlier with Audacity but after your post rebuilt in same then saved as mp3 file. then ran it through dBpoweramp for the conversion for the file to .ogg and now works fine. I feel like a bit of an idiot chasing posts now. Anyway lessoned learned and thank you all again. Cheers Greg Yeah +50 is a bit loud, in my desperation I cranked it up just in case it was being drowned out. Its down now... -
playSound Issues - Much to everyones joy
swift39 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello All, I spent most of the day trying to get a music to play in an intro I am playing with. Scouring the forums and google, I have tried what I think is almost everything and yet completely missing something. I am using Alias Intro script which is easy to use by the way. but cannot get a piece of music file to play at all. I would like to use "playSound" as during my mission to find the solution I read that this play across the map and does not have a distance limit. the intro.sqf // Original script and functions created by Alias from aliascartoons and all credit goes to him // nul = [JIP] execVM "AL_intro\intro.sqf"; waitUntil {time > 0}; _jip_enable = _this select 0; [[_jip_enable],"TWR_intro\time_srv.sqf"] remoteExec ["execVM"]; waitUntil {!isNil "curr_time"}; if (!hasInterface) exitWith {}; if ((!curr_time) or (_jip_enable<0)) then { playSound "sum41_war"; loopdone = false; while {!loopdone} do { // INSERT CAMERA SHOTS BELOW ______________________________________________________________________________ _1stshot = [cam1, cam1, target0, 20, 2.0, 2.0, true, 0, -6, 3, true] execVM "TWR_intro\camera_work.sqf"; cutText ["<t color='#FFFFFF' size='5'>TOWERGAMES PRESENTS</t>", "BLACK IN", 15, true, true]; waitUntil {scriptdone _1stshot}; ......... The description.ext class CfgSounds { sounds[] = {sum41_war}; class sum41_war { name = "sum41_war"; sound[] = {"\sound\sum41_war.ogg", db+50, 1}; titles[] = {}; }; }; From what I read it should be this simple, but obvisouly am missing something. the file is 3 mb, could that be the issue? Any suggestion or comments greatly appreciated. Cheers Greg -
playSound Issues - Much to everyones joy
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks for the reply. Yes, I tried playMusic with the same result. I am wishing to pursue playSound because I found in some of the forums it has no distance limitations, and bypasses the music volume which everyone has turned down, but haven't been able to confirm it yet. Cheers Greg -
Just a quick question... Is there a way after setting a new direction of AI to return to their original position? I am using getDirVisual for an official they turn and face as he walks by _dir = getDirVisual _official; //Find the direction of the official then execute it _x disableAI "ANIM"; _x setDir _dir; _x lookAt _official; which works, but when released from the script they continue their animation in the "new" direction which is messing things up. What I would like to do is save the AI's original position then change direction during the script, then upon completion return to original direction and animation. Hope this makes sense Cheers Greg
-
Reverting AI to original position
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks to you both, I was overthinking this I just had to place the getDir before disableAI and it works fine or as well as the AI will let you. Cheers Greg orgPos = getDir _x; _x disableAI "ANIM"; _x setDir _dir; _x lookAt _official; -
[RELEASE] Engima's Traffic Script
swift39 replied to engima's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks, that seems to do the trick. -
[RELEASE] Engima's Traffic Script
swift39 replied to engima's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello Is there a way to Blacklist traffic like you have done in Civilians? I like the randomness of your work and definitely adds to missions a bit of realism. It would be nice to have no traffic in a couple select areas, as it tends to reek havoc in a military compound in a mission I am trying to build. Thanks for any suggestions. Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thank you very much for your consideration. I am looking for a guide explaining the differences and have read Fockers Arma 3 Scripting Guide, but doesn't touch dedicated. I will continue to read forums and hopefully come to some understanding of the main or key differences when it comes to this segment. Although I don't understand it would require such a different approach from multi-player. Anyways thank you for your assistance and take care Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Ok so yesterday I had everything working in GOM's script on SP and the EDEN MP. Placed it on the Dedicated server and it fell down. Assuming this is right... //inits the protesters sqf _init = [] execVM "scripts\GOM\GOM_fnc_armedProtesters.sqf"; //this initializes all functions within the .sqf file waitUntil {scriptDone _init}; _initProtesters = [] spawn GOM_fnc_armedProtestersInit; _attack = player addEventHandler ["FiredNear", { [10] spawn GOM_fnc_armedProtestersAttack; //starts the attack with amount of attackers as param, defaults to 5 if no number is given player removeEventHandler ["FiredNear", _thisEventHandler]; }] remoteExec ["_attack", 0]; I am at a complete loss as to how to adapt GOM's script to function on a dedicated server. Mainly I am just getting confused. I have tried a few techniques, i.e placing it in the Serverinit.sqf and such but to no avail. Any suggestions or an explanation on how to script this for dedicated server, the steps to be followed and such would be greatly appreciated. I apologize in advance for lack of understanding with this, but am just trying figure this out. Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Ok so I believe I am making some progress. First thank you to XianGrim.... The Helipad linked to the Protester script works great, then adding a sleep and delete vehicle gives the scene a little realism, well I think anyway.... I will post the script later. I think I am slowly understanding the remoteExec application, but am having some difficulty with errors... GOM's script init //inits the protesters sqf _init = [] execVM "scripts\GOM\GOM_fnc_armedProtesters.sqf"; //this initializes all functions within the .sqf file waitUntil {scriptDone _init}; _initProtesters = [] spawn GOM_fnc_armedProtestersInit; _attack = player addEventHandler ["FiredNear", { [10] spawn GOM_fnc_armedProtestersAttack; //starts the attack with amount of attackers as param, defaults to 5 if no number is given player removeEventHandler ["FiredNear", _thisEventHandler]; }] remoteExec ["call", 0]; My script init (AKA AZCoder's work) //inits the civilian protesters sqf _init = [] execVM "scripts\TWR\TWR_fnc_protestanim.sqf"; //this initializes all functions within the .sqf file waitUntil {scriptDone _init}; _initProtesters = [] spawn TWR_fnc_ProtesterInit; _flee = player addEventHandler ["FiredNear", { [] spawn TWR_fnc_ProtesterRelease; player removeEventHandler ["FiredNear", _thisEventHandler]; }]remoteExec ["call", 0]; While the script seems to run and for the most part work, although in my script it seems to work intermittently. I get this error '[#]call (_this)' Error _call: Type Number, expected code My understanding is when 0, the function or command will be executed globally. Confusing... Like I stated yesterday the purpose of the two scripts is just me learning, but also I am thinking having Mine/AZCoder script to have civilians protest (the Bulk of them) then when firedNear they do what civilians do and then Have GOM's script (a realistic amount) provide the armed civilians to continue the Riot. Anyway thanks for the interest and will continue to sort this out. Suggestions, Comments or feedback always welcome Cheers Greg *****UPDATE****** Ok I am feeling a little stupid right now and assuming this is right, because it removed the scripting errors, but this worked: //inits the protesters sqf _init = [] execVM "scripts\GOM\GOM_fnc_armedProtesters.sqf"; //this initializes all functions within the .sqf file waitUntil {scriptDone _init}; _initProtesters = [] spawn GOM_fnc_armedProtestersInit; _attack = player addEventHandler ["FiredNear", { [10] spawn GOM_fnc_armedProtestersAttack; //starts the attack with amount of attackers as param, defaults to 5 if no number is given player removeEventHandler ["FiredNear", _thisEventHandler]; }] remoteExec ["_attack", 0]; //inits the civilian protesters sqf _init = [] execVM "scripts\TWR\TWR_fnc_protestanim.sqf"; //this initializes all functions within the .sqf file waitUntil {scriptDone _init}; _initProtesters = [] spawn TWR_fnc_ProtesterInit; _flee = player addEventHandler ["FiredNear", { [] spawn TWR_fnc_ProtesterRelease; player removeEventHandler ["FiredNear", _thisEventHandler]; }]remoteExec ["_flee", 0]; The only thing left is to get my script to release the civilians when shots are fired. Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
So finally having sometime to get back on this little excursion, I have spent the morning sorting everything out that has been provided to date. I decided I would create a script using AZCoder's script and with a "few suggestions" from GOM mainly to understand the principles of functions and the process of there is always more than one way to achieve the same results when it comes to coding. I also figured having a script in the tool box that provided animation loops then when triggered the AI carry on there merry way could never hurt. so with AZCoder's animation script I came up with this: AI Init this setVariable ["TWR_fnc_ProtesterAnim",true,true]; the Init.sqf //inits the civilian protesters sqf _init = [] execVM "scripts\TWR\TWR_fnc_protestanim.sqf";//this initializes all functions within the .sqf file waitUntil {scriptDone _init}; _initProtesters = [] spawn TWR_fnc_ProtesterInit; _flee = player addEventHandler ["FiredNear", { player remoteExec [[] spawn TWR_fnc_ProtesterRelease]; player removeEventHandler ["FiredNear", _thisEventHandler]; }]; As I am sure, most have figured out the remoteExec is not in the right place or written wrong, because I am getting a scripting error. I am still sorting this out becuase I really dont know the "proper" approach. To me this makes sense to have the remoteExec command fire in the init.sqf, to ensure all players receive it on their respective systems. I am still reading up on this and will welcome a sure fire way to make this command work properly or an explanation on how this works. The .sqf TWR_fnc_ProtesterInit = { _Protesters = allUnits select {_x getVariable ["TWR_fnc_ProtesterAnim", false]}; //Random Animations for loop #define __RandomAnimation (["UnaErcVelitelProslov4", "c7a_bravo_dovadeni1", "shaftoe_c0briefing_otazky_loop6", "c7a_bravo_dovadeni3"] call BIS_fnc_selectRandom); //grab all usable civilian classes, needed to randomize loadout in the forEach loop _rndCivClasses = ("getNumber (_x >> 'side') isEqualTo 3 AND configName _x isKindOf 'Man' AND getNumber (_x >> 'scope') >= 2" configClasses (configFile >> "CfgVehicles")) apply {configName _x}; { _dir = getDir _x; //get and set random loadout _rndLoadout = getUnitLoadout selectRandom _rndCivClasses; _x setUnitLoadout _rndLoadout; _x switchMove "";//to skip weapon holster animation after weapon removal _x doWatch (_x getRelPos [50,_dir]);//reset watch direction after group change // AI prevented to move or change behavior. _x disableAI "ALL"; _x stop true; _x setBehaviour "CARELESS"; //Disable Animation and Set AI direction to South. sleep 0.1; _dirToFace = [_x, player] call BIS_fnc_dirTo; _x disableAI "ANIM"; _x setFormDir _dirToFace; _x setDir _dirToFace; //AI animation is selected randomly and started _x switchMove __RandomAnimation; //AI animation is looped and randomly changed _animLoop = _x addEventHandler ["AnimDone", { _x = _this select 0; _x switchMove __RandomAnimation; }]; _x setVariable [ "animLoop", _animLoop, true ]; //Protest Chant //playSound ["fx_protest1", 30] remoteExec ["say3D", 0]; }forEach _Protesters; }; TWR_fnc_ProtesterRelease = { _Protesters = allUnits select {_x getVariable ["TWR_fnc_ProtesterAnim", false]}; { //Stop animation _animLoop = _x getVariable "animLoop"; _x removeEventHandler ["AnimDone",_animLoop]; //Release AI from current state _x enableAI "ALL"; _x stop false; _x switchMove ""; }forEach _Protesters; }; true; The first function seems to work well with no noted issues yet. The second function (Release Function) not so much, well it seems to release the AI it appears they go back to the animation loop after a few seconds. I am thinking it is in the Stop Animation lines, but having some difficulty figuring out how to ensure this will indeed stop the loop because the variable is in the first function. //Stop animation _animLoop = _x getVariable "animLoop"; _x removeEventHandler ["AnimDone",_animLoop]; Grumpy Old Mans Script AI Init this setVariable ["GOM_fnc_potentialArmedProtester",true,true]; Init.sqf _attack = player addEventHandler ["FiredNear", { player remoteExec [[10] spawn GOM_fnc_armedProtestersAttack];//starts the attack with amount of attackers as param, defaults to 5 if no number is given player removeEventHandler ["FiredNear", _thisEventHandler]; }]; without the remoteExec portion this works well thank you GOM. Otherwise it is the same as above with regards to scripting error. GOM's .sqf No changes and works flawlessly. Thank you again. So that is were this at and welcome any suggestions, comments or guidance... Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thank You... I am away with work for a couple days so will switch it over when I get home. When you say it should work fine in SP is that a typo or do I need to script different for MP? Anyway thank you again everyone, I am enjoying the learning process and will post my results when I get home mid week. Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Again thanks and I think I have this working the way I envisioned it. With regards to the Undefined variable, I have no clue... Was trying some recommended fixes, got the point of where I was forgetting what was tried and changed, Restarted Arma with a fresh copy of the sqf. and it went away. Don't know what to think about that. To have the Protesters attack when fired near I put this in the init.sqf and it works //inits the protesters sqf _init = [] execVM "scripts\GOM\GOM_fnc_armedProtesters.sqf";//this initializes all functions within the .sqf file waitUntil {scriptDone _init}; _initProtesters = [] spawn GOM_fnc_armedProtestersInit; _attack = player addEventHandler ["FiredNear", {[10] spawn GOM_fnc_armedProtestersAttack; }]; changing GOM's From This _attack = [] spawn { sleep 60;//delay or condition for the attack to happen [10] spawn GOM_fnc_armedProtestersAttack;//starts the attack with amount of attackers as param, defaults to 5 if no number is given }; To This _attack = player addEventHandler ["FiredNear", {[10] spawn GOM_fnc_armedProtestersAttack; }]; It seems to work, but was wondering if there was a better or preferred method when it comes to initiating this or is this method going to create issues later. Thanks Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Wow... Thank You that is exactly what I was looking for (in my mind), though I would of never of thought of it. The randomization of everything is nothing short of awesome. Your demo mission worked flawlessly, of course, when placed into my mission I am getting a Undefined variable in expression _x Which has me a bit confused as I have not changed anything, but will sort it out. As this scenario is triggered by a player firing their weapon, would it be more efficient to have the addEventHandler in the init.sqf or the armedProtester,sqf? or create a trigger? Anyway, thanks you all and will post results as I sort them out. Cheers, Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thank you AZCoder... I was on my way to bed when it seemed we posted at the same time. The animation loop works and looks good. I have modified the script a bit and seems that I have one last hurdle to overcome, which tomorrow is a new day. the script now seems to work to this point. //Make Civilians Enemy if ((handgunWeapon _civ) isEqualTo true) then { [_civ] joinSilent createGroup sideEnemy; _civ addRating -10000; _civ allowFleeing 0; _civ setSkill ["courage", 1]; _civ reveal [player, 3.75]; _civ setBehaviour "COMBAT"; _civ setCombatMode "RED"; }; }]; I just started manipulating this, but am out of gas. The plan (now, after reading posts and gathering ideas) is to have any armed civilians become rogue and attack both Blufor and Civilians when the EH is triggered. The plan for the mission would be they players will have to eliminate the rogue mob while keeping civilian casualties to a minimum. throw in a couple suicide bombers and things could get interesting. Again thank you for the assistance and next time I am in Washington State I owe you a beer or six. The latest full version of the script #define __RandomAnimation (["UnaErcVelitelProslov4", "c7a_bravo_dovadeni1", "shaftoe_c0briefing_otazky_loop6", "c7a_bravo_dovadeni3"] call BIS_fnc_selectRandom); { _civ = _x; _civ setBehaviour "CARELESS"; // AI prevented to move or change behavior. _civ disableAI "PATH"; _civ disableAI "MOVE"; _civ stop true; //Disable Animation and Set AI direction to South. sleep 0.1; _dirToFace = [_civ, player] call BIS_fnc_dirTo; _civ disableAI "ANIM"; _civ setFormDir _dirToFace; _civ setDir _dirToFace; //AI animation is selected randomly and started _civ switchMove __RandomAnimation; //AI animation is looped and randomly changed _animLoop = _civ addEventHandler ["AnimDone", { _civ = _this select 0; _civ switchMove __RandomAnimation; }]; _civ setVariable [ "animLoop", _animLoop, true ]; //Protest Chant [ProtesterA_1, ["fx_protest1", 30, 1]] remoteExec ["say3D", 0]; // Combat Mode, Randomly selects weapons for Civilians _civ addEventHandler ["FiredNear", { _civ = _this select 0; //Stop animation _animLoop = _civ getVariable "animLoop"; _civ removeEventHandler ["AnimDone",_animLoop]; //Release AI from current state _civ enableAI "ALL"; _civ stop false; _civ switchMove ""; //Randomize and add weapons _weapon = selectRandom ["hgun_ACPC2_F", "", "hgun_P07_F", "hgun_P07_F", "", "hgun_Rook40_F"]; _mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines")); _civ addMagazine _mag; _civ addWeapon _weapon; //Make Civilians Enemy if ((handgunWeapon _civ) isEqualTo true) then { [_civ] joinSilent createGroup sideEnemy; _civ addRating -10000; _civ allowFleeing 0; _civ setSkill ["courage", 1]; _civ reveal [player, 3.75]; _civ setBehaviour "COMBAT"; _civ setCombatMode "RED"; }; }]; } forEach [ProtesterA_1, ProtesterA_2, ProtesterA_3, ProtesterA_4, ProtesterA_5]; Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
So I messed with this a bit more this evening and still no luck... My latest attempt will be to create a unit, which I am struggling a bit wrapping it around my head. _x addEventHandler ["FiredNear", { _civ = _this select 0; //Determine which civilians are armed _weapon = selectRandom ["hgun_ACPC2_F", "hgun_P07_F", "hgun_P07_F", "", "hgun_Rook40_F"]; _mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines")); _civ addMagazine _mag; _civ addWeapon _weapon; //Release AI from Animation _civ enableAI "ALL"; _civ stop false; _civ switchMove ""; //Make Enemy and Set Combat Mode if ((handgunWeapon _civ) isEqualTo "") then { [_civ] joinSilent createGroup sideEnemy; _unit allowFleeing 0; _unit setSkill ["courage", 1]; _unit reveal ["SoldierW", 3.75]; _unit addRating -10000; _unit setBehaviour "COMBAT"; _unit setCombatMode "RED"; //_group setFriend [west, 0]; //_group setFriend [civilian, 0]; }; }]; I really don't know if I am over thinking this or putting to much emphasis on _civ, but tomorrow is another day. Comments and suggestions welcome Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Again thanks to you all for your advice and input... I have been trying different ways of accomplishing this and I know its my knowledge of scripting, also reading forums I think I have managed to confuse myself a bit, so with that said I am going to take a break for a few hours, maybe a nap and attend my step grandsons ball game and hopefully re-approach this with a fresh look later this afternoon. So where I am at... The above spoiler works with all the Protesters facing south and performing a random animation. //AI animation is looped and randomly changed animLoop = _x addEventHandler ["AnimDone", { _x switchMove _animation }]; _x setVariable [ "animLoop", animLoop, true ]; Although I havent worked on this portion for awhile now, it will not loop or change animations. I intend to look at if "disableAI" is effecting the "AnimDone" EH or hopefully find out why this wont initiate. //Protest Chant [ProtesterA_1, ["fx_protest1", 30, 1]] remoteExec ["say3D", 0]; Works Great! and appears when the "FiredNear" EH is triggered and the AI change their state it stop automatically. //Determine which civilians are armed civGunChance = 0.5; //Odds Civilian will be armed civGuns = ["hgun_ACPC2_F","hgun_P07_F","hgun_P07_F","hgun_Rook40_F"]; if (random 1 < civGunChance) then { _gun = selectRandom civGuns; _mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _gun >> "magazines")); _x addMagazine _mag; _x addItemToUniform _gun; }; Reading the post XianGrim created for his script, I liked the idea where this lead to. It makes sense from a "Realism" standpoint that the Protesters would be armed prior (Agitators) to the trigger and the randomness that you dont know how many armed civilians you are actally going to be faced with when the event actually happens. Also the handgun approach makes more sense than a RPG suddenly appearing on the AI's back. I hope and assume the script is right, although I have not seen the protester draw a handgun as of yet. _x addEventHandler ["FiredNear", { _civ = _this select 0; _civ enableAI "ALL"; _civ stop false; _civ switchMove ""; if ((handgunWeapon _civ) isEqualTo "") then { [_civ] joinSilent createGroup sideEnemy; _group allowFleeing 0; _group setSkill ["courage", 1]; _group reveal ["SoldierW", 3.75]; _group addRating -10000; _group setBehaviour "COMBAT"; _group setCombatMode "RED"; _group setFriend [west, 0]; _group setFriend [civilian, 0]; }; }]; This is where I am falling down and need to read and understand how the Event Handler process works, more importantly the procedure to make civilians become hostile and attack when triggered. I am not sure if this is the right approach, but seems to at least be a feasable approach, I think. Again thanks and comments welcome Cheers Greg Full script to date: -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thank you to you all... Unfortunately life got in the way last night so haven't had a lot of time to play with this. Will get back at after work today and see if I can achieve success. A couple questions though... in the forEach statement I currently have 25 "Protesters, is that to many should I cut it down and create smaller? I am just asking because it seems that when the "FiredNear" EH is triggered not all the AI respond, or is it just because the script isn't right yet. the other question is when creating a group do you have to create a unit to join the group ? Thanks again and hopefully will post some positive results tonight. Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks AZCoder, hopefully I can figure out a trick, lol Been playing around with this and while I would love to embarrass the kids with my happy dance, it will have to wait, but have shown a bit of promise that this can be done. The following is not working properly but shows promise in the sense a Civilian AI attacked me. // Combat Mode, Randomly selects weapons for Civilians _x addEventHandler ["FiredNear", { //Make enemy _x addRating -10000; _x setFriend [West, 0]; _x setFriend [civilian, 0]; //Change AI state _civ = _this select 0; _civ enableAI "ALL"; _civ stop false; _civ switchMove ""; //Give AI weapon randomly switch (round(random 5)) do { case 0: { _civ addMagazines ["16Rnd_9x21_Mag", 5]; _civ addWeapon "hgun_Rook40_F"; }; case 1: { }; case 2: { _civ addMagazines ["11Rnd_45ACP_Mag", 5]; _civ addWeapon "hgun_Pistol_heavy_01_F"; }; case 3: { _civ addMagazines ["30Rnd_762x39_Mag_F", 5]; _civ addWeapon "arifle_AKM_F"; }; case 4: { _civ addMagazines ["RPG7_F", 3]; _civ addWeapon "launch_RPG7_F"; }; }; //Set combat mode. _civ setBehaviour "COMBAT"; _civ setCombatMode "RED"; //_SideHQ = createCenter EAST; //_group = creatGroup EAST; //{[_civ] joinSilent _group;} forEach _civ addon _group; }]; Current issues in this section: Not all civilians are "breaking out" of the animation mode. Some civilians still reacting like civilians and not going into combat mode Only ProtesterA (the first in the forEach string) changes and reacts Weapon randomization may not be working as ProtesterA when killed dumps a mini arsenal and appears other given weapons may have multiple. I am sure there are other issues but in the end I had one Protester shoot at me. Thanks again and really open to any suggestions or ideas from anyone. Cheers Greg Full Code to date: -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thank you very much of both of you... The sound play flawlessly and yes the intent is to have this a MP mission so thanks for the advice on how to make the sound MP friendly. I do have to look into stopping the sound when the "FiredNear" or "Explosion" EH is triggered though. Yes, I am using IndeedPete's Arma2 Cutscenes mod. The animations I selected work fine in this: _animation = ["UnaErcVelitelProslov4", "c7a_bravo_dovadeni1", "shaftoe_c0briefing_otazky_loop6", "c7a_bravo_dovadeni3"] call BIS_fnc_selectRandom; _x switchMove _animation; The problem I am having is I wanted to have the animations play in a loop with the "Protester" switching the animation when the current one is completed. The problem is in the loop function or is it because I am using Arma 2 animations: //AI animation is looped and randomly changed animLoop = _x addEventHandler ["AnimDone", { _x switchMove _animation }]; _x setVariable [ "animLoop", animLoop, true ]; Worked a bit more on the Combat state of the protesters. The plan is to have either a suicide bomber or Blufor soldier (firing a weapon or Explosion) trigger a "Riot" where the protester become armed and engage all units in the area (military or civilian). // Combat Mode, Randomly selects weapons for Civilians _x addEventHandler ["FiredNear", { _civ = _this select 0; _civ enableAI "ALL"; _civ stop false; _civ setBehaviour "COMBAT"; _civ switchMove ""; switch (round(random 5)) do { case 0: { _civ addMagazines ["16Rnd_9x21_Mag", 5]; _civ addWeapon "hgun_Rook40_F"; }; case 1: { }; case 2: { _civ addMagazines ["11Rnd_45ACP_Mag", 5]; _civ addWeapon "hgun_Pistol_heavy_01_F"; }; case 3: { _civ addMagazines ["30Rnd_762x39_Mag_F", 5]; _civ addWeapon "arifle_AKM_F"; }; case 4: { _civ addMagazines ["RPG7_F", 3]; _civ addWeapon "launch_RPG7_F"; }; }; _civ setCombatMode "RED"; _civilianUnit setFriend [West, 0]; _civilianUnit setFriend [East, 0]; _civilianUnit setFriend [civilian, 0]; }]; I created a "Random" switch manly because well the protesters need ammunition and that seemed a simple approach. In the current configuration, which definitly need more R&D on my part I am finding that: Protesters seem to not engage and continue with the expected civilian behavior. Weapons appear to be random but don't seem to attaching to the protester (eg. The weapon will appear for some one to be erect while the protester is prone or cowering state) I am thinking this is because they are not changing their state. I am also at this point handgun are holstered on the protester as I have not seen one yet. Civilians wont engage and seem not to be in an unfriendly state and continue to act like civilians. I am assuming that I will have to attempt to use the "joinSilent" approach. Again this is much a work in progress, but am happy with the results thus far. Thanks again and welcome any comments, advice or ideas. Cheers Greg Full Script to date: -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well I like to say it has been a weekend well wasted, kidding I have learned a bit about scripting. Thank you very much AZCoder. I still cannot get the AI animation to loop and change animations, nor get the sound to play, but have learned what various commands do and more importantly not do. I have started the Combat Mode for the Ai and while it is really a work in progress it appears that it may just work when I get it sorted out. Here is what I accomplished so far, please remember the Combat Mode was just started and am still sorting it through. { // AI prevented to move or change behaviour. _x disableAI "PATH"; _x disableAI "MOVE"; _x stop true; _x setBehaviour "CARELESS"; //Disable Animination and Set AI direction to South. sleep 0.1; _x disableAI "ANIM"; _x setFormDir 180; _x setDir 180; //AI animation is selected randomly and started _animation = ["UnaErcVelitelProslov4", "c7a_bravo_dovadeni1", "shaftoe_c0briefing_otazky_loop6", "c7a_bravo_dovadeni3"] call BIS_fnc_selectRandom; _x switchMove _animation; //AI animation is looped and randomly changed animLoop = _x addEventHandler ["AnimDone", { _x switchMove _animation }]; _x setVariable [ "animLoop", animLoop, true ]; //Protest Chant playSound "protest1"; // Combat Mode, Randomly selects weapons for Civilians _x addEventHandler ["FiredNear", { _x enableAI "ALL"; _x stop false; _x setBehaviour "COMBAT"; _x call BIS_fnc_ambientAnim__terminate; _arm = [ "hgun_Rook40_F", "hgun_P07_F", "arifle_AKM_F", "launch_RPG7_F"] call BIS_fnc_selectRandom; [_x, _arm, 8] call BIS_fnc_addWeapon; _x setCombatMode "RED"; }]; } forEach [ProtesterA, ProtesterA_1, ProtesterA_2, ProtesterA_3, ProtesterA_4, ProtesterA_5, ProtesterA_6, ProtesterA_7, ProtesterA_8, ProtesterA_9, ProtesterA_10, ProtesterA_11, ProtesterA_12, ProtesterA_13, ProtesterA_14, ProtesterA_15, ProtesterA_16, ProtesterA_17, ProtesterA_18, ProtesterA_19, ProtesterA_20, ProtesterA_21, ProtesterA_22, ProtesterA_23, ProtesterA_24]; Again any suggestions, hints, tips and tricks greatly appreciated. Unfortunately, my weekend is over and will have to get back to reality and time will be limited to work on this for a few days. Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I have been playing with these for a few hours now, and it is beyond me why it appears to work in one test, partially works in another and wont do anything at all. I have been trying various versions of the following trying to follow the forum posts { doStop _x; _x disableAI "PATH"; _x setDir 180; sleep 0.1; _animation = ["zevl2_c0start", "c7a_bravo_dovadeni1", "zevl7_c0start", "c7a_bravo_dovadeni3"] call BIS_fnc_selectRandom; _x switchMove _animation; waitUntil{animationState _x != _animation}; playSound "protest1"; } forEach [ProtesterA, ProtesterA_1, ProtesterA_2, ProtesterA_3, ProtesterA_4, ProtesterA_5, ProtesterA_6, ProtesterA_7, ProtesterA_8, ProtesterA_9, ProtesterA_10, ProtesterA_11, ProtesterA_12, ProtesterA_13, ProtesterA_14, ProtesterA_15, ProtesterA_16, ProtesterA_17, ProtesterA_18, ProtesterA_19, ProtesterA_20, ProtesterA_21, ProtesterA_22, ProtesterA_23, ProtesterA_24]; and { doStop _x; _x disableAI "PATH"; _x setDir 180; sleep 0.1; _animation = ["zevl2_c0start", "c7a_bravo_dovadeni1", "zevl7_c0start", "c7a_bravo_dovadeni3"] call BIS_fnc_selectRandom; _x switchMove _animation; animLoop = _x addEventHandler ["AnimDone", { _x switchMove "_animation" }]; _x setVariable [ "animLoop", animLoop ]; playSound "protest1"; } forEach [ProtesterA, ProtesterA_1, ProtesterA_2, ProtesterA_3, ProtesterA_4, ProtesterA_5, ProtesterA_6, ProtesterA_7, ProtesterA_8, ProtesterA_9, ProtesterA_10, ProtesterA_11, ProtesterA_12, ProtesterA_13, ProtesterA_14, ProtesterA_15, ProtesterA_16, ProtesterA_17, ProtesterA_18, ProtesterA_19, ProtesterA_20, ProtesterA_21, ProtesterA_22, ProtesterA_23, ProtesterA_24]; Depending on what configuration dictates on how the AI react, obviously, but seems to very erronious and sometimes unwxpected results. Anyone have any ideas, examples or advise. Am I even on the right track with this? Anyway thanks in advance. Cheers Greg -
Scripting a Group of Protesting Civilians
swift39 replied to swift39's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thank You AZCoder. I have this portion working, after finding that some animations well... Just don't work! { doStop _x; _x disableAI "PATH"; _x setDir 180; sleep 0.1; _animation = ["zevl2_c0start", "c7a_bravo_dovadeni1", "zevl7_c0start", "c7a_bravo_dovadeni3"] call BIS_fnc_selectRandom; _x switchMove _animation; playSound "protest1"; } forEach [ProtesterA, ProtesterA_1, ProtesterA_2, ProtesterA_3, ProtesterA_4, ProtesterA_5, ProtesterA_6, ProtesterA_7, ProtesterA_8, ProtesterA_9, ProtesterA_10, ProtesterA_11, ProtesterA_12, ProtesterA_13, ProtesterA_14, ProtesterA_15, ProtesterA_16, ProtesterA_17, ProtesterA_18, ProtesterA_19, ProtesterA_20, ProtesterA_21, ProtesterA_22, ProtesterA_23, ProtesterA_24]; Messing around with a loop function from the forums and not having much luck as of yet. I have been testing the animDone EH and the waitUntil script, nether seems to function yet ( I will post when I get some results other than script errors or breaking the script as I am sure I am doing something wrong there, also cannot get the custom sound file to play. What I would like to have happen is when a protester animation is completed it again randomly picks another one and continues the cycle until an event happens to stop it (gun shot or explosion) then the civilians will be armed (randomly?) and the scenario will continue. I am confident I have the sound structure set up correctly in the description.ext and the sound files are in .ogg format. class CfgSounds { sounds[] = {protest1, protest2}; class protest1 { // how the sound is referred to in the editor (e.g. trigger effects) name = "protest1"; // filename, volume, pitch, distance sound[] = {"\Sound\fx_protest1.ogg", 50, 1, 100}; // subtitle delay in seconds, subtitle text titles[] = {}; }; class protest2 { // how the sound is referred to in the editor (e.g. trigger effects) name = "protest2"; // filename, volume, pitch, distance sound[] = {"\Sound\fx_protest2.ogg", 50, 1, 100}; // subtitle delay in seconds, subtitle text titles[] = {}; }; }; Again any advice,. hints or tricks appreciated. Cheers Greg -
Issues on Dedicated Server (Briefing and add-ons not working)
swift39 posted a topic in ARMA 3 - TROUBLESHOOTING
First of all I should say that I am new to Arma3 and the scripting and inner workings, so please be patient... Friends, Co-workers and myself have decided to get together and play Arma3 which lead to creating a "dedicated" server. The Server seems to be working fine with only one issue noticed, that in the Arma3 Shortcut the target path seems to drop the "-filepatching" on a regular basis which messes up the Zue_A3serverbriefing that is being used. The main issue is I created some Zues missions that could be used to create on the fly Missions with the Ayres-Achilles mod. Which for the most part works as expected, with currently two frustrating issues that I have two weekends and countless hours during the week trying to resolve. Problem #1 The ability to "save" in game issue came up and given the level of experience with some of our guys I decided to test and use Henrik Hansen's Zues ObjectEditor V.1.0. which works fine in Eden Editor testing on the MP platform. Problem #2 The briefing does not display, again worked in the testing. As I said both worked well testing through the Editor, but once placed onto the server, neither work properly. The Briefing does not display at all! and the Zues_ObjectEditor wont copy to clipboard, but seems to read the objectGrabber ".sqf" files. The following is the .sqf files that I am using to achieve this... init.sqf initServer.sqf initBriefing.sqf Description.ext I created the initServer.sqf to deal with multiple instance issues in both the briefing and objectEditor when in the init.sqf file. I don't understand why it would work in testing and not on the dedicated server. Also I should note that when the objecteditor was in the init.sqf it worked, but when started would put multiple objects on the server which would create mass explosions. Any assistance or advice would be greatly appreciated and thank you in advance for any responses. Thank You Greg *** UPDATE *** Ok made some progress tonight. I created a initPlayerLocal.sqf and placed the objecteditor commands in it. initPlayerLocal.sqf Again it works fine in editor, and at least now works partially when placed on the server. It now allows it to complete once. When you attempt to do it again the server indicates that the process completed but when you paste into the file it pastes the last copy and not the updated one. I have the trigger set to repeatable, but doesn't appear to make a difference. Suggestions welcomed. Thanks Greg- 2 replies
-
- briefing
- zues objecteditor v.1.0
- (and 3 more)