Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Posts posted by MajorModz

  1. If I made a part of the script "useless" and it still works, am I safe in assuming that it was already "useless", and that I have done exactly this

    If you find a way to do it with less code please tell me.

    Excuse my stupidity, but what's with all the underscores. Is this more MP Mode jargon that can be done without?

    I'm not knocking the script, it works and I'm impressed.

  2. Wow, thats odd because the script as presented, implemented as you described did not work for me. In fact the line you wanted me to put in the Trigger On Act field could not even be placed without returning "Missing ]" error.

    Anyhow, "your script" that I re-did works perfectly.....exactly as you expected. I am using it as posted above.....while I type this.

    So again, Thanks.

  3. Ok. So right away I'm wondering,

    // Make a trigger, give him a name
    Do you mean name the trigger or name the unit already known as "player"? If I go by your exact words, then I have a named trigger that can't be activated but has a condition, and on-act values? Thus a trigger that never runs the script because it's never active. Assuming I opt to activate the trigger in some manner, what would be your recommended method. By "side" or "grouped" to player; activation "vehicle"?

    You are wanting me to rename items in these array to suit my specifications, except for "_i"?

    // nul=[unit, name of trigger, "Music", tracktime, fadetime]

    private ["_unit","_musicarea","_trigger","_mymusic","_fadetime","_tracktime","_i"]

    If I rename these to my specs then the next problems are here.

    _mymusic = _this select 2;

    This would point to the 3rd item in the array with the value "_trigger"?

    _tracktime = _this select 3;

    this would point to the 4th item in the array with the value "_mymusic"?

    I don't know enough about code to point out any further errors (should they exist). And I'm instictively aginst adding extra sound/music files to the folder. It has been my experience that simply starting a new "playmusic" command with nothing between the quotation marks serves the same purpose. Using the command in this manner gives no errors, and it self terminates immediately.

    I'm very grateful for any time you've spent chewing on this issue. But a chunk of code this size to play some looping music seems absurd.

    I might also mention again at this point, that this is a SP mission made in A2Free. So any extra code you may be using for other modes is only leading to the onset of your carpal tunnel syndrome. Thanks Wig for trying thus far.

    Peek again at my previous post. I know the syntax is way off, but the logic is there. I just need to figure out how to get the script to check once per second to see if the trigger has been deactivated/false, and then to terminate. I'm not so much worried about the fades and such. Those can be manipulated in the trigger on act and deact's prior to and subsequent of the script.

    It's freaking me out that a simple [0 + 1 per second repeat on (condition, "track length"), terminate script on (condition, "false")] block of code is impossible to write?

    Perhaps you guys that have become accustomed to working on "Ferrari's" have forgotten how to work on the "lawnmower"? Maybe the artist who needs only to sketch an "apple", but instead paints a picture of an entire "fruit basket"?

    ---------- Post added at 12:56 AM ---------- Previous post was Yesterday at 11:59 PM ----------

    Yes bro, you got it (with some minor corrections).

    I will attempt to put it up.....

    Trigger name: "music"

    Trigger activated by: "grouped, vehicle", "once"

    Condition: "none"

    Trigger On Act.: nul = [player, music, "score", 144, 4] execVM "MusicLoop_Trigger.sqf";

    // MusicLoop_Trigger.sqf
    // by Wiggum
    private ["player","music","score","144","4","_i"];
    _unit = _this select 0;
    _trigger = _this select 1;
    _mymusic = _this select 2;
    _tracktime = _this select 3;
    _fadetime = _this select 4;
    _musicarea = list _trigger;
    0 fadeMusic 1;
    _i = 0;
    scopeName "main";
    while {true} do {
    scopeName "Play";
    while {true} do {
    if ((_unit in _musicarea) && (_i < (_tracktime - _fadetime))) then {
    if (_i == 0) then {
    playmusic _mymusic;
    _fadetime fadeMusic 1;
    sleep 1;
    _i = _i + 1;
    if (((_unit in _musicarea) && (_i == (_tracktime - _fadetime))) || !(_unit in _musicarea)) then {breakTo "Play"};
    // If unit is inside the trigger area and the music track is nearly over or if he is out of the area then fade out and terminate the music
    _i = 0;
    _fadetime fadeMusic 0;
    sleep _fadetime;
    playmusic "";
    // Wait until unit is inside the trigger area again or loop if he is still inside
    waitUntil {_unit in _musicarea};

    I removed the first line of code....dont know why?

    I removed a value from the array.

    Re-arranged the array and list #'s.

    Changed the first fademusic from 0,0 to 0,1

    And used playmusic "";...............works just like I said.

    Though I dont understand how to format the syntax of the code, I do understand the funtion. The Basic I learned messing about on old Texas Intruments, Commodore, and Apple computers way back in they day helps.....Yikes, did I just date myself ?

    Yeh, I owned an Atari 2600 the 1st year they came out. I musta been around 13 years old. The Commodore Vic20 was my first computer. Plus I worked on the first gen Apples in highschool. I was playing Wizardry on a IBM PC Portable that weighed 50 lbs and sported a monochrome screen before you were even born most likely.

    The reason I was so adamant about proper loop funtion is, I plan on composing custom music tracks and sounds for my missions. I have a vintage Ensoniq ASR-10 sampling keyboard. If you know what that is, you should be jealous hehe.

    Cheers Mate, You Rock !

    Oh, I suppose somebody should Sticky his code (modified appropriately of course). It will actually play music without jacking it up!

  4. Here is what I'm trying to do.

    Trigger on act: music = true; nul = [] execvm "music1.sqf";

    Trigger on deact: music = false;


    scopename "start";

    while {true} do {playmusic "score"};

    a = 1;

    scopename "loop";

    if (false) then {terminate music1};

    a + 1;

    b = a;

    sleep 1;

    if (b > 144) then {breakto "start"} else {breakto "loop"};

    This script should play the music and then check every second to see if the trigger has been deactivated, at which time it will terminate the script. After 143 seconds it should play the music again and repeat the proccess until the trigger has been deactivated/false.

    I understand the the code but don't know how to structure it. Can anybody type this out in proper form please. Thank you.

  5. @ twirly,

    I've actually done something like that. Playmusic ""; with no file name starts a new instance, and I believe terminates the 1st....and since there's no file name it terminates immediately.

    Reading through some of the older threads I saw a lot of folks complaining about multiple instances of "playmusic" running simultaniously when they didn't get the code syntax correct. But it would seem only one instance of "playmusic" is allowed in the later versions Arma 2? I haven't had any reason to try running more then one instance of "playmusic" so I'm not sure about this.

    My issue is having the trigger deactivated and then re-activated before the sleep timer in the loop has cycled. Which causes the next instance of "playmusic" to cut short the audio by an amount of time equal to how long the activating unit was outside the trigger area. Assuming the activating unit was outside the trigger area for less time then remained in the sleep line. This would not be an issue if I could simply "terminate" the script from the trigger de-act.

    Again let me state that this is pure asthetics. Having the music cut-out even once is undesirable.

    I've even tried various "if", "then", "else" combinations from the trigger and within the playmusic.sqf......with no satisfactory results.

    @ Loyalguard,

    An interesting read, but you must remember that in the "code pool" I'm the guy in the shallow end with the floaties on his arms! Most of this stuff looks like Chinese to me. One look at my Avatar should say it all.....that's me trying to decipher a block of code!

    Arma 2 Free is my first experience with a BIS product. It and this community will be major factors in my descision to purchase future BIS products. It's like test driving a new car. No matter how much I like the vehicle, if I can't even turn on the radio then chances are I'm not gonna buy it.

    Thanks guys for the input.

  6. you want to loop the music...mhh thats a bigger problem then

    Yeh, looked like a fastball....turned out to be a slider!

    Just talking pure asthetics here. But then isn't that what it's really all about?

    The joy I experienced from learning how easy it was to loop sound/music lasted approximately 1 minute and 46 seconds. Followed by two days of hair pulling and cursing. Crunching code while I sleep is exhausting....*sigh*

    Perhaps I should just stick to my favorite motto's

    1: If at first you don't succeed, give up and move on to something else.

    2: Aim for the ditch, it's hard to miss.

    Interesting to have commands like "playmusic" and "playsound" without the corresponding opposites "stopmusic" and "stopsound". A fademusic command executed on a running sound loop using sleep does not stop the player, you just can't hear it anymore haha.

    Pure logic

    Place a repeatable trigger.

    Trigger on act:

    music = true;

    [] execvm musicloop.sqf; // standard while true playmusic sleep

    Trigger on deact:

    music = false;

    terminate musicloop;

    I guess that's just to damn logical?

    Apparently you can't terminate a script that is sleeping? Even from outside the script?


    Take a look at this script, maybe it works for you:


    I've seen that, but I got scared and ran away. I think I used the words "easy" and "simple" in my first post.

    I'm not looking for new issues, I already have one!

  7. I have areas where I want looping theme music, easy right ?

    I can either hard code a trigger to do the work, or I can execute an external script from within the trigger.

    Player enters trigger area, music fades in, music plays, music loops as expected, music fades on exiting trigger area.

    Problem: Player exiting the trigger area and returning before the sleep timer is complete causes the next playback (or loops if the player bounced in and out of the trigger area more then once) to be cut short by the duration the player was outside the trigger area. Looping then returns to normal.

    I've tried assigning a value to the sleep timer, then resetting it when the player leaves the trigger area. I've tried to terminate script; both from the trigger de act and from within the external script itself (if I use external scripting).

    I'm looking for a simple way to start and stop the looping so that every time the player enters or re-enters the area, the trigger and script are fresh. You'd think that calling to terminate an executed external script would do the trick, but nope.

    Seems odd that in my searching of "loop music" I have never seen anyone note this issue.


    Nero WaveEditor is a very nice tool for creating your sound files. It allows direct manipulation of the sample ie. pitch / stretch / effects, etc. and saves files to .ogg!

  8. If I place the player unit and a few random units with the above in their init field I don't have any problems with them raising the binoculars.

    They do not "raise the binoculars" in preview mode. Shift-Click Preview or run the Mission as SP and I betcha they will display the behavior I describe.

    edit: Tested and re-tested. Player raises binoc's in Shift-Click Preview, SP, and MP modes. Playable Units only display the behavior if selected as Player in MP mode.

  9. I have a mission where the player and 2 playable Units are to be spawned without weapons. Each Unit is given only binoculars.

    When the mission starts or I switch to one of the playable Units for the 1st time, each will immediately raise the binoc's. This is undesirable.

    Player and playable Units have this Initialization ( removeallweapons this; this addweapon "binocular"; ) minus the brackets.

    I only want the binoc's to be placed into inventory. Is there another way to add the binoculars to these Units, or a simple way to keep them from being used automatically at mission start or switch?

  10. Just put yourself on the map with a subordinate in the group, hit the spacebar and move the pointer to the building in question. The interface will draw lines to each position as you move the pointer near it, giving the position # and location.....CAKE. If your using some kind of randomizer, the script should have the ability to generate a position randomly from only the positions you desire.

  11. Perhaps I should have given the topic a more unique title like "A2Free 3D Editor?", my bad.

    Yes, the keyboard combo to open the 3D editor has always been [Alt E] from the main menu.

    As far as I know the camera works the same as your controls for player/vehicle movement....like a helicopter.

    My situation is this, A2Free is my 1st experience with BI software. However it is not my 1st when it comes to editors. I'm just more attuned to working in a 3D enviornment.

    The question is simply, does A2Free support the "built in" 3D editing mode?

    The answer may or may not be a simple yes or no. Example: Yes it does support 3D editing, but the feature has been disabled. It may be re-enabled by placing "this" in the player profile config.

    If the answer is simply no, then I will be forced to script or use 3rd party software. Which is a stretch considering A2Free is free.

    In all reality the 3D mode is the least of my concerns when it comes to the editor. In the few days that I've toyed with the standard editor some complications arose in what seemed to be very uncomplicated patrol routes.

    Example: Island Utes, Unit Vodnik loads Group Infantry Section at the Airfield then moves to Strelka. There the Vodnik unloads the Infantry Section which does a quick sweep while the Vodnik repositions to meet them. The Infantry Section is loaded and the Vodnik moves Kamenyy where the routine is repeated. The Vodnik returns to the Airfield transporting the Infantry Section. The patrol is then looped with a cycle waypoint. It performs this patrol route endlessly with a hitch.....that is until my Independent Guerilla Player takes out the Infantry Section during their sweep, and then the Vodnik just sits there forever waiting to load Infantry that never show up.

    I've tried practically every combination of waypoints, syncronizations, triggers, and timers to make the Vodnik continue the patrol route even if the Infantry don't show at the respective waypoints. I have expiramented with this scenario having the AI units Grouped and Ungrouped in various manners (Infantry Section Leader high rank, Vodnik Unit high rank). Any AI remaining after an encounter that sense "clear" need to continue the patrol route.

    Is what I'm asking of the AI possible using only standard functions of the editor without scripting ?

    In my play testing I have noted that AI (stragglers) tend to high-tail it back towards the Airfield after an encounter that goes badly for them. Morale loss in the lower ranking Units ?

  12. Alt "E" only takes me into the standard editor.

    So the answer to your ? = yes.

    Arma 2: Free redefines the free-to-play battlefield with its truly unrivalled scale and gameplay possibilities. A2Free serves up almost everything offered by the original Arma 2 - the '13th best PC game of all time', according to PC Gamer - minus the campaign, HD graphics and support for user-made addons and mods.

    Where does it state the 3D editor is not included? More then likely it's simply disabled.