draoth
Member-
Content Count
74 -
Joined
-
Last visited
-
Medals
Community Reputation
13 GoodAbout draoth
-
Rank
Corporal
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
draoth started following How to keep executing a line of code until a parameter is correct, Setface Custom texture, Code only works for the player that has interacted with it and and 1 other
-
I started creating new textures for vehicles which can easily be swapped using settexture, but now I've created multiple custom face textures. What's the easiest way to apply these textures to npcs in my multiplayer mission?
-
Hey man, sorry to bother you but I'm wondering if you could take another look at my trigger problem. I tried so much different things it's giving me a headache.
-
unsolved Code only works for the player that has interacted with it
draoth replied to draoth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm still stuck, does anyone have an idea on how to properly do this? -
unsolved Code only works for the player that has interacted with it
draoth replied to draoth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
@cidfr Thanks! I didn't think of setting the variables to the trigger. I'm getting closer, but now both players can interact with the box making it disappear, but only the first player (tested it with about 10 boxes for both the client and the host) that interacts with the boxes gets the money from all the boxes that are being picked up. So: player1 picks up a box: hint appears, box disappears, money gets added now player2 picks up a box and: hint appears for the player1, box disappears and the player1 gets the money. It all depends on the player who picks up the box the first time. Also, the marker doesn't get deleted now for some reason. Here is my complete updated script: BoxAmount = 0; for "_i" from 1 to 50 do { _Mcolor = "ColorGreen"; _Mtext = "$50"; _MMoney = 0; _quality = [1,2,3] selectRandomWeighted [0.1,0.2,1.3]; if (round _quality == 1) then { _Mcolor = "ColorWhite"; _Mtext = "$500"; _MMoney = 500; }; if (round _quality == 2) then { _Mcolor = "ColorYellow"; _Mtext = "$200"; _MMoney = 200; }; if (round _quality == 3) then { _Mcolor = "ColorGreen"; _Mtext = "$100"; _MMoney = 100; }; //hint format ["%1",_quality]; private _types = [ "BUILDING", "BUNKER", "BUSSTOP", "CHAPEL", "CHURCH", "FORTRESS", "HOSPITAL", "HOUSE", "LIGHTHOUSE", "POWERSTATION", "WATERTOWER" ]; _allBuildings = nearestTerrainObjects [[14000,18000], _types, 50000, false, true]; _allPositions = []; _allBuildings apply {_allPositions append (_x buildingPos -1)}; _rndPos = selectRandom _allPositions; _box = "Land_PaperBox_01_small_closed_brown_f" createVehicle [_rndPos select 0, _rndPos select 1, (_rndPos select 2) + 3]; _Mname = "marker" + str _i; [_Mname, _rndPos, _Mcolor, _Mtext, _box, _MMoney] spawn { _Mname = _this select 0; _rndPos = _this select 1; _Mcolor = _this select 2; _Mtext = _this select 3; _box = _this select 4; _MMoney = _this select 5; ["Hello"] remoteExec ["hint"]; _dropoffmarker = createMarker [_Mname, _rndPos]; _dropoffmarker setMarkerShape "ICON"; _dropoffmarker setMarkerType "mil_box"; _dropoffmarker setMarkerColor _Mcolor; _dropoffmarker setMarkerText _Mtext; private _Boxtrg = createTrigger ["EmptyDetector", _rndPos, true]; _Boxtrg setTriggerArea [2, 2, 0, false]; _Boxtrg setTriggerActivation ["ANYPLAYER", "PRESENT", true]; _Boxtrg setVariable ["_mMoney", _MMoney]; _Boxtrg setVariable ["_box",_box]; _Boxtrg setVariable ["_dropoffmarker",_dropoffmarker]; _Boxtrg setTriggerStatements ["this", " _firstplayer = thisList select 0; private _Amoney = _firstplayer getVariable [format['_Amoney_%1', _firstplayer],0]; private _MMoney = thisTrigger getVariable [ '_mMoney', 0]; private _box = thisTrigger getVariable '_box'; private _dropoffmarker = thisTrigger getVariable deleteVehicle _box; deleteMarker _dropoffmarker; hint format ['You picked up $%1', _MMoney]; _Amoney = _Amoney + _MMoney; _firstplayer setVariable [format['_Amoney_%1', _firstplayer], _Amoney]; deleteVehicle thisTrigger; ",""]; //private _Amoney = player getVariable [format["_Amoney_%1", player],0]; //while {true} do { //if (player inArea _Boxtrg == true) exitWith { //deleteVehicle _box; //deleteMarker _dropoffmarker; //deleteVehicle _Boxtrg; //_Amoney = _Amoney + _MMoney; //hint format ["You picked up $%1", _MMoney]; //player setVariable [format["_Amoney_%1", player], _Amoney]; //}; //sleep 2; //}; }; }; -
unsolved Code only works for the player that has interacted with it
draoth replied to draoth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This was the setTriggerStatements i wrote: _Boxtrg setTriggerActivation ["ANYPLAYER", "PRESENT", true]; _Boxtrg setTriggerStatements ["this", " _firstplayer = thisList select 0; private _Amoney = _firstplayer getVariable [format['_Amoney_%1', _firstplayer],0]; deleteVehicle _box; deleteMarker _dropoffmarker; hint format ['You picked up $%1', _MMoney]; _Amoney = _Amoney + _MMoney; _firstplayer setVariable [format['_Amoney_%1', _firstplayer], _Amoney]; ",""]; But when picking up the box it just says: "you picked up $any%" and the variable wouldn't get updated (edit: It turns out that this also only works for the host and the variable does change but it sets it back at 0) -
unsolved Code only works for the player that has interacted with it
draoth replied to draoth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This was the setTriggerStatements i wrote: _Boxtrg setTriggerActivation ["ANYPLAYER", "PRESENT", true]; _Boxtrg setTriggerStatements ["this", " _firstplayer = thisList select 0; private _Amoney = _firstplayer getVariable [format['_Amoney_%1', _firstplayer],0]; deleteVehicle _box; deleteMarker _dropoffmarker; hint format ['You picked up $%1', _MMoney]; _Amoney = _Amoney + _MMoney; _firstplayer setVariable [format['_Amoney_%1', _firstplayer], _Amoney]; ",""]; But when picking up the box it just says: "you picked up $any%" -
unsolved Code only works for the player that has interacted with it
draoth replied to draoth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I think you're right. So you recommend to use triggers for this, what would your approach be? In my first version I used a trigger with (player inArea _boxtrigger) instead of (player distance _box < 5) which also only worked for one person. I tried to use setTriggerStatements and executing the code that way but that didn't work either unfortunately. -
unsolved Code only works for the player that has interacted with it
draoth replied to draoth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
If all players execute that script themselves, then the script would compare the player from the machine it's running on to the _box, correct? So, why when the script run on all clients and someone picks up a box, the script assumes the "player" to be the one that picked it up first? if (player distance _box < 5) exitWith { deleteVehicle _box; deleteMarker _dropoffmarker; _Amoney = _Amoney + _MMoney; hint format ["You picked up $%1", _MMoney]; player setVariable [format["_Amoney_%1", player], _Amoney]; -
unsolved Code only works for the player that has interacted with it
draoth replied to draoth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Yeah you are right, I usually do but this time I just wrote the code just so me and my friends could quickly play the new gamemode. The boxes seem to spawn normally and there isn't any errors thrown from that line. almost everything works. Only thing that doesn't is that only the first player that picks up the money can pick up any money during our session. -
unsolved Code only works for the player that has interacted with it
draoth posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm currently working on a money system for a gamemode I made for my friends and I. Boxes spawn all over the map and when a player gets close to it; he receives some money. The only problem I have with this script is that it only seems to work for the player who interacts with the box for the first time. This code is part of a sqf which is executed from the init.sqf. Does anyone have any idea why it doesn't work for all players in the server but only for the first player who picks up a box? BoxAmount = 0; for "_i" from 1 to 50 do { _Mcolor = "ColorGreen"; _Mtext = "$50"; _MMoney = 0; _quality = [1,2,3] selectRandomWeighted [0.1,0.2,1.3]; if (round _quality == 1) then { _Mcolor = "ColorWhite"; _Mtext = "$500"; _MMoney = 500; }; if (round _quality == 2) then { _Mcolor = "ColorYellow"; _Mtext = "$200"; _MMoney = 200; }; if (round _quality == 3) then { _Mcolor = "ColorGreen"; _Mtext = "$100"; _MMoney = 100; }; //hint format ["%1",_quality]; private _types = [ "BUILDING", "BUNKER", "BUSSTOP", "CHAPEL", "CHURCH", "FORTRESS", "HOSPITAL", "HOUSE", "LIGHTHOUSE", "POWERSTATION", "WATERTOWER" ]; _allBuildings = nearestTerrainObjects [[14000,18000], _types, 50000, false, true]; _allPositions = []; _allBuildings apply {_allPositions append (_x buildingPos -1)}; _rndPos = selectRandom _allPositions; _box = "Land_PaperBox_01_small_closed_brown_f" createVehicle [_rndPos select 0, _rndPos select 1, (_rndPos select 2) + 3]; _Mname = "marker" + str _i; [_Mname, _rndPos, _Mcolor, _Mtext, _box, _MMoney] spawn { _Mname = _this select 0; _rndPos = _this select 1; _Mcolor = _this select 2; _Mtext = _this select 3; _box = _this select 4; _MMoney = _this select 5; _dropoffmarker = createMarker [_Mname, _rndPos]; _dropoffmarker setMarkerShape "ICON"; _dropoffmarker setMarkerType "mil_box"; _dropoffmarker setMarkerColor _Mcolor; _dropoffmarker setMarkerText _Mtext; private _Amoney = player getVariable [format["_Amoney_%1", player],0]; while {true} do { if (player distance _box < 5) exitWith { deleteVehicle _box; deleteMarker _dropoffmarker; _Amoney = _Amoney + _MMoney; hint format ["You picked up $%1", _MMoney]; player setVariable [format["_Amoney_%1", player], _Amoney]; }; sleep 2; }; }; }; -
I'm looking for a way to disable vehicle death match
draoth posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Is there a way to disable vehicles from doing damage by driving over units? Thanks. -
How to keep executing a line of code until a parameter is correct
draoth replied to draoth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Fantastic, Thank you! -
How to keep executing a line of code until a parameter is correct
draoth replied to draoth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
The problem is, i want it to check if the random location is close to tot the player and if that's the case of should generate a new location until it's out of range of the players. -
How to keep executing a line of code until a parameter is correct
draoth posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm trying to create a random unit spawn script but when i'm using my script the other player can see the units spawning if he's at the right distance. _Randomlocation = [[selectrandom [player1,player2], 1000, 1500, 3, 0, 20, 0] call BIS_fnc_findSafePos] ; I'd like to know a way i can keep executing this script until the distance with every player is >200. Is there a efficient way to do this? -
Trouble with trying to list every player on a side.
draoth replied to draoth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks man, that did it!