ryker Posted May 5, 2015 Report Share Posted May 5, 2015 Goood morning survivors, i have a radiation zone on my map. As soon as you enter this zone, you will slowly bit constantly loose blood. I like to know where i have to put this snippit to avoid loosing blood. if ((typeOf player) == "Sniper1_DZ") then { radiationEffect = false; }; As Vampire suggested i tried to put it in init.sqf, but it didnt work. Can anyone please help me with this. Ryker Linux 1 Link to comment Share on other sites More sharing options...
0 SchwEde Posted May 5, 2015 Report Share Posted May 5, 2015 you will need thiss check in a loop and with an if else command. Also i would use an array, so you can add and remove skins from there without checking every single skin. The epoch variable is DZE_InRadiationZone so your code should be something like: RadtionSkins = ["Sniper1_DZ","OtherSkins"]; //place this in your variables.sqf if ((typeOf player) in RadtionSkins) then { DZE_InRadiationZone = false; } else { DZE_InRadiationZone = true; }; also you can modify player_spawn2.sqf to archive that for you since its already have what you try to do :) ryker 1 Link to comment Share on other sites More sharing options...
0 ryker Posted May 5, 2015 Author Report Share Posted May 5, 2015 Thanks a lot - you deserve more than all my beans! edit: You've said that it has to be in a loop, do you mean: while { ( (typeOf player) in RadtionSkins) } do { radiationEffect = false; }; ? Link to comment Share on other sites More sharing options...
0 raymix Posted May 5, 2015 Report Share Posted May 5, 2015 while {true} do { DZE_InRadiationZone = if ((typeOf player) in RadtionSkins) then {false} else {true}; sleep 10; //suspend the loop a bit, no need to run every frame }; That would be the loop, but trigger would make more sense, tbh. Like when the skin is changed or player enters the area, that way code is launched once only when required. SchwEde and ryker 2 Link to comment Share on other sites More sharing options...
0 ryker Posted May 5, 2015 Author Report Share Posted May 5, 2015 Hi Ray, by saying trigger you mean something like class Item123 { position[]={000,000}; a=100; b=100; activationBy="WEST"; repeating=1; interruptable=1; age="UNKNOWN"; name="radzone"; expCond=""; expActiv="execVM ""custom\codefrom_schwede_raymix.sqf"";"; expDesactiv=""; class Effects { }; }; sorry for my inability, still learning... Link to comment Share on other sites More sharing options...
0 raymix Posted May 5, 2015 Report Share Posted May 5, 2015 That's exactly what I meant, yep. You don't need to launch external file if you don't feel like it, try something like this, see if it works (just make sure to define your skins either here, in your variables.sqf or simply in your init.sqf, doesn't matter: Mind the var name is RadtionSkins no RadiationSkins (copypasta) class Item123 { position[]={000,000}; a=100; b=100; activationBy="WEST"; repeating=1; interruptable=1; age="UNKNOWN"; name="radzone"; expCond="(player != vehicle player)"; //example condition: players in vehicle not affected expActiv="DZE_InRadiationZone = if ((typeOf player) in RadtionSkins) then {false} else {true};"; expDesactiv=""; class Effects { }; }; SchwEde and ryker 2 Link to comment Share on other sites More sharing options...
0 ryker Posted May 5, 2015 Author Report Share Posted May 5, 2015 excellent, thanks raymix!!! also with your example condition you answered my next question. sorry man, gave all my beans to schwede ;) Link to comment Share on other sites More sharing options...
0 ryker Posted May 6, 2015 Author Report Share Posted May 6, 2015 Hello, i've got another issue: with the current code, the rad-effect only effects, when i enter/leave/re-enter the area. For example: When i enter the area with a skin thats in the array there is no radiation-effect, changing clothes inside the area will take no effect. Same for cars. Entering with a car= no radiation, leaving the car inside the area = no radiation. if ( ((typeOf player) in RadiationSkins) or ( (vehicle player != player) ) then { DZE_Quarantine=false; DZE_InRadiationZone = false; TitleText[""rad will not harm you..."",""PLAIN DOWN""]; } else { DZE_Quarantine=true; DZE_InRadiationZone = true; TitleText[""suffering from rad..."",""PLAIN DOWN""]; }; also i noticed a different behavior when using expActiv="execVM ""custom\codefrom_schwede_raymix.sqf"";"; and pasting above code to the sqf. Can someone please point me to the right direction? Link to comment Share on other sites More sharing options...
0 raymix Posted May 6, 2015 Report Share Posted May 6, 2015 Well, essentially what a trigger is - it launches code only when tiggered, that's it, everything stops there, it does not continuously shoot. If there's a chance something might change after being triggered, in that case it is better to create a while loop that is either triggered or activated using waitUntil. I am currently monitoring kids exams to make sure PCs operate in classrooms, when this hell ends I'll post some code snippets. Link to comment Share on other sites More sharing options...
0 ryker Posted May 6, 2015 Author Report Share Posted May 6, 2015 glad you are willing to help me, looking forward it. :) Link to comment Share on other sites More sharing options...
0 Halvhjearne Posted May 6, 2015 Report Share Posted May 6, 2015 while {true} do { DZE_InRadiationZone = if ((typeOf player) in RadtionSkins) then {false} else {true}; sleep 10; //suspend the loop a bit, no need to run every frame }; That would be the loop, but trigger would make more sense, tbh. Like when the skin is changed or player enters the area, that way code is launched once only when required. i dont think it is a good idear to loop that exact variable, you should have another variable switch it one on and off or it will not trigger when the player goes outside the map (or rather it will just shut off again if he does) Link to comment Share on other sites More sharing options...
0 raymix Posted May 6, 2015 Report Share Posted May 6, 2015 (edited) I gotta say I've no idea how radiation zones works or are they part of DZE (which I uninstalled together with A2 like almost a year ago), so to do the script I am only relying on what you tell me here guys, but I've googled the 2 variables about radiation and quarantine you are using, seems simple enough. Here try something like this, I couldn't figure out anything better using waitUntil and using function wouldn't work well since player can leave vehicle or change skin while inside zone. This should work tho: class Item123 { position[]={000,000}; a=100; b=100; activationBy="WEST"; repeating=1; interruptable=1; age="UNKNOWN"; name="radzone"; expCond=""; expActiv="ryker_Radiation = true;"; expDesactiv="ryker_Radiation = false;"; class Effects { }; }; add to bottom of your init.sqf file: [] spawn { if (isNil "ryker_Radiation") then {ryker_Radiation = false;}; //define to avoid RPT errors radiationSkins = ["Sniper1_DZ","OtherSkins"]; //skins not affected while {ryker_Radiation} do { //should go live when trigger changes boolean if ((player == vehicle player) || (typeOf player) in radiationSkins) then { //in vehicle or has skin DZE_Quarantine=false; DZE_InRadiationZone = false; } else { DZE_Quarantine=true; DZE_InRadiationZone = true; }; sleep 10; //suspend checks to 10 seconds }; }; Edited May 6, 2015 by raymix Link to comment Share on other sites More sharing options...
0 ryker Posted May 6, 2015 Author Report Share Posted May 6, 2015 Thank you very much for your input guys! Couple of questions here: is there a difference if i put it in a external file (radiation.sqf)? what about the condition --> expCond="(player distance radzone) < 300"; ...can i "chain" it? ie: (player distance radzone) < 300; ryker_Radiation = true; can i place the array of skins inside the external file? will try it myself, but any help is much apperciated. Link to comment Share on other sites More sharing options...
0 raymix Posted May 6, 2015 Report Share Posted May 6, 2015 1) no difference, it's entirely up to you and your work style. 2) not gonna work, trigger is activated when player enters its radius, if condition is not met, trigger will not shoot. What you can do instead is make trigger radius bigger (probably settings a and b under classname in mission.sqm). Although there are also script version of triggers you can create (but you need to be careful here, since triggers has to be done server side, otherwise you'll end up with dozen of dead triggers when players disconnect, mission.sqm triggers are automatically loaded by server), that way you can have more dynamic control, which will require some coding experience. 3) yes as long as skins are defined either automatically on init or when trigger is shot. Not a good practice since you will be defining same array every time, but it also gives you advantage of having a local variable for this array, which is always good thing for security. Link to comment Share on other sites More sharing options...
0 ryker Posted May 6, 2015 Author Report Share Posted May 6, 2015 18:11:50 "DayZ Epoch: MPframework inited" 18:11:51 Error in expression < "admintools\Activate.sqf"; [] spawn = { if (isNil "ryker_Radiation") then {r> 18:11:51 Error position: <= { if (isNil "ryker_Radiation") then {r> 18:11:51 Error Ungültige Zahl in Ausdruck 18:11:51 File mpmissions\DayZ_Epoch_24.Napf\init.sqf, line 197 18:11:51 Error in expression < "admintools\Activate.sqf"; pasted your code at the very bottom, below admintools.... dont know/cant see what causes this error. Link to comment Share on other sites More sharing options...
0 raymix Posted May 6, 2015 Report Share Posted May 6, 2015 edit.. oops remove equal sign on spawn, lol....we're not defining, we are executing. [] spawn = { should be [] spawn { Link to comment Share on other sites More sharing options...
0 ryker Posted May 6, 2015 Author Report Share Posted May 6, 2015 lol....we're not defining, we are executing. indeed sir, we do ;-) - thanks again! i think there is a "(" missing? if ( ( player == vehicle player) || (typeOf player) in radiationSkins) then { //in vehicle or has skin Link to comment Share on other sites More sharing options...
0 ryker Posted May 6, 2015 Author Report Share Posted May 6, 2015 No errors anymore, but the radzone doesn't "radiate" - no bloodloss, no geigersound! Link to comment Share on other sites More sharing options...
0 raymix Posted May 6, 2015 Report Share Posted May 6, 2015 hmm, my guess is that it skips trough while loop and ends the script there, this means we'll have to keep the loop running nonstop... don't personally like that, but since there's a chance player either wears outfit or jumps in a car while inside, this is pretty much a must. [] spawn { if (isNil "ryker_Radiation") then {ryker_Radiation = false;}; //define to avoid RPT errors radiationSkins = ["Sniper1_DZ","OtherSkins"]; //skins not affected while {true} do { //will always loop waitUntil {sleep 10; ryker_Radiation == true;}; //will stop the loop and wait checking var every 10 sec if ((player == vehicle player) || (typeOf player) in radiationSkins) then { //in vehicle or has skin DZE_Quarantine=false; DZE_InRadiationZone = false; } else { DZE_Quarantine=true; DZE_InRadiationZone = true; }; sleep 10; //suspend checks to 10 seconds }; }; adjust sleep if you feel effects are added too slow. Maybe someone else will come up with a better idea for this. Link to comment Share on other sites More sharing options...
0 ryker Posted May 6, 2015 Author Report Share Posted May 6, 2015 awesome - it works! thank you raymix. edit: unfortunately it works on the whole map and not only in the radzone... :blink: Link to comment Share on other sites More sharing options...
0 raymix Posted May 7, 2015 Report Share Posted May 7, 2015 expDesactiv="ryker_Radiation = false; DZE_Quarantine=false; DZE_InRadiationZone = false;"; Link to comment Share on other sites More sharing options...
0 ryker Posted May 8, 2015 Author Report Share Posted May 8, 2015 mhhh... that doesent work and i have no clue why. anyway- thanks a ton for your help. Link to comment Share on other sites More sharing options...
0 Guest Posted May 10, 2015 Report Share Posted May 10, 2015 Hi, To prevent trigger from allways being executed you will want to change the condition to if the player is within the trigger area ( a,b ). expCond="player in thislist"; Link to comment Share on other sites More sharing options...
0 ryker Posted May 11, 2015 Author Report Share Posted May 11, 2015 thanks for your reply, very helpfull. is there a difference between: player distance < 300 and player in thislist ? player distance assumes that there is a "player" - or am i wrong? Link to comment Share on other sites More sharing options...
0 Guest Posted May 11, 2015 Report Share Posted May 11, 2015 Hi, Yes there is a difference. The trigger has like an invisible list that gets appended when the trigger is activated (activation by and position and size). Now to get the activator of the trigger you will get thislist. the trigger condition is simply asking, if the player activated the trigger. Then proceed to activation expression (code to be executed). The condition (player distance < 300) will allways return false, as the syntax is wrong. "Distance" expects 2 parameters: obj distance (to) obj. I.e. player distance vehicle or something like that. But with the correct synyax this isn't wrong but not very smart as you can allways change the size of the trigger. Link to comment Share on other sites More sharing options...
Question
ryker
Goood morning survivors,
i have a radiation zone on my map.
As soon as you enter this zone, you will slowly bit constantly loose blood.
I like to know where i have to put this snippit to avoid loosing blood.
As Vampire suggested i tried to put it in init.sqf, but it didnt work.
Can anyone please help me with this.
Ryker
Link to comment
Share on other sites
24 answers to this question
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now