draugar
Member-
Content Count
15 -
Joined
-
Last visited
-
Medals
Community Reputation
0 NeutralAbout draugar
-
Rank
Private First Class
-
Player HUD Scripting - a little help needed
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I figured it out. The HUD was being called from two different places. -
Player HUD Scripting - a little help needed
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Anyone able to take a look at this for me? -
Player HUD Scripting - a little help needed
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
cloud8_HUD = { waitUntil {!isNull player}; if (!local Player) exitWith {}; private ["_pDamage", "_status"]; while {true} do { sleep 0.1; _pDamage = damage player; _status = ""; switch (true) do { case (_pDamage <= 0.2): {_status = "icons\c8HUD\damage_g.paa";[_status, false] spawn cloud8_Player_HUD;waitUntil {damage player > 0.2};}; case (_pDamage > 0.2 && _pDamage <= 0.4): {_status = "icons\c8HUD\damage_y.paa";[_status, false] spawn cloud8_Player_HUD;waitUntil {damage player <= 0.2 || damage player > 0.4};}; case (_pDamage > 0.4): {_status = "icons\c8HUD\damage_r.paa";[_status, false] spawn cloud8_Player_HUD;waitUntil {damage player <= 0.4};}; }; }; }; cloud8_HUD1 = { waitUntil {!isNull player}; if (!local Player) exitWith {}; private ["_pHunger", "_status"]; while {true} do { sleep 0.1; _pHunger = life_hunger; _status = ""; switch (true) do { case (_pHunger >= 80): {_status = "icons\c8HUD\hunger_g.paa";[_status, false] spawn cloud8_Player_HUD;waitUntil {life_hunger < 80};}; case (_pHunger >= 20 && _pHunger < 80): {_status = "icons\c8HUD\hunger_y.paa";[_status, false] spawn cloud8_Player_HUD;waitUntil {life_hunger < 20 || life_hunger >= 80};}; case (_pHunger < 20): {_status = "icons\c8HUD\hunger_r.paa";[_status, false] spawn cloud8_Player_HUD;waitUntil {life_hunger >= 20};}; }; }; }; cloud8_HUD2 = { waitUntil {!isNull player}; if (!local Player) exitWith {}; private ["_pThirst", "_status"]; while {true} do { sleep 0.1; _pThirst = life_thirst; _status = ""; switch (true) do { case (_pThirst >= 80): {_status = "icons\c8HUD\thirst_g.paa";[_status, false] spawn cloud8_Player_HUD;waitUntil {life_thirst < 80};}; case (_pThirst >= 20 && _pThirst < 80): {_status = "icons\c8HUD\thirst_y.paa";[_status, false] spawn cloud8_Player_HUD;waitUntil {life_thirst < 20 || life_thirst >= 80};}; case (_pThirst < 20): {_status = "icons\c8HUD\thirst_r.paa";[_status, false] spawn cloud8_Player_HUD;waitUntil {life_thirst >= 20};}; }; }; }; cloud8_Player_HUD = { disableSerialization; params ["_status"]; while{true} do { if(!message1_active) exitwith { 11 cutRsc ["TAG_C8_display","PLAIN"]; _POPUPCLASS1 = uiNameSpace getVariable ["TAG_C8_display",displayNull]; message1_active = true; _POPUP = _POPUPCLASS1 displayCtrl 520505; _POPUP ctrlSetText _status; sleep 10; message1_active = false; }; if(!message2_active) exitwith { 12 cutRsc ["TAG_C8_display1","PLAIN"]; _POPUPCLASS2 = uiNameSpace getVariable ["TAG_C8_display1",displayNull]; message2_active = true; _POPUP = _POPUPCLASS2 displayCtrl 520506; _POPUP ctrlSetText _status; sleep 10; message2_active = false; }; if(!message3_active) exitwith { 13 cutRsc ["TAG_C8_display2","PLAIN"]; _POPUPCLASS3 = uiNameSpace getVariable ["TAG_C8_display2",displayNull]; message3_active = true; _POPUP = _POPUPCLASS3 displayCtrl 520507; _POPUP ctrlSetText _status; sleep 10; message3_active = false; }; sleep 0.05; }; }; -
Player HUD Scripting - a little help needed
draugar posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
This is what I have so far. http://pastebin.com/HEYcH7tq It does everything I need it to do, like display the icons when they player stats change. It aligns them to one side, and if there is more that three, it waits for the three to disappear before it displays the next three. The problem is every time it needs to display an I icon, 2 of the same appear right after each other. So when 2 need to show up, it actually displays 3, then when they clear it displays the remaining one when the first 3 are gone. Let me know if more information is needed, and thank you in advance. -
draugar started following Questions about "animationSources" for vehicles.
-
Questions about "animationSources" for vehicles.
draugar posted a topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
I'm looking for some insight into why a vehicle won't hold a subclass listed under animationSources. I have defined a subclass of "ani_lightbar" which is a common class for vehicles that have a lightbar attached. The code is below: class AnimationSources: AnimationSources { class ani_lightbar { source = "user"; animPeriod = 1; initPhase = 0; }; }; I'm using these UserActions to check and change the initPhase when asked to: class UserActions { class codeOne { displayName = "<t color='#0000ff'>Lightbars Off</t>"; position = "drivewheel"; radius = 100; condition = "driver this == player && (this animationPhase 'ani_lightbar' > 0.1)"; statement = "this animate ['ani_lightbar', 0]"; onlyForplayer = 1; }; class codeTwo { displayName = "<t color='#0000ff'>Lightbars On</t>"; position = "drivewheel"; radius = 100; condition = "driver this == player && (this animationPhase 'ani_lightbar' == 0)"; statement = "this animate ['ani_lightbar', 1 ]"; onlyForplayer = 1; }; }; I've studied the config and other configs that use the same method and have not been able to figure out the problem. I've changed the initPhase value to "1", or another number, and when I go in game to test it with the debug screen, it always returns "0". This is the code I use to test it: hint format ["The animation is %1", cursorTarget animationPhase 'ani_lightbar']; I know the code works because I tried it on other vehicles. I tried it looking at nothing and it always returns "0" too. That's why I think this particular is not holding the animationSource at all. I even tried replacing cursorTarget with player vehicle, and I get the same results. I have tried many times to change the value through, not only the config, but manually with the debug screen using this code: cursorTarget animate ["ani_lightbar",1]; No matter what I try it will not hold the initPhase value. -
Trying to find closest object behind player vehicle
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
That worked Larrow! Thank you again. -
Trying to find closest object behind player vehicle
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Because one, or more, of the vehicles is not fully recognized with this script, I would like to take a new approach to this. I want to return all vehicles within an 8m radius behind the towtruck. _towpos = vehicle player modelToWorld [0,-6,-1]; _near = nearestObjects [ _towpos, ["Car","Truck","Motorcycle"], 8]; I want to test each vehicle in the array and see if it meets the following criteria: _dir = [vehicle player, _nearest] call BIS_fnc_relativeDirTo; _dir >= 160 && _dir <= 200 Finally, I want it to return the nearest vehicle. I know the sample code is not exactly what I need. I am not very good with dealing with arrays and the foreach loops. -
Trying to find closest object behind player vehicle
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
The vehicle I'm referring to is called A3L_Bus. That is the one that is not working correctly with the script. -
Trying to find closest object behind player vehicle
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Your "Something to play with" script, in post #6, works perfectly on most vehicles. One vehicle in particular does not return the name of the vehicle unless the red line passes through the middle of the vehicle from the side. If I try it from the front or back, it returns "found nothing", even though the red line is buried deep into the model. Any other vehicle I have tried it on, I only have to touch a corner of the visible model to return the name of the vehicle. I tested the non-working model by putting a visible bounding box around it and it looks normal. I don't understand why this vehicle is acting that way. If you can think of any reason why this would be, please share. I also tried the new command "lineIntersectsSurfaces" and it doesn't seem to be working yet. -
Trying to find closest object behind player vehicle
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I have been playing around with both scripts. I was wondering if there was a way for the "lineIntersectsObjs" command, or some similar command, to look for the "boundingbox" of an object, instead of the object itself? _towVehicle = vehicle player; _towVehiclePos = getPosASL _towVehicle vectorAdd [0,0,0.5]; _towCheckEndPos = [ _towVehiclePos, -12, getDir _towVehicle ] call BIS_fnc_relPos; _objs = lineIntersectsObjs [_towVehiclePos, _towCheckEndPos, _towVehicle, objNull, true, 32]; reverse _objs; _vehToTow = { _obj = _x; if ( { _obj isKindOf _x }count ["Car","Truck","Motorcycle"] > 0 ) exitWith { _obj }; }forEach _objs; if !( isNil "_vehToTow" ) then { hint str typeOf _vehToTow; -
Looking for a solution to limit sound
draugar posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I would like to limit sound inside a particular room of a building. Or a particular area. I know there are settings to limit how far your voice carries, but I want to only be able to hear only the players that are within a certain distance of me. I'm looking for someone to point me in the right direct, not necessarily script it for me. Thank you -
Trying to find closest object behind player vehicle
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
you are brilliant. I had to change a few lines of code as the "vectorpoints" check was not working properly. It would not tow the vehicle of course, but when I clicked on the addaction "tow/untow" button again it would bump the vehicle, like I was untowing. Changing the _attachpoint section to a variation of the original fixed it. See below. from this: _attachpoint = { if ((_x select 0) == typeOf _vehToTow) exitWith { _x select 1 }; } foreach A3L_Fnc_TowArray; to this: _attachpoint = []; _lookfor = typeof _vehToTow; { if ((_x select 0) == typeOf _vehToTow) then { _attachpoint = _x select 1; }; } foreach A3L_Fnc_TowArray; Let me know if you see any concerns. Also, I have not played with the bonus code yet. Edited to add this: I just got done playing with the bonus code. Pretty good stuff. Especially for testing purposes. Want to join our dev team? http://www.arma3-life.com/ :) -
Trying to find closest object behind player vehicle
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Larrow, I think I spoke too soon. I can't get it to fit correctly into my script: _veh = _this; _isTowing = _veh getVariable "isTowing"; if (!isNil "_isTowing") then { detach ((vehicle player) getVariable "isTowing"); // Move 2M back _pos = ((vehicle player) getVariable "isTowing") modelToWorld [0,-2,-2]; _pos = [_pos select 0,_pos select 1,1]; ((vehicle player) getVariable "isTowing") setpos _pos; ((vehicle player) getVariable "isTowing") setVariable ["isBeingTowed",nil,true]; (vehicle player) setVariable ["isTowing",nil,true]; } else { _towVehicle = { _towpos = vehicle player modelToWorld [0,_x,0]; _near = nearestObjects [ _towpos, ["Car","Truck","Motorcycle"], 2]; _near = _near - [vehicle player]; if ( count _near > 0 ) exitWith {}; } foreach [-6,-8,-10]; if ( isNil "_towVehicle") exitwith { ["No towable vehicle nearby",20,"red"] call A3L_Fnc_Msg; }; _nearest = _near select 0; if ((vehicle player) animationPhase "Tow" > 0.1) exitwith { ["Towbar is not lowered",20,"red"] call A3L_Fnc_Msg; }; if (locked _nearest > 1) exitwith { ["This vehicle is locked and cannot be towed",20,"red"] call A3L_Fnc_Msg; }; _isTowed = _nearest getVariable "isTowing"; _isBeingTowed = _nearest getVariable "isBeingTowed"; if ((!isNil "_isTowed") OR (!isNil "_isBeingTowed")) exitwith { ["Vehicle is already being towed or is towing another vehicle",20,"red"] call A3L_Fnc_Msg; }; // Get attachpoint _attachpoint = []; _lookfor = typeof _nearest; { if ((_x select 0) == _lookfor) then { _attachpoint = _x select 1; }; } foreach A3L_Fnc_TowArray; if (count _attachpoint == 0) exitwith { ["Unable to retrieve vectorpoints for this vehicle",20,"red"] call A3L_Fnc_Msg; }; _nearest attachto [(vehicle player),_attachpoint]; [[_nearest],"A3L_Fnc_TowtruckVector", true, false] call BIS_fnc_MP; (vehicle player) setVariable ["isTowing",_nearest,true]; _nearest setVariable ["isBeingTowed",true,true]; }; Here is the original script that will allow the tow truck to tow a vehicle that is in front of it, which is what I'm trying to correct: /* File: Tow.sqf Author: Caiden Description: Main handler for attempting to tow/untow a vehicle */ _veh = _this; _isTowing = _veh getVariable "isTowing"; if (!isNil "_isTowing") then { detach ((vehicle player) getVariable "isTowing"); // Move 2M back _pos = ((vehicle player) getVariable "isTowing") modelToWorld [0,-2,-2]; _pos = [_pos select 0,_pos select 1,1]; ((vehicle player) getVariable "isTowing") setpos _pos; ((vehicle player) getVariable "isTowing") setVariable ["isBeingTowed",nil,true]; (vehicle player) setVariable ["isTowing",nil,true]; } else { _near = nearestObjects [(vehicle player), ["Car","Truck","Motorcycle"], 10.5]; _near = _near - [vehicle player]; if (count _near < 1) exitwith { ["No towable vehicle nearby",20,"red"] call A3L_Fnc_Msg; }; if ((vehicle player) animationPhase "Tow" > 0.1) exitwith { ["Towbar is not lowered",20,"red"] call A3L_Fnc_Msg; }; _nearest = _near select 0; if (locked _nearest > 1) exitwith { ["This vehicle is locked and cannot be towed",20,"red"] call A3L_Fnc_Msg; }; _isTowed = _nearest getVariable "isTowing"; _isBeingTowed = _nearest getVariable "isBeingTowed"; if ((!isNil "_isTowed") OR (!isNil "_isBeingTowed")) exitwith { ["Vehicle is already being towed or is towing another vehicle",20,"red"] call A3L_Fnc_Msg; }; // Get attachpoint _attachpoint = []; _lookfor = typeof _nearest; { if ((_x select 0) == _lookfor) then { _attachpoint = _x select 1; }; } foreach A3L_Fnc_TowArray; if (count _attachpoint == 0) exitwith { ["Unable to retrieve vectorpoints for this vehicle",20,"red"] call A3L_Fnc_Msg; }; _nearest attachto [(vehicle player),_attachpoint]; [[_nearest],"A3L_Fnc_TowtruckVector", true, false] call BIS_fnc_MP; (vehicle player) setVariable ["isTowing",_nearest,true]; _nearest setVariable ["isBeingTowed",true,true]; }; -
Trying to find closest object behind player vehicle
draugar replied to draugar's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thank you Larrow, It works beautifully! -
Trying to find closest object behind player vehicle
draugar posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I have been working on this for a week now and have not been able to work out a solution. I want to find the closest vehicle behind my vehicle. I want it to first see if there is a vehicle in the area of 6m behind player vehicle. If it finds one (it may find more than one) I want it to choose the closest. If it doesn't, then I want to see if there is a vehicle in the area of 8m and choose the closest. And so on with 10m. If it doesn't find any vehicles after these three tests, then I want it to give me the hint. I am able to get the tow function to work, but I think it is only using the 10m setting because that is the last one in the array. If you haven't guessed already, I'm new to scripting. _towpos = {vehicle player modelToWorld _x} forEach [[0,-6,0],[0,-8,0],[0,-10,0]]; _near = nearestObjects [(_towpos), ["Car","Truck","Motorcycle"], 2]; _near = _near - [vehicle player]; if (count _near < 1) exitwith { hint "There are no towable vehicles nearby!"; }; _nearest = _near select 0; *edited for formatting