Jump to content

ayser

Member
  • Content Count

    56
  • Joined

  • Last visited

  • Medals

Community Reputation

1 Neutral

About ayser

  • Rank
    Lance Corporal
  1. Land_Barrelwater_F ----------------- I've tried to find the nearest of the object, and tried working with that, but, no dice :( It won't even find the object. _closestFoodObject = nearestObject [player, "foodObject"]; if(_closestFoodObject getVariable "water" <= 0) exitWith { hint "This crate of water is empty"; }; if(_closestFoodObject getVariable "water" > 0) then { hint "Wait..."; sleep 1; hint "OK"; sleep 3; player setVariable["water", (player getVariable "water")+1,true]; _closestFoodObject setVariable["water", (_closestFoodObject getVariable "water")-1,true]; hint format ["You take a bottle of water, there is %1 left", [_closestFoodObject getVariable "water"]]; }; ---------- Post added at 06:59 PM ---------- Previous post was at 06:37 PM ---------- If it makes anything more clearer, this is everything: foodSpawning.sqf // @file Version: 1.0 // @file Name: foodSpawning.sqf // @file Author: [404] Deadbeat, [404] Costlyy // @file Created: 20/11/2012 05:19 // @file Args: if(!X_Server) exitWith {}; private ["_counter","_pos","_markerName","_marker","_amountOfVehicles","_hint"]; _counter = 0; for "_i" from 1 to 16 do { _pos = getMarkerPos format ["Food_%1", _i]; _newpos = [_pos, 21, 40, 1, 0, 60 * (pi / 180), 0] call BIS_fnc_findSafePos; [_newpos] call foodCreation; _counter = _counter + 2; }; diag_log format["WASTELAND SERVER - %1 Food crates Spawned",_counter]; foodCreation.sqf // @file Version: 1.0 // @file Name: Script Name // @file Author: [404] Deadbeat // @file Created: DD/MM/YYYY HH:MM // @file Args: if(!X_Server) exitWith {}; _objPos = _this select 0; _Objtype = foodContainers select (random (count foodContainers - 1)); _obj = createVehicle [_Objtype,_objPos,[], 10,"None"]; _randomnum = floor(random 4); // Random # up to 4 foodObject = _obj; if(_Objtype == "Land_Barrelwater_F") then { _obj setVariable["water",4,false]; _obj addAction ["Take water","client\digestion\thirstConsume.sqf","",1,false,true,"","(_target distance _this) < 3"]; }; if(_Objtype == "Land_WoodenBox_F") then { _obj setVariable["canfood",3,true]; _obj addAction ["Take food","scripts\score4Barrels.sqf", "(_target distance _obj) < 4"]; }; _obj setpos [getpos _obj select 0,getpos _obj select 1,0]; thirstConsume.sqf //_closestFoodObject = nearestObject [player, "foodObject"]; _closestFoodObject = getPos player nearestObject "foodObject"; if(_closestFoodObject getVariable "water" <= 0) exitWith { hint "This crate of water is empty"; }; hint "3"; if(_closestFoodObject getVariable "water" > 0) then { hint "Wait..."; sleep 1; hint "OK"; sleep 3; player setVariable["water", (player getVariable "water")+1,true]; _closestFoodObject setVariable["water", (_closestFoodObject getVariable "water")-1,true]; hint format ["You take a bottle of water, there is %1 left", [_closestFoodObject getVariable "water"]]; }; hint "4"; if(foodObject getVariable "water" <= 0) exitWith { hint "This crate of water is empty"; }; hint "3"; if(foodObject getVariable "water" > 0) then { hint "Wait..."; sleep 1; hint "OK"; sleep 3; player setVariable["water", (player getVariable "water")+1,true]; foodObject setVariable["water", (foodObject getVariable "water")-1,true]; if(foodObject getVariable "water" > 1) then { hint format ["You take a bottle of water, there are %1 left", foodObject getVariable "water"]; }; if(foodObject getVariable "water" == 1) then { hint "You take a bottle of water, there is 1 left"; }; if(foodObject getVariable "water" <= 0) then { hint "You take the last bit of water"; }; }; Edited some code from the last post
  2. While i'm editing Wasteland, i've added water barrels, but with this script, when someone takes water from the barrel, it takes 1 from every barrel. What should I edit to take only 1 from that certain barrel? foodCreation.sqf // @file Version: 1.0 // @file Name: Script Name // @file Author: [404] Deadbeat // @file Created: DD/MM/YYYY HH:MM // @file Args: if(!X_Server) exitWith {}; _objPos = _this select 0; _Objtype = foodContainers select (random (count foodContainers - 1)); _obj = createVehicle [_Objtype,_objPos,[], 10,"None"]; _randomnum = floor(random 4); // Random # up to 4 foodObject = _obj; if(_Objtype == "Land_Barrelwater_F") then { _obj setVariable["water",_randomnum,false]; // Gives 3 _obj addAction ["Take water","client\digestion\thirstConsume.sqf","",1,false,true,"","(_target distance _this) < 3"]; }; _obj setpos [getpos _obj select 0,getpos _obj select 1,0]; thirstConsume.sqf if(foodObject getVariable "water" <= 0) exitWith { hint "This crate of water is empty"; }; if(foodObject getVariable "water" > 0) then { hint "Wait..."; sleep 10; hint "OK"; sleep 3; player setVariable["water", (player getVariable "water")+1,true]; foodObject setVariable["water", (foodObject getVariable "water")-1,true]; hint format ["You take a bottle of water, there is %1 left", [foodObject getVariable "water"]]; };
  3. So, i'm not exactly sure how to do this I want to add 1 of _obj to the current variable. I've got this _obj setVariable["water",5,true]; I'm trying to do something along the lines of _obj setVariable["water", count "water" +1,true]; (I know the above code is terribly wrong, but it's just for an example if you didn't understand the question) Edit: PROBLEM SOLVED player setVariable["water", (player getVariable "water")+1,true];
  4. Why don't you do something like "putTrig2 = 1;" in Trig1's act and in Trig1 you put "putTrig2 == 1" in Trig2's Condition
  5. For removing on players: _man = _this select 0; _man removeMagazine "1Rnd_Smoke_Grenade_shell"; _man removeMagazine "1Rnd_SmokeBlue_Grenade_shell"; _man removeMagazine "1Rnd_SmokeGreen_Grenade_shell"; _man removeMagazine "1Rnd_SmokeOrange_Grenade_shell"; _man removeMagazine "1Rnd_SmokePurple_Grenade_shell"; _man removeMagazine "1Rnd_SmokeRed_Grenade_shell"; _man removeMagazine "1Rnd_SmokeYellow_Grenade_shell"; For gearboxes, go into the gearbox script and remove where it adds smokes.
  6. Both unsigned and hacked work for my server, but i've never tested OnDifferentData
  7. http://www.mediafire.com/?1pgeddvbbalr956 Been learning scripting through 404's wasteland. I've got a lot to learn.. The script is in Custom\toggleAtmosphere.sqf
  8. if (Atmo |#|== true) then { Atmo = false; fals...' entry,Display (dialog,Control,Network Object, Team member,Task,Location That's the error I get :(
  9. I did the methods you suggested, and now it doesn't crash :) but, once again, i'm running into problems :( I've got an init.sqf with _Atmo == false; And a script with this in it... #include "init.sqf"; if (_Atmo == true) then { _Atmo = false; false execVM "Atmo.sqf"; } else { true execVM "Atmo.sqf"; _Atmo = true } I keep getting an error "|#|_Atmo == false;#line 1"... Error ==: Undefined fariable in expression: _atmosphere What am I doing wrong? I've tried doing _Atmo == 0; but nothing seems to work for me Edit - So I edited the code a bit, practicing my trash coding skills, and I'm getting errors on "Atmo = 1;", Why though? if(Atmo == 1) exitWith { player globalChat "ACTION"; }; Atmo = 0; if(Atmo == 0) then { hint "1"; } else { Atmo = 1; hint "2"; }; ---------- Post added at 09:49 PM ---------- Previous post was at 08:44 PM ---------- Getting super low on the list, doubt anyone will see this.... sooooo....... Badabump
  10. ayser

    Arma 3 Coding

    Now he's insulting linux users, quick, grab the spears! :cool:
  11. Loved it! :) But now i'm trying to go a little bit further. I'm trying to make it toggle itself.. But I keep getting an error, again, on the "onButtonClick" line. Any clues? onButtonClick = " if (_Atmo == 1) then { _Atmo == 0; false execVM ""Atmo.sqf""; } if (_Atmo == 0 ) then { true execVM ""Atmo.sqf""; _Atmo == 1 } "; Error message: "Config: End of line encountered after onButtonClick" Am I just not able to do all of the if's, and thens? Just 1 line?
  12. I'm trying to make a button, but everytime I try to load up the mission with this bit of code added to it I crash, specifically on the "onbuttonclick" line. How can I fix this? :confused: class btnDistanceAtmo : w_RscButton { text = "Atmo"; onButtonClick = ["true execVM "Atmo.sqf";"]; x = 0.32; y = 0.60; w = 0.125; h = 0.033 * safezoneH; };
  13. Well, if you want to make it simple and make the player do the animation once, then put this in his init this playMove "InBaseMoves_table1"; If you want him to repeat it, make a .sqf and call it in his init with this while {true} do { if (animationState this != "InBaseMoves_table1") then { this switchMove "InBaseMoves_table1"; }; } It will work, but I tried using a switchmove on your animation, and it didn't activate, so it might be something with the animation, if not, then i'm not sure :confused:
  14. "For an immediate transition use switchMove. This command must be executed after mission start. If you place it into init.sqs or in the Init field of some unit, it will not work. Just add a little delay (~0.001) and then place the command." ~ BIWIKI
×