Feint 137 Posted January 7, 2012 Does anyone know how to get a player to place a satchel via a script rather than through the GUI? This works for AI: unitname Fire ["pipebombmuzzle", "pipebombmuzzle", "pipebomb"]; but it doesn't work for the player. Also, if you CAN get a player to place a satchel via a command or script, is it possible to get the name of that satchel somehow? Basically I want to be able to place a satchel without performing any player animations and I want to then be able to attachTo that satchel to the player so the player can move a placed satchel easily. Any ideas? I'm kind of stuck. Share this post Link to post Share on other sites
das attorney 858 Posted January 7, 2012 (edited) Okay. I can't help you with part 1 yet (player fires pipebomb) but I can for part 2 (attachTo player). You need to put an eventHandler on the player: player addEventHandler ["fired", {_this execVM "satch.sqf"}]; Then paste this into satch.sqf: private ["_unit", "_muzz", "_projectile"]; _unit = _this select 0; _muzz = _this select 2; _projectile = _this select 6; if (_muzz != "PipeBombMuzzle") exitWith {}; _unit sideChat format["%1",_projectile]; sleep 2; _projectile attachTo [_unit, [0,2,1]]; You'll need to play about with the attachTo point to get the effect you desire :) If you can't get it to work I'll upload a test mission. EDIT: The attachTo part probably be better if you define the players neck as the attach point, like: _projectile attachTo [_unit, [0,0.4,-0.2], "neck"]; (Edited for better syntax) Edited January 7, 2012 by Das Attorney Share this post Link to post Share on other sites
Feint 137 Posted January 7, 2012 (edited) Thanks for this. It works differently depending on how close to land the player is located and whether the player is above water or not. If too close to land, the attachTo doesn't work and the satchel just ends up on the ground. Out on the open water, the attachTo works great when swimming on the surface and I wrote an action script to detach it and that works. This isn't really a problem for me since I only really care how the satchels behave on the water. Since land actions are normal, that's fine. The main problem is that the player won't fire when submerged under water. So the action of placing a charge won't complete. I'm guessing it's the same vanilla condition of not allowing players to fire their weapons when the weapons are submerged; same thing happens with rifles and pistols. I tried a workaround a few months ago with creating a second player with satchels and having that AI place the satchel and touch it off and set the time and stuff. But I had problems with that and it seemed like a clunky workaround. UPDATE: OK, so the best workaround so far is to create an AI, name him ralph, make him unable to be killed, make sure he has the same number of satchels as the player at all times, add an action to the player to fire ralph's satchel weapon, attachTo ralph's placed satchel to the player, add an action to the player to release the satchel once it's in place, add an action to the player to allow the detonation of all of ralph's placed satchels. It works very well no matter where you are, land or sea! The things above in red are what I DO NOT know how to do. Anyone know how to do these things? I feel like I'm soooo close. Maybe I don't need to keep the inventory the same. Maybe I can just add a check that if I have a satchel left, I'll add a satchel to ralph's inventory. If I'm out of satchels, then I can't proceed with placing a satchel. Hmmmmmmmmm. So I know how to get all of the magazines the player currently has in inventory, but how do I count JUST the satchels? Edited January 8, 2012 by Feint Share this post Link to post Share on other sites
das attorney 858 Posted January 7, 2012 (edited) private ["_unit","_count_mags"]; _unit = player; _count_mags = 0; { if (_x == "PipeBomb") then { _count_mags = _count_mags + 1; }; sleep 0.05; } forEach magazines _unit; _unit sideChat format["%1",_count_mags]; This will return how many Satchel Charges the player has in his inventory. Let me know how you get on :) EDIT: I've fixed the code. Sorry it was broke when initially posted! Edited January 8, 2012 by Das Attorney Share this post Link to post Share on other sites
Feint 137 Posted January 8, 2012 (edited) You're a god-send. Thanks man. Checking now. EDIT: Works perfect. Thanks again! I'm using it to see if the number of satchels in the player's inventory is more than 0. If so, I add a satchel to an AI who then fires it, it's attached to the player who can put it wherever he or she wants, then the player can detach it, then execute an action that makes the AI detonate it. That way, you can go to an ammobox, get more satchels and lay more. Questions: Why do you put the sleep 0.05 in there? Just to give the script time to work? Does that make it more reliable? Edited January 8, 2012 by Feint Share this post Link to post Share on other sites
das attorney 858 Posted January 8, 2012 (edited) Cool man :) To be honest, I totally forgot that the player would be in water when placing the satchel charge, so I did all the testing standing by the runway on Utes! My bad. Glad you found a workaround with "ralph" though! Good lateral thinking. :) I haven't tested the following code, but if you're also having problems creating ralph, try this: (Disclaimer: Not guaranteed to work). _side = side player; _group = createGroup _side; _typeOf = typeOf player; _dave = _group createUnit [_typeOf, getPos player, [], 0, "NONE"]; removeAllWeapons _dave; _dave disableConversation true; _dave setVariable ["BIS_noCoreConversations", true]; _group selectLeader _dave; _dave setRank "COLONEL"; _dave setBehaviour "AWARE"; _dave setCombatMode "RED"; _dave setUnitPos "UP"; _dave setCaptive true; _dave setSkill 1; _dave1 setVehicleInit "ralph = this"; processInitCommands; You could use disableCollection _dave1; as well to make him invisible, but it could be a bit dodgy as BIS were thinking of getting rid of disableCollection. Personally, I'd setPos him somewhere underground or in the sky. If you want him to be invincible, you could either use _dave allowDamage false; for SP, but if you want your mod to be used in MP, then you will need to attach an eventHandler, like: _dave addEventHandler ["HandleDamage", {false}]; Hope that helps :) Edited January 8, 2012 by Das Attorney Share this post Link to post Share on other sites
Feint 137 Posted January 8, 2012 Thanks again! I'll test it out tomorrow. Gotta give my bloodshot eyes a rest. :) Share this post Link to post Share on other sites
kremator 1065 Posted January 8, 2012 Don't stop until they bleed! Just kidding :) Share this post Link to post Share on other sites
hcpookie 3770 Posted January 8, 2012 Latest video looking awesome! A question - I was thinking about the underwater views and how to improve them. After doing some search on the Biki, I ran across this: http://community.bistudio.com/wiki/ppEffectAdjust It seems that you can alter the effects of the "wetDistortion" setting. I'm thinking using this can improve the quality of the underwater views without removing them completely. I'm thinking along the lines that if you have a mask on, your underwater views should be improved vs. swimming w/o a mask. I think this would also be useful to make the cargo views while inside the submarine look "not" flooded :) Share this post Link to post Share on other sites
Feint 137 Posted January 9, 2012 (edited) Thanks hcpoookie. I've already added some post-process effects when you are under water (some wavey effects). When you come out of the water, the pp effect fades out. It's not a huge effect, but I like it because it also confirms when I'm above water completely and the invisible pond is detached. For play testing, this is important to me. I know in real life if you have a mask on, underwater views are aren't wavey. I've just added it for personal preference for now. Normally in the game, when you go underwater, there aren't any pp effects applied to the player's view applied by the Vanilla game. As for getting rid of the blue fog underwater that BIS has put in all Arma2 water, I've tried a few things using the pp effects to counteract it, but no joy. I also had the idea of reducing brightness with depth, but I only know how to effect the player's vision, not add black fog with depth to a map which would be a better way. In other words, I could make the player's vision darker with depth, but you could just rise up to a shallow depth, look down and see the sea floor. Not very realistic at all. I do have plans to make some interesting pp effects which will be triggered if you get Nitrogen Narcosis. This is semi-realistic in that Nitrogen Narcosis causes vision problems. QUICK UPDATE: Decided to convert the BCD calibration script to sideChat and sqf format (from sqs). That took a lot longer than I anticipated because I was finding that: if (true) then { run some code; exit; }; ...would exit out of those brackets but would not seem to exit the script. Caused headaches for me until I figured that out. I'm not very good at properly coding sqf unfortunately but I'm learning. I also realized that not everyone always has a radio so I tried playing around with shownRadio, but I coudl never get a 1 or 0 value from shownRadio nor could I get !shownRadio to ever work properly, nor !(shownRadio). So I gave up on it and made the script half "hint" and half "sideChat". But getting to that point took a lot of time. For example: if shownRadio then { player sideChat "You have a Radio."; } else { hint "You do not have a radio."; }; This always displays the sideChat if you have a radio. But if you don't have a radio, it doesn't display the hint. Grrrrrrrrrrrr! Then the new RAM that I got for xmas failed and my computer was shutting down randomly which caused me to freak that something I was writing was causing Arma2 to BSOD. Nope. Just the damn RAM. So I switched back to my old RAM and had to RMA the new stuff. So not too much progress today. I still haven't worked on spawning ralph. Haha. Hopefully tomorrow after my late night photo shoot. Edited January 9, 2012 by Feint Share this post Link to post Share on other sites
raptor 6 actual 13 Posted January 9, 2012 As for getting rid of the blue fog underwater that BIS has put in all Arma2 water, I've tried a few things using the pp effects to counteract it, but no joy. I'm asking this as a learning question and not as a way to get the attention of BIS devs. But, when encountering problems such as vanilla effects ingame, can a modder (developer such as yourself) contact BIS and ask them to either change a specific part of the game code, or tell you how they wrote it so that you can modify in your scripts? Obviously, asking a game dev to "change" the game for one person's wishes isn't a fantastic idea in all aspects, but when it's a mod to change ppeffects in this way (underwater diving/environment), I would think being able to ask for help from the direct source would help. I haven't developed anything to this extent by any means, but would like to know if we have access to devs in this fashion. Great work, hope everything sorts itself out. Share this post Link to post Share on other sites
eaglezero6205 10 Posted January 9, 2012 I Hate BSOD s I will never willfully own another windows XP computer again if I can avoid it.You gotta watch those bsods they will ruin everything. I used to get on Average 15 a day Makes you just want to pull out your teeth with Pliers. New computer now Thank God anyway good luck with the progress on this mod. Your doing what Developers of Arma 2 were obviously to lazy to do in the first place I mean and your by yourself we should have to buy a new Arma game fro this it should have already been done.My hats off to you for your efforts keep up the good work. Share this post Link to post Share on other sites
DaveP 66 Posted January 9, 2012 vis a vis BCD calibration, why not have it as an audio cue when it's operation (gas hiss or similar)? Would stop the kind of immersion breaking you get with text/hint coming up. An interesting pp effect could be to have a 'wet goggle' texture overlaid on vision when surfacing that fades out after a few seconds. With regards to visibility, you could play around with player view distance once submerged or fog alongside the colour correction Looking forward to seeing this, looks like a really cool addon to open up a new kind of gameplay Share this post Link to post Share on other sites
Feint 137 Posted January 10, 2012 (edited) That's a good idea DaveP about the audio effect! I never thought of that. I think I'll do that. I'll credit you for the idea. EDIT: DONE! Big improvement. Thanks! I thought about doing the wet goggle effect similar to a night vision overlay. I've got a lot on my plate at the moment just finishing up the base and I want to get something released before Arma3 comes out and humiliates my addon completely. Hahaha. :) RE viewdistance underwater, doesn't seem to help. I had viewdistance set up to 10k and it still looks sucky depending on the time of day and cloud conditions. @Eaglezero6205, Thanks for the compliments but I don't think BIS is lazy in any way for not implementing an under water component to their simulations. It's a whole new undertaking with lots of components and they have to draw a line at development costs somewhere. They could implement a whole space component with space-deployed satellites and planes that can fly up to 80,000 feet, but where do you draw the line? On a side note, I was telling a girl I was having lunch with today about this thing I'm working on. When I mentioned that BIS has a military version of Arma2 that governments and armies all over the world use for training purposes, she suggested that there was probably a underwater module that already exists that Navy Seals and SAS were probably using, but that was secret and unpublished. I like that idea. Edited January 10, 2012 by Feint Share this post Link to post Share on other sites
DaveP 66 Posted January 10, 2012 That's a good idea DaveP about the audio effect! I never thought of that. I think I'll do that. I'll credit you for the idea.EDIT: DONE! Big improvement. Thanks! RE viewdistance underwater, doesn't seem to help. I had viewdistance set up to 10k and it still looks sucky depending on the time of day cloud. You're too kind, but there's really no need -an idea without a suitably matched creator is as useful as the smoke from a candle (and as fleeting) With view distance/fog, I was thinking the other direction -I know setviewdistance only goes down to 500m, but perhaps setfog will bring some results Share this post Link to post Share on other sites
Feint 137 Posted January 12, 2012 Ah, DaveP, very poetic. But where's there's smoke, there's usually fire. Sorry, you're getting credit for the idea. Haha. Just tried setFog. The foggier it is, the more white light there is in the background behind objects like submarines. The less fog, the more blue. It's not effecting the actual alpha value of the area underneath water, just adding or removing fog from the water the way it does above the surface. It seems that the alpha value of water is set in rvmats. So maybe a custom island using custom water would have better luck at making water more clear underneath the surface. Share this post Link to post Share on other sites
dialektiikka 10 Posted January 12, 2012 Great to see you progressing with this! Um, just a couple of small question for anybody who knows. Is it possible to place smoke cloud effects underwater to simulate billowing mud? Also, is there a 3D mission editor which makes it possible to place objects in variable angles. Ie. not just horizontally. Tried the search, but didn't find any, though I do have a dim memory of some such. Maybe just not enough coffee :) Placing wrecks etc. in angles would be nice mission-wise. Share this post Link to post Share on other sites
abs 2 Posted January 12, 2012 It should be possible to create "billowing mud" using the drop command, as particle weight is one of the parameters passed in the ParticleArray array. Your dim memory is most likely of the VBS 3d editor, where you can rotate any object in the GUI. Feint, I'm loving your progress! Keep it up! I bet when Arma3 comes out, you'll be able to improve their implementation of scuba divers tenfold. :) Abs Share this post Link to post Share on other sites
Feint 137 Posted January 13, 2012 (edited) On one of the missions I was playing around with, I had a boat sink above an underwater hill. When the boat hit the bottom, it fell naturally tilting to the side. Seemed to work fine. The boat was from the FFAA mod, the BAM, I think. Note, when wreck diving, you have to be pretty careful. If you hit the sides of the wreck too many times, you end up dying. It's the same if you hit the side of a floating boat too many times. You just die. Not sure why, so I just keep my distance as much as possible. Main problem with the Arma engine is that below a certain depth, the sunk boats disappear similar to deleteVehicle. So you can only sink boats in water that is a certain depth. This is true for all wrecks whether they start out OK and die or they start out as wrecks from mission start. So when making missions, keep an eye out for how deep the wreck is. If you don't see your wreck, it is because it's too deep. dialektiikka, there are also some ways to change direction and angle of an object placed in the editor, but it requires a lot of experimentation and can be a frustrating experience. I used some of the commands when I was working on my AC-130 concept. I was able to get the guns to be 90 degrees left of the direction of the C-130 body and then rotated 180 degrees along the axis of their barrels and then tilted up 20 degrees or so (which appeared tilted down because they were upside down). I used various setDir's, setVectorDirAndUp, and setVectorDir. You might want to play with banking a boat as if it's taking on water. For the Frigatta, I placed it on the map and then in the init typed: this setPos [getPos this select 0, getPos this select 1, -4]; this setDir 90; this setVectorUp [0,1,0]; This put the boat slightly under water, then set the dir, then set the vectorup. It matters what order you put these commands in. If you place the setPos last, for example, it won't work. Also, this doesn't seem to work with other boats which are able to be driven like Gnat's container carriers probably because most vehicles marked as "boats" in their config can't go under water for very long (with the exception of the lifeboat for the F18 which is able to stay under water for a few seconds). I haven't done any real testing though. So maybe you will get better results than I am getting. The Fregatta isn't really a boat, it is just a building that looks like a boat. Edited January 13, 2012 by Feint Share this post Link to post Share on other sites
Feint 137 Posted January 14, 2012 (edited) This looks promising...AI that can dive if you set a depth for them. I might still have to work out the timing a little, and I have to launch a script that makes sure the AI don't float up into the air above the surface, but this is a step in the right direction. The player is able to control the different AI's depth separately by special order (similar to ordering an AI to eject from a plane). :bounce3: http://www.lightstormimages.com/gallery/games/arma2/scubatesting/full/AI_Diving_07.jpg >100kb! http://www.lightstormimages.com/gallery/games/arma2/scubatesting/full/AI_Diving_08.jpg >100kb! Edited January 20, 2012 by Foxhound Share this post Link to post Share on other sites
Feint 137 Posted January 15, 2012 (edited) OK, so here's a question I can't answer. You have two AI. You command the first to dive and he starts running a script to dive which ends after the target depth is reached. This script starts another script which starts a while loop. While under water, "say" the breathing sound and check depth. If depth is above sea level, detach from pond and return depth to sea level. Sleep 3.5 seconds. If the player sets a new depth, it will run that sound loop/depth check script again unless I put some code in to prevent a second instance from running (per AI). But I still want the second AI to be able to run its OWN instance of this sound loop/depth check script. How do I prevent that second instance from starting? In the past, I've written things like, "runningStatus = 1" when the script starts. Then, there's a check, "if (runningStatus ==1) then exitWith {};" But since this script will be applied to multiple AI which won't be named, how do I know which AI is already running the script? Here's what I think... In the first "diving/ascending" script, I write: _gen = _this select 0; // This is the AI that calls this script when I order him to [aiSoundDepthCheck, _gen] = _gen execVM "\underwater_diving_module\scripts\aiDiving\aiSoundDepthCheck.sqf"; Then, once I'm in the aiSoundDepthCheck.sqf, I can do something like this at the start: _gen = _this select 0; if (scriptDone [aiSoundDepthCheck, _gen]) then {continue with the looping of the sound and checking of depth}; Will this work to prevent the second instance from running for that specific AI? Edited January 15, 2012 by Feint Share this post Link to post Share on other sites
das attorney 858 Posted January 15, 2012 (edited) Without seeing the scripts, I would say setVariable and getVariable are your friends here. http://community.bistudio.com/wiki/setVariable http://community.bistudio.com/wiki/getVariable I would do something like the following in the aiSoundDepthCheck.sqf: if (!isNil{_gen getVariable "FEINT_FUD_script_running"}) exitWith {_gen sideChat "this is a hint to show you I'm not running two instances of the code"}; _gen setVariable ["FEINT_FUD_script_running", 1, false]; // your (looped) code here // On exit _gen setVariable ["FEINT_FUD_script_running", nil, false]; If it doesn't make sense or you need to discuss, let me know :) EDIT: The advantage of setVariable is that you can apply it to a specific unit, rather than a global variable like runningStatus. It sets the variable to given value in the variable space of given element. In this case, each unit is an element, and can have their own value when setVariable is used. Hope that makes it clear (as mud) ho ho ho :) Edited January 15, 2012 by Das Attorney Share this post Link to post Share on other sites
Feint 137 Posted January 15, 2012 (edited) Yes! I'll try it. Sounds promising. Thanks again! I started to read about setVariable, but the wiki isn't super clear to me. But this sounds like exactly what I need. UPDATE! I've FINALLY finished the AI diving script. I've streamlined it so it's down to one script which keeps the AI divers swimming at the same depth (they update their depth every 3.5 seconds). It also detaches them from the invisible pond when they reach 0 depth, something which took me ALL DAY today to get to work correctly. In the end, I had to rig it rather than do it correctly, but it seems like it's reliable. Now, to get AI to dive at your command, make sure you out-rank them, and just synchronize the Module with the AI and yourself. Easy! Edited January 15, 2012 by Feint Share this post Link to post Share on other sites
HoodRussian13 10 Posted January 20, 2012 very impressive, keep up the good work! Share this post Link to post Share on other sites
[aps]gnat 29 Posted January 20, 2012 Yes, Impressive! Share this post Link to post Share on other sites