Jump to content

John Douglas

Member
  • Content Count

    15
  • Joined

  • Last visited

  • Medals

Community Reputation

2 Neutral

About John Douglas

  • Rank
    Private First Class

Profile Information

  • Interests
    ArmA2

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm interested in writing a script to have AI soldiers deeploy a MG for ArmA2 OA + ACE add ons. I've labelled two of the three RU soldiers "KORD_Gunner" & "KORD_Tripod". The third soldier being the ammo bearer, and for sake of this exercise have Not considered as relevant in script . I've moved my original post from there to here, of which I've based my code from killzone_kid, substituting in my relevant unit names. Having checked and tested the class names, I am aware of the flowing: - KORD_Tripod carries the "ACE_6T7TripodProxy". - KORD_Gunner carries the "ACE_KORDProxy" as tested in the code below. KORD_Tripod action ["dropWeapon", KORD_Tripod, "ACE_6T7TripodProxy"]; KORD_Gunner action ["dropWeapon", KORD_Gunner, "ACE_KORDProxy"]; KORD_Gunner addEventHandler ["WeaponAssembled", { _this select 0 action ["GetInGunner", _this select 1]; }]; _base = unitBackpack KORD_Tripod; // "ACE_6T7TripodProxy"; // _base = unitBackpack KORD_Tripod; KORD_Tripod action ["PutBag"]; KORD_Gunner action ["Assemble", _base]; At the understanding that the addEventHandler is executed after tripod assembly and appears to use 'target data' supplied from "_this select 0" and "_this select 1" statements, possibly from an 'addaction' command. I've omitted this for testing purposes. Having just attempted a manual assembly of the tripod, I've concentrated on just achieving the tripod assembly using: _base = "ACE_6T7TripodProxy"; // and have also tried_base = unitBackpack KORD_Tripod; KORD_Tripod action ["Assemble", _base]; . . . . . With no success.
  2. Apologies: I have moved this topic to ArmA2 Scripts: Hi, Based on killzone_kids code above, I've attempted to script a version compatible for ArmA2 ACE, however script isn't assembling weapon? My code posted below: I've checked class names for tripods using the LoadOutEditor "LEA", and having tested a similar script to "davidoss" above above using the drop weapon command. ACE doesn't like action "PutBag" command, as backpacks/racks are classed as weapons as I understand it. KORD_Tripod action ["dropWeapon", KORD_Tripod, "ACE_6T7TripodProxy"]; KORD_Gunner action ["dropWeapon", KORD_Gunner, "ACE_KORDProxy"]; KORD_Gunner addEventHandler ["WeaponAssembled", { _this select 0 action ["GetInGunner", _this select 1]; }]; _base = "ACE_6T7TripodProxy"; // was: _base = unitBackpack KORD_Tripod; KORD_Tripod action ["dropWeapon", KORD_Tripod, "ACE_6T7TripodProxy"]; // was: KORD_Tripod action ["PutBag"]; KORD_Gunner action ["Assemble", _base];
  3. Hi, While I'm moving forward with my scripting skills, it's two steps forward and one back. Now I think I need to know how and where I can access the "weapons load" out for "class names", and in particular for example "US_Soldier_B_EP1". Is there a short script I can use, or should I start researching accessing pbo files as detailed here: http://www.armaholic.com/forums.php?m=posts&q=31345 Thanks in advance.
  4. Below are links to discussion for a work around solution using "gen_action.sqf" script. Hope this helps! https://forums.bohemia.net/forums/topic/94751-addaction-simplified/ https://epochmod.com/forum/topic/12901-addaction-without-external-script/
  5. This is just awesome . . . . Thanks guys with your persistence, and thanks to demonized for what I'm finding as an interesting piece of code to study and use. Apologies for the initial confusion. Of course it worked off the bat and I couldn't stop playing into the early hours, hence the late response with enthusiasm. Better than Xmas morning for me gentleman.....lol And now I'm off to explore . . . .more code too, that is!
  6. Thanks Maff and MrH, Because I found the ref to the original code in Arma3 I continued the discussion there. . . .But I'm using Arma2. So maybe I should have used a new post. Sorry. I can re-post there if you like Dedmen?
  7. Thanks guys ! Lot to chew over but slowly getting there.
  8. Thank you, And here's one of my solutions as such. Just add "Marker1" to your map ! _null = this spawn { Hunt_players_fnc = { _player = ""; { if (isPlayer _x AND alive _x) then {_player = _x}; } foreach (playableUnits + switchAbleUnits); _Rad = (200 + (floor(random 250))); _wp = _this addWaypoint [getPos _player, (_Rad)]; _wp setWaypointStatements ["true", "_null = (group this) spawn Hunt_players_fnc;"]; _wp setWaypointType "SAD"; _wp setWaypointCombatMode "RED"; _wp setWaypointSpeed "FULL"; _wpSAD = getWpPos(_wp); "Marker1" setmarkerpos (_wpSAD); hint format ["Player Position: %1\nS&D _WP: %2", getpos(_player),_wpSAD]; sleep 3; }; _null = (group _this) spawn Hunt_players_fnc; }; However, I am now trying to format this to an sqf file i.e. "HuntPlayersFunction.sqf" file, and execute from the players Initialization box using: null = [this] execVM "HuntPlayersFunction.sqf"; If someone helps me with this I promise to go away to my box for a week . . . LOL Thanks in advance
  9. YES !!!! We have a Eureka moment !!!!! Persistence pays off . . . .LOL Unless I modify the initialization box to: null=this spawn . . . . I keep getting the error "Type Script, expected Nothing" I also deleted my original init.sqf file and retyped in case it was corrupted ! Maybe ! null=this spawn { waituntil { !(isnil "PlayerPosition") }; [_this] spawn PlayerPosition; }; So how do I turn this into my own function ????
  10. I get this Error when I paste your original code from the 6th post into the initialization box. But I'm more than willing to attempt as a function call if this is going to be more efficient. Thanks.
  11. Thanks for elaborating with coded example, and I get your point that execVM is shorter. Currently receive error "Type Script, expected Nothing" So added to the first line . . . Null = this spawn . . . .and shouldn't the 3rd line also read "PlayerPosition.sqf" in quotations?? null = this spawn { waituntil { !(isnil "PlayerPosition.sqf") }; [_this] spawn PlayerPosition; }; I think I can follow the logic of the code when it's published in front of me , but coming up with that ! Yikes ! Apart from trouble shooting with the use of the flowchart and working out what;s initiaised, and what hasn't been. There's No obvious errors to read from, and No clues ?? Where to start ??? I keep reviewing Murrays guide to check if I have missed anything obvious, but I might have to start reverse engineering some mission code too. Thanks in advance again.
  12. Thanks gx8, I did brief past the flow / sequence charts , but obviously didn't apply. So, I can see my character's position stored in the mission.sqm file. So with what variable do I bring forth to make sure this is initialized?
  13. Hi gc8, I am executing both "execVM" and "spawn" commands from the Unit editor Initialization box. Using "execVM" works successfully, but I have No success with "spawn" command. I am also scripting with "Arma Edit". I am under the impression that my "PlayerPosition.sqf" script should work successfully under both methods of execution, and I am compiling my spawn scripts with the use of the init.sqf I understand the use of both local and global variables, but lack experience and most probably overlooking something fundamental. I have also stripped back all my add-ons to just Arma2 OA to simplify and maybe avoid conflicts. Thanks.
  14. Why is it I can successfully execute the following script in the Editor Initialization, using: Executed form the Editor Initialization using execVM (success!): _myProcedureHandle = [this] execVM "PlayerPosition.sqf"; Executed form the Editor Initialization using spawn and init compile(No success!!): init.sqf: PlayerPosition = compile preprocessfile "PlayerPosition.sqf"; Editor Initialization: _myProcedureHandle = [this] spawn PlayerPosition; And so Nothing executes using the spawn command having per-compiled with init.sqf: Script: "PlayerPosition.sqf" // File: "PlayerPosition.sqf" // Executes with - _myProcedureHandle = [this] execVM "PlayerPosition.sqf"; // _myProcedureHandle = [this] spawn PlayerPosition; _player = _this select 0; while {alive _player} do { hint format ["Player Position: %1", getpos(_player)]; sleep 1; }; I've downloaded, completed and studied examples from both Mr-Murray and Taurusv32 excellent guides, and still can't spawn the "PlayerPosition.sqf" script, where as execVM works every time ??
  15. Note from Moderator: Messages moved from here I am trying to get this Arma 3 script working in Arma 2. This topic has been an excellent source while providing a fun script to play, modify and explore. I am now attempting to place "Marker1" on the map to display the calculated position of "wp",previously local variable, and during testing I have also attempted to confirm these co-ords on the screen with the hint format command. I have butchered the code a little with the use of global variables and I'm using in Arma2. _null = this spawn { PublicVariable"PlayerVictum" ; PublicVariable"wp" ; Hunt_players_fnc = { PlayerVictum = ""; { if (isPlayer _x AND alive _x) then {PlayerVictum = _x}; } foreach (playableUnits + switchAbleUnits); wp = _this addWaypoint [getPos PlayerVictum, (100 + (floor(random 200)))]; wp setWaypointStatements ["true", "_null = (group this) spawn Hunt_players_fnc;"]; wp setWaypointType "SAD"; wp setWaypointCombatMode "RED"; wp setWaypointSpeed "FULL"; }; _null = (group _this) spawn Hunt_players_fnc; while {alive player} do { "Marker1" setmarkerpos (getpos wp); hint format ["%1", position wp]; sleep 3; } };
×