Arma 3 Editor Theory - Conditions, If (...) Then {...}

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • Code examples: pasted.co/6698f0db
    Alternative link for the code: www.pastery.ne...
    A few notes here, I have stopped using pastebin because they don't allow me to create unlisted pages anymore unless I pay them money. The pasted dot co should be pretty much the same service, but allow me to use their services for longer period of time.
    There may be a bit less videos in the near future (until new year or so). I'm not sure yet, just don't get angry at me if I miss a week or two in releasing a video.
    As you may have noticed, the intro and outro songs have been changing for the last few weeks. I'm not very happy with the used music anymore and eventually will alter the music to something else. I'd like to make a new intro sequence that'd be shorter (about 2 seconds) and find new music. Until then, I'll be putting the old clips at faster speed with random copyright-free music.
    "This video is created using games from Bohemia Interactive.
    See www.bistudio.com for more information."

Комментарии • 40

  • @Pvt.Conscriptovich
    @Pvt.Conscriptovich 8 месяцев назад

    Man I miss this Arma 3 Intro .

  • @Alpinegremlin
    @Alpinegremlin 6 лет назад

    Hey again Feur! I have been steadily chugging away at my blizzard/freezing script (now with MP functionality!) and I believe that I have some good stuff here. It works pretty much as desired. It is composed of 3 main scripts:
    stormgeneration.sqf-- responsible for blizzard intervals and calling most other core scripts in the mission
    freezing.sqf-- responsible for player health bleed
    fn_enterablebuildings.sqf-- determines player "safe zones"
    I am pleased with the results so far but there are some things that I would like to fine tune:
    1) Players cannot regain health lost during the blizzard when the blizzard is not in effect.
    2) Sometimes if a player is already inside of a building at the time the blizzard hits, they will temporarily take damage which is immediately healed. This is likely due to a momentary condition overlap where the script needs to loop to consider the player "safe".
    If you are bored, perhaps you could take a look at my code? I am wondering if this could be written any better to make for a more seamless script. Cheers as always!
    Here is the code: www.pastery.net/eaebda+qavnac+qzgnmg/#eaebda

    • @Feuerex
      @Feuerex  6 лет назад

      1) I don't know how to feel about the way you check whether the player is inside a building or not. I'd throw in a few Hint or SystemChat commands, to see what the command lineIntersectsWith returns - I have a suspicion it might be the player object itself. Also, currently it only checks for the first building in that list, and likely won't do anything for other buildings. You will need to go through the list by using the command 'in'.
      2) In freezing.sqf, you are running a loop that checks whether you are in a house, then sleeps, and then applies damage. This means that I can be outside, the script goes to sleep, within this 1 second I get inside, and still get damaged. Apply the damage first, then sleep, to get a better response.
      Sorry for the delayed response. I'm very busy with other things in life and didn't get to my PC during the week.

    • @Alpinegremlin
      @Alpinegremlin 6 лет назад

      Don`t worry! Thank you for the response!
      1) Would you happen to have any other suggestions for a building check? It seems to work well enough but I`m always looking for a better way to do something. Using the distance command that I was trying out didnt seem to make much sense since different buildings are different sizes so the distance from center will vary. Some areas of the building would not be considered safe. And yeah it only copy/pasted the first couple lines so you didnt have to read a wall of code. All other buildings in the array are also checked for in the full script.
      2) Thank you for the tip here! Should make for a smoother transition. I`m still getting used to placing sleep commands in the best locations within the code.

    • @Feuerex
      @Feuerex  6 лет назад

      don't get me wrong, the idea to use lineIntersects is a pretty solid one. I just wonder if the command serves its purpose in your script. It is a bit quirky, and some of the problems you described may be caused by the game evaluating player's position incorrectly. I'd consider using the optional parameters, namely the third one - objIgnore - to ignore the player's model when checking for any intersecting objects. It can happen that the object itself is interfering with the line that is being drawn from it, and in your script, where you are comparing the intersecting object with different buildings, this could lead to player never being able to heal or properly "enter a building".
      This is untested, which is why I suggested to use a few Hints and SystemChats to see what exact values are inside the scripts when the player is supposed to enter a building, or get healed.
      I've been also thinking of using a variable instead of dealing direct damage - slowly increase and decrease the value, and apply damage only at certain thresholds. Getting inside a building would then quickly reduce this value to 0 (or the nearest previous threshold value), allowing the player to go outside again. That way the blizzard wouldn't be so brutal (getting killed in 40 secs is insane, but having: more stamina drain > shaking hands > slower movement > direct damage : would still affect players without outright killing them), but it would still punish people by dealing permanent damage (a severe frostbite doesn't go away when you get warmer, the damage has already been done, but you can regain stamina if you haven't been out for too long) , and you could easily shift the "difficulty" by setting the threshold for a serious damage to different values. It would also prevent players from abusing the system to heal combat wounds by getting indoors for a while - after all, a bullet and a scripted snowstorm work with the same damage system.
      However, these changes may require a complete overhaul of the whole system. But I'm looking at this from a different angle, and most importantly - it's not my script, so I don't need to care about things not working as intended. So take this as just me thinking out loud, it's not really even a suggestion.

    • @Alpinegremlin
      @Alpinegremlin 6 лет назад

      No I appreciate your willingness to give me ideas and help me out. You`ve definitely given me some more solid ideas to bounce around with. Cheers!

  • @wallyarcales7350
    @wallyarcales7350 3 года назад

    I saw a recommendation to view your videos and learn scripting from Bohemia Forums. Excellent video tutorials!

  • @DJSeverance
    @DJSeverance 8 лет назад

    Awesome stuff! Please keep them coming, maybe some lessons on get/set Variable?

  • @imsquidwert5221
    @imsquidwert5221 Год назад

    How do you add else statements? Because what I want to happen is for: if (isPlayer c1D (the variable name)) then (doNothing) else (Teleport and Velocity command here.)

    • @Feuerex
      @Feuerex  Год назад

      it's pretty much exactly like what you described, but with different brackets.
      if (my condition) then
      {
      //do something
      } else
      {
      //do something else
      };
      See the code examples, very last example, for another if-then-else scenario. Although in this case you describe, you don't even need to use it. If player equals some variable, then do nothing, else do something. Well, how about - if player doesn't equal some variable, do something. And you don't even need the "do nothing" part, because it doesn't accomplish anything. It's up to you, but it's another option!
      You can flip a condition by adding a NOT, or a ! at the start.
      if (alive player) would check if player is alive. If I want to instead check whether player isn't alive, I'd write: if (NOT (alive player)), or, shorter, if (! (alive player)). You can once again check code examples in the vid description.

    • @imsquidwert5221
      @imsquidwert5221 Год назад

      @@Feuerex Thank you, I didn't know about being able to place NOT in front of it.

  • @Alpinegremlin
    @Alpinegremlin 7 лет назад

    So I`ve been gradually expanding the script that you`ve helped me with a little while ago. Taking the distance script, I am expanding it to differentiate between different buildings the player may enter. I am trying to combine both an array and if()then{}; structure.
    while {alive player} do {
    _enterableBuildings = ["Land_Mil_ControlTower", "Land_A_Office01", "Land_A_Office02", "Land_A_Office02_dam", "Land_A_Pub_01", "Land_HouseB_Tenement", "Land_Ind_Vysypka", "Land_Mil_Barracks_i", "Land_Mil_House", "Land_Farm_Cowshed_a", "Land_Farm_Cowshed_a_dam", "Land_Farm_Cowshed_b", "Land_Farm_Cowshed_b_dam", "Land_Farm_Cowshed_c", "Land_Farm_Cowshed_c_dam", "Land_Barn_W_01", "Land_Barn_W_01_dam", "Land_Barn_W_02", "Land_A_Hospital", "Land_A_Hospital_dam", "Land_HouseV2_02_Interier", "Land_HouseV2_02_Interier_dam", "Land_HouseV2_04_interier", "Land_HouseV2_04_interier_dam", "Land_A_BuildingWIP", "Land_Hangar_2", "Land_Ss_hangar", "WarfareBAirport", "Land_A_GeneralStore_01a", "Land_A_GeneralStore_01a_dam", "Land_A_GeneralStore_01", "Land_A_GeneralStore_01_dam", "Land_Church_03", "Land_Church_03_dam", "Land_a_stationhouse"];
    _playerPos = position player;
    if (_playerPos distance nearestBuilding player < 10) && (typeOf nearestBuilding player == _enterableBuildings select 4) then {
    systemChat format ["%1 is inside a pub", name player];
    };
    sleep 5;
    };
    I get the following error: "Error then: type bool, expected if". I am confused here. Did I not give it proper syntax? That is usually my most frequent issue. Any help would be appreciated! Cheers!

    • @Feuerex
      @Feuerex  7 лет назад

      yeah, seems like a syntax error to me. It's always if ( ) then { }. You need to encapsulate all conditions into one big condition that gets evaluated at the end. You always need to end up with a single TRUE or FALSE at the end. So first you evaluate the part about player being close enough to a building, then you check the building type with your array, take both the results and do a logical AND, and the resulting value is sent as a result of the IF condition check.
      It can also be useful to further divide the code using more parenthesis, so that the game doesn't mix up the logical order.
      if (((_playerPos distance nearestBuilding player) < 10) && ((typeOf nearestBuilding player) == (_enterableBuildings select 4))) then {
      systemChat format ["%1 is inside a pub", name player];
      };
      I'm curious about how you want to continue with this. Please do keep me updated on this, looks like a very interesting script. If you don't want to share these publicly, then you can always find me on steam.

    • @Alpinegremlin
      @Alpinegremlin 7 лет назад

      I`m sure I may need your help when I get to the next step in the script`s evolution haha. At that point its purpose will make perfect sense :P I would be happy to share where I am going with all of this!

  • @User3rror
    @User3rror 5 лет назад

    I'm most interested in the 'then' part. How do you execute multiples lines of code off of one set of conditions? What's the proper structure for these guys: () {} [] ?

    • @Feuerex
      @Feuerex  5 лет назад

      see 0:55
      if (condition1 && condition2 && etc) then {command1;command2;command3;etc};

  • @BGLENN-dp4tx
    @BGLENN-dp4tx 3 года назад

    Terrific!!

  • @reggaeman007jah
    @reggaeman007jah 6 лет назад

    Keep up the great work mate!! :)

  • @kratasgr
    @kratasgr 8 лет назад

    nice i wach all your videos and use alot from them tnx

  • @mightymulliganLIVE
    @mightymulliganLIVE 8 лет назад

    I am working with the MYK Snow Script. I just need help to remove the text box that shows the intensity of the snow as a set value. It is really annoying to see. Is there possibly a command line that I should hunt for to remove it?

    • @Feuerex
      @Feuerex  8 лет назад

      Um, I think you may have accidentaly commented under a wrong video. This video is about conditions in scripts. Perhaps you were looking for help somewhere else?

    • @mightymulliganLIVE
      @mightymulliganLIVE 8 лет назад

      Your right. But still, anyway you can help?

    • @Feuerex
      @Feuerex  8 лет назад

      Unfortunately, I can't help very effectively, I have no idea what the script contains. I'd advice you to contact the author if you have some issues or questions about their work. Generally, commands like Hint, SystemChat or TitleText can all display texts, but these don't need to be in scripts at all, there are many ways to display info on screen.

    • @mightymulliganLIVE
      @mightymulliganLIVE 8 лет назад

      +Feuerex Borsche, that is too bad. Appreciate the feedback though.

  • @chasamo3328
    @chasamo3328 8 лет назад

    Very helpful video. Thank you
    What command you used to make text in chat? 9:07

    • @Feuerex
      @Feuerex  8 лет назад

      I used systemChat to display the value of the custom variable, and set it to repeat every second, so that the value gets updated once the trigger changes its value. And because I'm lazy and didn't want to create a script for it, I put it inside another trigger.
      dem = [] spawn {while {true} do {sleep 1; systemChat str (TaskOneCompleted);}};

    • @chasamo3328
      @chasamo3328 8 лет назад

      +Feuerex thx

  • @nicolamarizza1521
    @nicolamarizza1521 8 лет назад

    Can you make me an example of how I should use this with "KnowsAbout" command?

    • @Feuerex
      @Feuerex  8 лет назад

      Sure thing.
      if (mySoldier knowsAbout player == 0) then {
      hint "The knowsAbout value of mySoldier detecting player is 0.";
      };
      You know what, I'll give you two examples. Here you go.
      _value = mySoldier knowsAbout player;
      if (_value > 1) then {
      hint format ["The value of KnowsAbout for mySoldier is : %1, and guaranteed to be higher than 1", _value];
      };

    • @nicolamarizza1521
      @nicolamarizza1521 8 лет назад

      +Feuerex got it! thank you

    • @azynkron
      @azynkron 7 лет назад

      Even better:
      while {true} do
      {
      Hint Format["Current detection: %1, myEnemy knowsAbout myGuy];
      sleep 1; //update once per second
      };
      Then you will get a continuous update about how much the enemy knows about you.

  • @AlokKumar-ex8dk
    @AlokKumar-ex8dk 8 лет назад

    how to activate a trigger only if player is present in side the area in single player mission

    • @Feuerex
      @Feuerex  8 лет назад +1

      Right click the trigger and set Player as the trigger owner.

    • @AlokKumar-ex8dk
      @AlokKumar-ex8dk 8 лет назад

      thanks it was helpful

  • @natotruppalphanta9783
    @natotruppalphanta9783 8 лет назад

    thx feuerex, is there more new stuff coming soon? :)

    • @Feuerex
      @Feuerex  8 лет назад

      +NATO Trupp Alpha [ NTA ] Hopefully. I'm trying to slowly get back into the swing of things, I'd say one or two more weeks.

    • @natotruppalphanta9783
      @natotruppalphanta9783 8 лет назад

      Cool, thx for doing that mate! Great work!

  • @dampiir8910
    @dampiir8910 6 лет назад

    Can you please teach us how to make and use functions?

    • @Feuerex
      @Feuerex  6 лет назад

      sounds doable. Can't promise anything though, free time is kinda valuable to me now, and tutorials take a LOT of it.

  • @nautilusaa
    @nautilusaa 8 лет назад

    Ty for this video !