Bimmer Bomber 10 Posted November 17, 2013 (edited) Hey guys, I'm kinda new here, but I have a question for you guys. I'm trying to develop a mission campaign, and part of the story line is a gas attack on (REDACTED) in north-eastern Altis. What I need from you guys is: How do I set up a no-go zone to simulate a toxic environment? Obviously, I'm not going to wall the area off, that would be retarded lol But I was throwing around the idea of a trigger zone big enough for the area affected, and some kind of damage script (kinda similar to this, but different: http://forums.bistudio.com/showthread.php?142965-Area-Gas-attack ). The second part is: How can I rig this so that if the characters in the game equip a gas mask (or whatever item I can implement as such, like a rebreather just because it's similar... vaguely...), the damage script of whatever is causing the damage (or the negative effect on the characters) will be nullified as long as said item is equipped? It would be really nice for the characters to have some kind of gas mask item thingy for the simulated gas attack, because part of my campaign is going to take them into the red zone. So having them not die in three seconds would be preferable haha I basically need a way to make a gas could and a way to make special units survive inside it for a limited duration. Thanks in advance! Edited November 17, 2013 by Bimmer Bomber Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 18, 2013 So no one knows how to get something like this to work, then? :C Share this post Link to post Share on other sites
ianbanks 30 Posted November 18, 2013 Namalsk Crisis does this quite well with radiation zones in some of the first few missions. You'll want to have either a trigger (perhaps an outer trigger for slight damage and symptoms and an inner trigger for more immediate death ;). Or you could just put a marker down and periodically check the distance between the marker and the player. I'd search the forums for details about post processing effects too, because they also give an indicator of how close you are to the danger area. If it is a visible gas you could progressively tint the air as they get closer. If you know the class name of the mask then checking the headgear of a player is quite simple. If you set up a mission where you are wearing the headgear and run the first example in the script console it will show in the hint bar what the name is. Share this post Link to post Share on other sites
Von Quest 1163 Posted November 18, 2013 Gas Masks would be great. Don't think we have any yet though. Like IanBanks stated, search ppEffects to use with setDamage with your Triggers. Share this post Link to post Share on other sites
trnapster 12 Posted November 18, 2013 I have scripted something quick for you: You can adjust the defined Constants for your needs. I have also created whitelists for uniforms, vests, backpacks and helmets so you can add the Rebreather or any modItem if you want I haven't added a ppEffect because I dont know how to use them yet... init.sqf if (!isDedicated) then { TRN_fnc_gasLoop = compileFinal preprocessFileLineNumbers "client\fn_gasLoop.sqf"; }; client\fn_gasLoop.sqf /* File: fn_gasLoop.sqf Author: trnapster Description: Checks if Player is inside Triggerarea and damages him constantly Parameters: _this: triggerobject Returns: nothing */ #define DAMAGE 0.1 //Damage per Interval #define INTERVAL 1 //Interval in seconds #define WHITELIST_UNIFORM [] //whitelisted clothing #define WHITELIST_VEST [] //whitelisted clothing #define WHITELIST_BACKPACK [] //whitelisted clothing #define WHITELIST_HELMET [] //whitelisted clothing _damage = damage player; _protected = false; { if (uniform player == _x) then { _protected = true; }; }forEach WHITELIST_UNIFORM; { if (vest player == _x) then { _protected = true; }; }forEach WHITELIST_VEST; { if (backpack player == _x) then { _protected = true; }; }forEach WHITELIST_BACKPACK; { if (headgear player == _x) then { _protected = true; }; }forEach WHITELIST_HELMET; while {triggeractivated _this} do { if (!_protected) then { _damage = _damage + DAMAGE; player setDamage _damage; playSound3D ["A3\Sounds_F\characters\human-sfx\Person1\P1_breath_high_14_z.wss", player]; }; sleep INTERVAL; }; You only have to create triggers on the map containing following: Activation: Anybody Repeatedly Condition: player in thislist On Act: _h = thisTrigger spawn TRN_fnc_gasLoop Have Fun :) Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 18, 2013 Oh wow O_O Thanks, trnapster. That's crazy. It's a little late where I live atm, I just wanted to check this before I hit the hay. I'll fill everything in tomorrow and give you guys an update as to how it's working. Im probably just going to use a rebreather mask or something, the player(s) in the mision can have it in their backpacks and tey can pull it out whenever they hit gas pockets. Thanks everyone for the input, and thanks a lot trnapster for the effort, if this ever becomes a campaign set (as I intend it to), I'll give you credit for the mask/gas effects. Arma 3 mod community for the win lol Share this post Link to post Share on other sites
trnapster 12 Posted November 18, 2013 np I have just added a few lines to fn_gasLoop.sqf for enhanced gear functionality. On the previous one it would have been like... entering the zone without protection and you are doomed regardless if you are putting on protective gear fast enough It now checks if you change any gear... it would be more efficient to use a TAKE/PUT eventhandler but this should work fine.... fn_gasLoop.sqf /* File: fn_gasLoop.sqf Author: trnapster Description: Checks if Player is inside Triggerarea and damages him constantly Parameters: _this: triggerobject Returns: nothing */ #define DAMAGE 0.1 //Damage per Interval #define INTERVAL 1 //Interval in seconds #define WHITELIST_UNIFORM [] //whitelisted clothing #define WHITELIST_VEST [] //whitelisted clothing #define WHITELIST_BACKPACK [] //whitelisted clothing #define WHITELIST_HELMET [] //whitelisted clothing _damage = damage player; _protected = false; _uniform = uniform player; _vest = vest player; _backpack = backpack player; _helmet = headgear player; { if (_uniform == _x) then { _protected = true; }; }forEach WHITELIST_UNIFORM; { if (_vest == _x) then { _protected = true; }; }forEach WHITELIST_VEST; { if (_backpack == _x) then { _protected = true; }; }forEach WHITELIST_BACKPACK; { if (_helmet == _x) then { _protected = true; }; }forEach WHITELIST_HELMET; while {triggeractivated _this} do { if (!_protected) then { _damage = _damage + DAMAGE; player setDamage _damage; playSound3D ["A3\Sounds_F\characters\human-sfx\Person1\P1_breath_high_14_z.wss", player]; }; if (_uniform != uniform player) then { _uniform = uniform player; { if (_uniform == _x) then { _protected = true; }; }forEach WHITELIST_UNIFORM; }; if (_vest != vest player) then { _vest = vest player; { if (_vest == _x) then { _protected = true; }; }forEach WHITELIST_VEST; }; if (_backpack != backpack player) then { _backpack = backpack player; { if (_backpack == _x) then { _protected = true; }; }forEach WHITELIST_BACKPACK; }; if (_helmet != headgear player) then { _helmet = headgear player; { if (_helmet == _x) then { _protected = true; }; }forEach WHITELIST_HELMET; }; sleep INTERVAL; }; Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 19, 2013 Okay, that works, really well lol :D I tried it out. I ran into the affected area (trigger) and my character was coughing in a matter of seconds, and he died pretty quickly. So it definitely works. Great coding/scripting, trnapster. I'm just trying to get my head around the item/clothing part, where I have to select an item to use as the "gas mask" item for the mission. I have no idea how that works lol I enjoy building maps and stuff, but I'm pretty new to this, and I've been trying to keep my work to the in-game editor and stay away from scripting, which I have a very weak grasp on lol Looking around at all the options, I think I'm going to end up going with a pilot helmet or something... Which I really don't want to do, because while it has an oxygen tube in the front for air, and it *is* a helmet, I was hoping that there would be something else that could be used as a gas mask without being a huge, bulky affair like the pilots helmet is. If it covered the face of the character, I would be golden. The pilot helmet is the worst best option I have, and it's terrible haha XD Share this post Link to post Share on other sites
trnapster 12 Posted November 19, 2013 To whitelist an item you just have to write the classnames into the respective array. For example the Bluefor Pilor Helmet is "H_PilotHelmetHeli_B" Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 19, 2013 Oh okay... your script is pretty easy to work with. Sweet. When adding game items/objects in a script, I use "_this" instead of "this" as I would in an Init line, correct? Share this post Link to post Share on other sites
trnapster 12 Posted November 19, 2013 I dont understand your question "_this" refers to the parameters given to a function if you call it with "call" or "spawn" "this" refers to the actual object but only in the init field in the editor if you mean how to add weapons to units with scripts it's done with classnames like: player addWeapon "arifle_MX_F"; This would add a MX rifle to the player Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 19, 2013 I'm refering how to add headgear to the whitelist in your script. But I think I can get it with that info... hmmm... well let me play around with this, if I can't get the rest of it set up, I'll come back. This should be epic. Share this post Link to post Share on other sites
trnapster 12 Posted November 19, 2013 #define WHITELIST_HELMET ["H_PilotHelmetHeli_B", "H_PilotHelmetHeli_O", "H_PilotHelmetHeli_I"] //whitelisted clothing Share this post Link to post Share on other sites
rinkia 10 Posted November 19, 2013 For this kind of script i think it's needed something like biological/chemical suit. that will be perfect for using your script trnapster :) Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 22, 2013 (edited) Right? I've been searching for *something* that I could use as a gas mask, even something that kinda resembles one, and I can't find anything that suits it. I really don't want my soldiers to turn into helicopter pilots when they need to enter a gas zone, but that's really the only outfit that looks *remotely* like a biohazard survival outfit... :/ Maybe there's a mod that contains a gas mask or a bio suit. If there is, I haven't seen it. I'll find something, tho, I just need to look a lot harder. Btw trnapster, is there a way to get the script to kill AI players as well? As the campaign stands, there are 8 team members, and whichever characters aren't human players will be AI under player control. It would be nice if the gas cloud would kill them as well. As it stands, I and any human players wander into the gas cloud and die, and the AI on my team stand there looking at us as if we had heart attacks or something XD lol It would *also* be handy, because early on, part of the campaign takes the players into the gas cloud, through a gassed city, and to an abandoned military camp on a retrieval mission just after the gas attack. I want there to be dead civilians in the area, so I was hoping that if I spawned them in the cloud, they would die and the player would simply happen across them as if they died when the gas hit. So having the gas kill any human character, AI and human, would be pretty handy ;) I'm sure there's an init command to kill them, but having the gas kill them seems a little more realistic. They will be spawning miles away from the players, so they should be very dead by the time the players arrive. Also, if there was a way to add vehicles to the whitelist, that could be a really handy feature. A lot of modern armour have NBC kits to filter air and remove contaminants/radiation in the event of a nuclear/chemical/biological attack. I could add all of the atmospherically-contained armoured vehicles like the Marshall and the Slammer to the whitelist, and leave open-cockpit vehicles like the Offroad and Hunter off of the whitelist so that if the player(s) and their AI buddies are in an exposed vehicle without protection, they will die from exposure. I was going to ask about how I could change the altitude of the gas cloud so that it could affect air as well, but the gas I'm planning on using will be heavier than air, so it should sink to the ground and leave air traffic unaffected. So that's awesome as it stands currently lol Beyond that, the script is outstanding, works really well, even makes the edges of the screen fade kinda and disables sprint as the player becomes weaker and weaker. So thanks again, trnapster, this script works pretty damn awesomely lol (except for the changes I mentioned above, those would be extremely helpful). As for the actual campaign, the first level is coming along quickly and nicely, I can't wait to get this first mission completed and get one on the scoreboard lol I've been trying to think up a name for the campaign series, maybe Operation Blind Faith or something... Still up in the air, but I usually try to name stuff like this after I've completed it. Edited November 22, 2013 by Bimmer Bomber Share this post Link to post Share on other sites
iceman77 18 Posted November 22, 2013 After reading this post a few days ago, I put in a request in the 'addons request thread'.. maybe if you go raise the topic again, someone will notice a need for such items. Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 22, 2013 After reading this post a few days ago, I put in a request in the 'addons request thread'.. maybe if you go raise the topic again, someone will notice a need for such items. I just posted there, thanks for the heads-up. The number of people who would benefit from a gas mask addon was surprising to say the least... Share this post Link to post Share on other sites
trnapster 12 Posted November 22, 2013 Btw trnapster, is there a way to get the script to kill AI players as well? Also, if there was a way to add vehicles to the whitelist, that could be a really handy feature. init.sqf if (!isDedicated) then { TRN_fnc_gasLoopInit = compileFinal preprocessFileLineNumbers "client\fn_gasLoopInit.sqf"; TRN_fnc_gasLoop = compileFinal preprocessFileLineNumbers "client\fn_gasLoop.sqf"; }; client\gasLoopInit.sqf /* File: fn_gasLoop.sqf Author: trnapster Description: Calls Gasloop Parameters: _this: triggerobject Returns: nothing */ { if (_x isKindOf "CAManBase") then { [_this, _x] spawn TRN_fnc_gasLoop; } else { { [_this, _x] spawn TRN_fnc_gasLoop; }forEach (crew _x); }; }forEach (list _this); client\gasLoop.sqf /* File: fn_gasLoop.sqf Author: trnapster Description: Checks if Player is inside Triggerarea and damages him constantly Parameters: _this select 0: triggerobject _this select 1: unit Returns: nothing */ #define DAMAGE 0.1 //Damage per Interval #define INTERVAL 1 //Interval in seconds #define WHITELIST_UNIFORM [] //whitelisted clothing #define WHITELIST_VEST [] //whitelisted clothing #define WHITELIST_BACKPACK [] //whitelisted clothing #define WHITELIST_HELMET [] //whitelisted clothing _unit = _this select 1; _damage = damage _unit; _protected = false; _uniform = uniform _unit; _vest = vest _unit; _backpack = backpack _unit; _helmet = headgear _unit; _vehicle = vehicle _unit; { if (_uniform == _x) then { _protected = true; }; }forEach WHITELIST_UNIFORM; { if (_vest == _x) then { _protected = true; }; }forEach WHITELIST_VEST; { if (_backpack == _x) then { _protected = true; }; }forEach WHITELIST_BACKPACK; { if (_helmet == _x) then { _protected = true; }; }forEach WHITELIST_HELMET; while {triggeractivated (_this select 0)} do { if (!_protected) then { _damage = _damage + DAMAGE; _unit setDamage _damage; playSound3D ["A3\Sounds_F\characters\human-sfx\Person1\P1_breath_high_14_z.wss", _unit]; }; if (_uniform != uniform _unit) then { _uniform = uniform _unit; { if (_uniform == _x) then { _protected = true; }; }forEach WHITELIST_UNIFORM; }; if (_vest != vest _unit) then { _vest = vest _unit; { if (_vest == _x) then { _protected = true; }; }forEach WHITELIST_VEST; }; if (_backpack != backpack _unit) then { _backpack = backpack _unit; { if (_backpack == _x) then { _protected = true; }; }forEach WHITELIST_BACKPACK; }; if (_helmet != headgear _unit) then { _helmet = headgear _unit; { if (_helmet == _x) then { _protected = true; }; }forEach WHITELIST_HELMET; }; sleep INTERVAL; }; You have to create a Trigger for each side Type: None Activation: BLUFOR, OPFOR, Independent, Civilian Repeatedly Condition: this On Act. _h = thisTrigger spawn TRN_fnc_gasLoopInit; No Vehicle Whitelisting yet... still have some problems with that Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 22, 2013 I feel dumb. Making a trigger for each individual faction makes a lot of sense now lol Thanks for the heads-up. As for the vehicle white listing, you've been gracious enough to give me this script. If you can't get the vehicles to work, then I'll live with it lol If you can't get it to work, don't worry about it. You've given me tons already. Either way, the first mission is almost done, all I need to do is fix up a few more triggers and give it a quick playtest, and I think I can call the first mission complete. Share this post Link to post Share on other sites
trnapster 12 Posted November 22, 2013 Actually the vehicle whitelisting works... kind of The only problem is, if you exit the protected vehicle inside the gaszone you still wont be affected by the gas... Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 22, 2013 haha well, that's pretty interesting... I guess I'll have to stick with the gas masks then. The current script version you posted isn't working atm, but I'm going to go back over everything tomorrow and triple check it. I've tried it a few times and it isn't killing anyone, AI or human. So I've probably missed a character somewhere or something... As a sidenote, trnapster, I had to remove the "client\" part of each of the gasLoop.sqf files because my comp won't let me keep file titles with the "\" character in them. I'm guessing that this may be what is messing the script up, but as I said, I'm going to go back over everything again and see if I missed something. I've loaded it up a couple times and I haven't gotten any error messages. So I'll have to dig around. Hooray! lol Share this post Link to post Share on other sites
davidzi 11 Posted November 22, 2013 Is there any way to force the mask of the rebreather to activate on land? None of the methods that I found worked. Would go perfectly with this script. Thanks for sharing. Bimmer Bomber, client\gasLoopInit.sqf means you have a file called gasLoopInit.sqf inside a folder named client (that you create). YourMissionName.Altis\client\gasLoopInit.sqf Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 23, 2013 Is there any way to force the mask of the rebreather to activate on land?None of the methods that I found worked. Would go perfectly with this script. Thanks for sharing. Bimmer Bomber, client\gasLoopInit.sqf means you have a file called gasLoopInit.sqf inside a folder named client (that you create). YourMissionName.Altis\client\gasLoopInit.sqf Yeah, I got the script to work, thanks for the info, though. As I said, I'm still new to this whole scripting/writing code thing. But I'm learning, slowly but surely. Share this post Link to post Share on other sites
cigar0 12 Posted November 23, 2013 Good. Could you post the final script if it works great with a small tutorial and also maybe a few pictures of the gas and reaction of the player to it? This would be very nice. ;-) Share this post Link to post Share on other sites
Bimmer Bomber 10 Posted November 24, 2013 It's trnapster's script, but I could probably show you how to implement it... however, I don't have any video capture software. It's really easy to install, though, all you need to do is copy/paste the required text into the description/init files in your mission (should be saved under your Documents), and then go to the in-game editor using the mission you have scripted with the previous steps. Lay down a trigger, enter the appropriate text in the required spaces and configure the rest of the trigger options, and it should be set. I cut the "client\" bit out of each text file to make it work for me, so you may need to tinker with things as you go along. I currently don't have any safety equipment whitelisted in the script, but that is mostly due to me still looking for something that I would use as safety gear. So far, nothing resembling a gas mask has popped up, and I refuse to use anything silly-looking as a replacement. So right now, it just kills people. I don't have a way to protect characters. But if you added your own items to the whitelist, then you could build a gas-proof outfit. Share this post Link to post Share on other sites