Jump to content

mrcurry

Member
  • Content Count

    641
  • Joined

  • Last visited

  • Medals

Everything posted by mrcurry

  1. How about BIS_fnc_setPitchBank? Just call setDir first then the function.
  2. I'm sorry but I'm not sure I understand what you want to do. You can rotate an object by changing it's heading under transformation in attributes. If you want your object to be perpendicular to another object just add or subtract 90 from the other object's heading.
  3. Welcome to the forums @FDZ. Your issue is that _doColors is a boolean (true/false) and == does not compare booleans. However you're in luck since if expects a boolean anyway so just do: if (_doColors) then { stuff } Or if your variable can contain two or more data types use isEqualTo instead. Also for the future turn on -showScriptErrors and check your log file for these kinds of errors. Sometimes the game can actually tell you what you did wrong. ;) If you haven't found the log file yet look in %Appdata%\local\Arma 3.
  4. @Tankbuster I decided to make a list of descriptions for 270-ish of the buildings and variants in vanilla 'cause it'll be nice to have in the future. If you're interested here they are in all their non-exhaustive glory plus a getter function. The list is limited to children of House_F who also have at least one defined buildingPos because that's all I had time for today. Adding/editing classes is trivial though.
  5. Yeah, an 8 digit grid ref would be nice. The problem is teaching the player about it in a neat and non-intrusive way. I've found that it works excellently for some players while others have a harder time grasping the concept so it can be a bit of a hit-and-miss depending on your target audience. @Tankbuster Here's a couple of ways I'd consider doing it: 1. Grid, Name and Delayed HUD - You give the player the 6-digit grid of the building and the descriptive name. Once the player is looking through binocular at the right position wait say 30 seconds or so and then start drawing a 3D icon over the building. This method is not too intrusive but will help the player along if it takes too long. The hard part would be balancing the delay for best feel. 2. Extended descriptions and nearby references - Write up a lookup-table for all building classes you are interested in and store in it extended descriptions of the building classes such as "2-story building with a balcony, white walls and a red tiled roof". Give the player the 6-digit grid and the extended description of the building and that of some neighboring buildings (or if no other structures nearby just say so). Your task to the player could then turn out to be something like: "Destroy the single-story building with a red-tiled roof and blue doors inside grid 056112. It's next to a two-story blue painted building and a ruined garage.". You could extend the search to also find things like trees and rock-formations and the like if you want to get fancy. Despite the extra work my own preference would be towards option 2 since there's no artificial HUD at all and the task becomes a bit more involved.
  6. To get the number of satchel charges the group has in total, use: numCharges = 0; { numCharges = numCharges + ( {_x == "SatchelCharge_Remote_Mag"} count magazines _x ); } forEach units g04; numCharges >= 2 Putting the above code in the trigger's condition field should work as long as there is a group called g04. Never drink and code... unless you can hit the Ballmer Peak.
  7. I'm pretty sure I mentioned this but it's no trouble. :) Rereading my own instructions I'd say slap the code provided above in your init.sqf inside your mission folder and you should be good. If you do not have your init.sqf then one will not be provided for you, you must create said init.sqf yourself inside your mission folder. If you are unaware how to create a text-file and change it's extension then only The Google can help you. If you are unaware how to google then may whatever diety you choose to worship have mercy on your soul. P.s. Jokes aside, it should be pretty straightforward but let me know if you run into any trouble. ^^
  8. mrcurry

    Fun with Mortar Projectiles

    No I never did, in my version playSound3D is executed only once on the server just above the impact. The sound itself does most of the work infact. My use case is more for cinematic effect so the shells are just spawned some 100m off the ground with an incoming velocity vector and Here's a sound sample, I got 3-4 of these with slight variation and randomize the selection: https://www.dropbox.com/s/e7rjvoo7o4dyyp5/mortar1.ogg?dl=0
  9. mrcurry

    Fun with Mortar Projectiles

    What I've done in my version of a "virtual" mortar is extract the sound from another source and save it as a separat file. The shell is created on a single machine (the server in my case) and the sound is broadcasted from server to clients using playSound3D. Quite effectful. I'll see about posting the snippet and sound later.
  10. mrcurry

    Points system

    Considering that the default system does not separate player kills from AI kills the choice seems pretty clear. If you want to track pvp kills separately you have to build your own system. Edit: It struck me that you could use the default system for AI kills and separate player kills into it's GUI thing. The idea seemed intriguing at first but it could get messy. Still recommend writing your own thing.
  11. I have noticed a similar behaviour on my missions at times, not consistently though. It always works if I reapply "InitializePlayer" to all clients after the mission has started. The problem seldom arises so sofar I've been getting away with just using the debug console to fix it. If you want to automate it I would: 1. Make sure you execute InitializePlayer after player is properly initialized. 2. If that's not enough: Setup a spawn and in it use sleep or waitUntil to delay until after mission start, then you execute InitializePlayer if !("IsInitialized" call BIS_fnc_dynamicGroups).
  12. Is the rifle an MX UGL? Cause that's the only one that can use that particular magazine. addMagazine is a good start for adding magazines.
  13. You could also ask the server at regular intervals, sacrifices a bit of network but an interval of 5 s ( or so ) shouldn't be too bad. It might get nasty with large numbers of clients though. Pseudocode: remoteExec to server. Server gets remoteExecClient and position and remoteExec back. It would probably be better to have the server broadcast the data, like @computer said.
  14. Right here's the axis-angle rotation function: In short it rotates a vector around an axis by a the given angle, here's a picture that might help with visualisation. In your case the axis of rotation would be the same as the z-axis, for which the unit vector is [0,0,1].The angle given is read counterclockwise so to "go left" you add and "go right" you subtract. Examples:
  15. Default behaviour of the popup target is to go back up when shot. They will only stay down when animated to do so by script. Since you only animate them down again if the player missed they will stay up if hit. Change (for all targets of course): if (pt1_50 animationPhase "terc" != 0) then { _count = _count + 1; } else { pt1_50 animate["terc", 1]; }; _inc = _inc +1; To: if (pt1_150 animationPhase "terc" != 0) then { _count = _count + 1; }; pt1_150 animate["terc", 1]; _inc = _inc +1 You may also have an issue with timing. You are sleeping for 4 and 6 seconds after the targets have gone up. Since you are doing the targets in the same sequence every time it's likely that your player will learn the sequence and take down the targets so quickly that they popup back up before your sleeps are done. Since those hits wouldn't count the unintended consequence is that the player is punished for being too good. I recommend using eventhandlers instead. Bit trickier but done right will be more reliable. Check out this post I've made, specifically the addEventHandler parts.
  16. Well I'd say that it's probably has to do with your getVariables. _target getVariable ['ACE_isUnconscious', true] means the target will be considered as unconscious when ACE_isUnconscious isn't initialized yet, which I assume it isn't until they've actually been downed once. Change true to false.
  17. If you are using Zeus to remote control the unit you are controlling us still an AI even when you as Zeus are controlling it. Therefore any action defined to only be usable by players should not be available.
  18. 1. Not sure 2. weaponDirection returns a vector [x,y,z] not direction in degrees. setVectorDir expects the same. To rotate the vector around an axis like you say you must use some fancier math called Axis-angle rotations (also known as Rodrigues rotation). I got a function for it on my desktop. I'll post back when I'm off work. It might just be easier to tell the drone gunner to watch certain positions with the doWatch command. 3. The loop will keep running as long as the condition returns true, so yes. If you set it up to create a new cam each time then you'd have to check for when the dialog is closed and then do some cleanup. The camera can exist on its own so it is possible to create and use the same camera over and over again.
  19. mrcurry

    Ear and holster script

    They are passed by the eventhandler into the code automatically. For the keyDown event the following parameters are passed to the code in the magic variable _this: _this select 0 : Keycode - The key's keyboard code or DIK code. Essentially the digital representation for the key you pressed. _this select 1 : Shift - State of the shift button as a boolean (true/false). Holding shift while pressing a key will make this return true. _this select 2 : Ctrl - Same as Shift but for Ctrl button. _this select 3 : Alt - Same as Shift but for Alt button. To extract these I use the params command which parses _this into localized variables ready for use. params ["_key", "_shift", "_ctrl", "_alt"]; which is the same as private _key = _this select 0; private _shift = _this select 1; private _ctrl = _this select 2; private _alt = _this select 3; A more extended example: findDisplay 46 displayAddEventHandler [ "KeyDown", { params ["_keyCode", "_shift", "_ctrl", "_alt"]; If(keyname _keyCode == "y") then { //Y is pressed and doesn't care about shift ctrl and alt states. }; If(_shift && keyname _keyCode == "i") then { //Shift + I }; If(!_alt && keyname _keyCode == "o") then { //O is pressed and Alt is not }; If(ctrl && _shift && keyname _keyCode == "p") then { //Ctrl + Shift + P }; If(!ctrl && !_shift && !_alt && keyname _keyCode == "p") then { //P is pressed and none of ctrl shift and alt are pressed. }; } ];
  20. mrcurry

    Ear and holster script

    findDisplay 46 displayAddEventHandler [ "KeyDown", { params ["_keyCode", "_shift"]; //Add another if for each key you want recognised. If(_shift && keyname _keyCode == "o") then { //Do stuff }; } ];
  21. remoteExec works with all pre-compiled functions directly, no need to spawn. Just do: _yourArguments remoteExec ["BIS_fnc_typeText2"]; This way the code to be executed isn't transmitted over the network, only the argument is, saving on valuable network traffic. We can get away with this since the all BIS functions are already compiled on each machine at mission start.
  22. mrcurry

    Firing range help

    It is not necessarily as simple as it seems. Check out my reply on this thread: It got all the source available and if you got any questions just let me know. Edit: I re-read your post. A simple way would be to use the fact that the animation changes when the target is hit, animationPhase is your command for that. To lower your targets you can use animateSource. Remember to lower your target manually after it been hit otherwise it will pop back up.
  23. mrcurry

    Help Creating a While Loop

    Cheers, good spot! Fixed it.
  24. mrcurry

    Help Creating a While Loop

    As @stanhope said it should work out of the box, no changes required. As for the explanation, read on. Bare with me but this is gonna involve math... and I will most likely underrate your knowledge level, but that's on me. Here's the quick pseudo code for the function: Define minimum and maximum brightness and desired duration for the fade effect Get current time and assign it to startTime. Get current time and add duration, assign it to stopTime. Assume B(x) is a brightness function. while current time < stopTime do set brightness as B(current time) Define variables This is pretty self-explanatory but I'll explain it anyway. We need to know how bright the light should be before we start, so maxValue. We also need the desired brightness after the fade is complete, so minValue. We need to know how long it should take, so duration. We need the time we should start which is right away, so startTime = current time. We need the time to stop which is in duration time, so stopTime = startTime + duration. Assume B(x) is a brightness function The magic lies in the linearConversion command (I'll link it at the end of this post). We assume that the brightness of the light is a function of time, specifically a linear function since we want the light to fade out at a steady rate. I'm calling that function B(x). On our imagined line we have two points: P with the coordinates (startTime,maxValue) and Q with the coordinates (stopTime,minValue). These points P and Q give us the line function B(x). Once we got the function we can input our current time into the B(x) and get a value of brightness corresponding to our current time. (The above three lines is what the linearConversion command does. I recommend you learn to use it, there are countless applications for it.) We input the brightness value into the light and we repeat this step each frame until we've reached the point Q a.k.a. current time >= stopTime. while do I've chosen to use waitUntil instead since it fires only once per frame, any faster than this would be unnecessary, saving a little bit on performance. You could replace the waitUntil with a while do loop if you so desired, a while do could run more often then each frame though which we don't need in our case. Hope that helps. BIKI Link: https://community.bistudio.com/wiki/linearConversion
×