Jump to content

7erra

Member
  • Content Count

    753
  • Joined

  • Last visited

  • Medals

Everything posted by 7erra

  1. Another stat which determines whether you can carry a "thing" or not is the allowedslots[]={} entry in the config. This only applys for weapons but for the sake of completeness I had to mention it. https://community.bistudio.com/wiki/CfgWeapons_Config_Reference#allowedslots.5B.5D.3D.7B.7D
  2. 7erra

    Errors

    _dog = createAgent ["Fin_random_F", getPos player, [], 5, "CAN_COLLIDE"]; _dog setVariable ["BIS_fnc_animalBehaviour_disable", true]; dogMove = [_dog] spawn { params ["_dog"]; while {alive _dog} do { _speed = abs (speed player); _distance = _dog distance player; _anim = ""; switch (true) do { case (_speed == 0 && _distance <= 10): {_anim = "Dog_Stop";}; case (_speed > 0 && _speed < 18): {_anim = "Dog_Walk";}; case (_speed >= 18 OR _distance > 10): {_anim = "Dog_Sprint";}; }; _dog switchMove _anim; _dog moveTo getPos player; waitUntil {sleep 1; round _speed != round speed player OR _distance > 10}; }; }; Should work. Though I'm not entirely satisified with the case when you are not moving but the dog is over 10m away. It plays the animation once every second.
  3. 7erra

    Errors

    Just what @sarogahtyp said. Instead of the code above use while {alive _dog && speed player == 0} do { _dog moveTo getPos player; sleep 0.5; };
  4. Missing }; at the end. Correct: if (headgear player in _101Restricted) then { if (({player isKindOf _x} count _clone101) < 1) then { removeHeadgear player; // Add custom message if needed }; };
  5. player remoteControl _unit; _unit switchCamera "internal"; objNull remoteControl _unit; // removes the remoteControlling // whatever happens in between player switchCamera "internal"; // returns to the player
  6. First of all you have to define anyone who's allowed to have a certain vest: _vestBearer = ["B_officer_F","unit_classname"]; Then you can add the restricted vests: _restrictedVests = ["vest_classnames",...]; And now add this to the while loop: if (vest player in _restrictedVests) then { if (({player isKindOf _x} count _vestBearer) < 1) then { removeVest player; // Add custom message if needed }; }; You can define your own message with #define VEST_MSG "*your description*" ... // Call it with: titleText [VEST_MSG, "PLAIN",3];
  7. The problem with EH is the locality. The vehicle has to be local when the eventhandler is added, meaning if you put this addEventhandler ["ehName", {_code}]; in the init I am not sure if the eh will fire when the driver is not the server (can't test, no MP). But if it actually works I'd use the HandleDamage eventhandler since the selection of the hit part is already passed into the script. But watch out here's an example video from @killzone_kid what might happen:
  8. Here's some code: this addMPEventHandler ["MPHit", { _heli = _this select 0; if ( _heli getHit "tail_rotor_hit" > 0) then { _heli setHit ["tail_rotor_hit",0]; }; }]; This prevents the tail rotor from getting shot off. The only problem is that collisions are not registered as a "hit".
  9. Here is a topic about detecting wether the arsenal is opened or closed: A more simple but fragile approach woul be this one: waitUntil {!isNull findDisplay -1}; systemChat "ARSENAL"; waitUntil {isNull findDisplay -1}; systemChat "NO ARSENAL"; The problem is that the arsenal has no IDD and therefore might as well interfere with other displays which share the same IDD (-1). However the code works ¯\_(ツ)_/¯. Or even better: waitUntil {! (isNull ( uiNamespace getVariable [ "BIS_fnc_arsenal_cam", objNull ] )) }; // ARSENAL waitUntil { isNull ( uiNamespace getVariable [ "BIS_fnc_arsenal_cam", objNull ] ) }; // NO ARSENAL Detects when the arsenal is closed.
  10. Does the gun already exist (placed in editor)? If so then you'll have to use this instead of _gun. And only put this in the init: [this, -45, 45] call BIS_fnc_setPitchBank;
  11. Use the command that @das attorney recommended:
  12. if you want to RETURN the rotation then you can use either BIS_fnc_getPitchBank or vectorDir and vectorUp.
  13. To open the arsenal on startup use this in the init.sqf (SP) or initPlayerLocal.sqf (MP & SP): waitUntil {isPlayer player}; sleep 1; // Anything less will spawn you as a random unit (WTF?) ["Open",true] spawn BIS_fnc_arsenal; What are those scripted events? on first guess I'd use conditions to suspend other scripts. The task system is what you are looking for. Also addWaypoint for waypoints cutText addAction for each topci (or a GUI just because I'm a big fan of those) Depends on what you want to achieve. There is already a system (Garbage Collector) ingame.
  14. Ah okay so you are using the BIS_fnc_taskPatrol. Here is the rewritten function. I only changed the _newPos parameter to evaluate positions on the sea: /* File: taskPatrol.sqf Author: Joris-Jan van 't Land Description: Create a random patrol of several waypoints around a given position. Parameter(s): _this select 0: the group to which to assign the waypoints (Group) _this select 1: the position on which to base the patrol (Array) _this select 2: the maximum distance between waypoints (Number) _this select 3: (optional) blacklist of areas (Array) Returns: Boolean - success flag */ //Validate parameter count if ((count _this) < 3) exitWith {debugLog "Log: [taskPatrol] Function requires at least 3 parameters!"; false}; private ["_grp", "_pos", "_maxDist", "_blacklist"]; _grp = _this select 0; _pos = _this select 1; _maxDist = _this select 2; _blacklist = []; if ((count _this) > 3) then {_blacklist = _this select 3}; //Validate parameters if ((typeName _grp) != (typeName grpNull)) exitWith {debugLog "Log: [taskPatrol] Group (0) must be a Group!"; false}; if ((typeName _pos) != (typeName [])) exitWith {debugLog "Log: [taskPatrol] Position (1) must be an Array!"; false}; if ((typeName _maxDist) != (typeName 0)) exitWith {debugLog "Log: [taskPatrol] Maximum distance (2) must be a Number!"; false}; if ((typeName _blacklist) != (typeName [])) exitWith {debugLog "Log: [taskPatrol] Blacklist (3) must be an Array!"; false}; _grp setBehaviour "SAFE"; //Create a string of randomly placed waypoints. private ["_prevPos"]; _prevPos = _pos; for "_i" from 0 to (2 + (floor (random 3))) do { private ["_wp", "_newPos"]; //_newPos = [_prevPos, 50, _maxDist, 1, 0, 60 * (pi / 180), 0, _blacklist] call BIS_fnc_findSafePos; _newPos = [_prevPos, 50, _maxDist, 1, 2, 60 * (pi / 180), 0, _blacklist] call BIS_fnc_findSafePos; // Changed watermode parameter from 0 (only land) to 2 (only water) _prevPos = _newPos; _wp = _grp addWaypoint [_newPos, 0]; _wp setWaypointType "MOVE"; _wp setWaypointCompletionRadius 20; //Set the group's speed and formation at the first waypoint. if (_i == 0) then { _wp setWaypointSpeed "LIMITED"; _wp setWaypointFormation "STAG COLUMN"; }; }; //Cycle back to the first position. private ["_wp"]; _wp = _grp addWaypoint [_pos, 0]; _wp setWaypointType "CYCLE"; _wp setWaypointCompletionRadius 20; true Let me know if this worked
  15. When evaluating the position for the waypoint you can use surfaceIsWater to check if the position is reachable by boat.
  16. 7erra

    Combat Arena Concept

    The addSwitchableUnit command is SP only. Use this instead: _caller = _this select 1; _unit = "SoldierWB" createUnit [position AiArena, group player]; player remoteControl _unit; // will remoteControl it, you still will have full control of the player _unit switchCamera "internal"; // fix the camera to the "vehicle" waitUntil {sleep 1; !alive _Unit}; // Unit dead check objNull remoteControl _unit; // removes the remoteControlling player switchCamera "internal"; // returns to the player Also if you are using an addAction the waitUntil command won't work because the script doesn't support supsension.
  17. The setvectorup command is a bit hard to understand (at least for me). I prefer to use BIS_fnc_setPitchBank to rotate an object. So instead of your code I'd use: lwh = "Library_WeaponHolder" createVehicle position this; lwh addWeaponCargoGlobal ["arifle_katiba_f", 1]; lwh enableSimulation false; lwh setPos (this modelToWorld [0, 0, 0.5]); lwh setdamage 1; [lwh, 45, -45] call BIS_fnc_setPitchBank; deleteVehicle this; and change 45 and -45 to your needs.
  18. Put this in the onPlayerRespawn.sqf: player setObjectTextureglobal [0,"textures\texturefilename.paa"]; You can also make use of the getObjectTextures command if you need to. The getUnitLoadout command only saves containers and items but not textures.
  19. Hello everyone, here is a really simple function that I put together: /* Author: Terra Description: Converts the elements of an array into a string Parameter(s): 0: ARRAY - array of elements of any type 1 (Optional): STRING - seperator between elements (default: ", ") Returns: STRING */ params [ ["_array", [],[[123]]], ["_seperator", ", ", ["123"]] ]; _str = format ["%1", _array select 0]; { private _addString = _x; if (typeName _addString != typeName "123") then {_addString = str _addString}; _str = _str +_seperator +_addString; } forEach (_array -[_array select 0]); _str Just some code that I wrote down while working on another project. Feel free to modify and comment.
  20. Oh. I knew there was this command but I barely used it. Well then nevermind :)
  21. Hello ArmA community, I was working on a dialog with information about different weapons. Now I've encountered a problem with the fire rate in the config because I can't get to a good formula. What I found so far: This document: https://docs.google.com/spreadsheets/d/1w2LK46k9qXPlFOB7d_-N3AI_WAbvCMUY7RYqGBqkVMI/edit?rm=full#gid=4. It contains the fire rate of all weapons The fire rate is bound to the frame rate The config entry is reloadTime = 0.x (eg. configfile >> "CfgWeapons" >> "arifle_Katiba_F" >> "Single" >> "reloadTime": 0.075) This BIKI entry description: "Delay (in seconds) between each individual shot." This description: "Rate of fire is limited in game. Maximum bullets fired per frame is 1, so in 20FPS (rate 0.05) it is 1200 bullets per minute. [...] Hopefully someone can help me, Terra
  22. Thanks for the answer. Why is it limited though? To prevent hackers from fiddling with thr ROF or even out the chances between low spec gamers and NASA employees?
  23. Thanks for the explanation. I have dealt with dialogs before but it always annoyed me that they weren't looking like the rest of the game. It's just a question about asthetics and continuity. But thanks to @Larrow and the BIS_fnc_exportGuiBaseClasses my dialog looks way more like the game now. Only one thing I noticed is that the IGUIBack class is not included even though the ingame GUI Editor offers this control... Thanks to all of you again!
  24. Coming back to this: I have tried to include these classes but all i get is an empty screen whenever i try to open a dialog even though the mouse pointer is there. Here is my setup: description.ext: #include "defines_A3.hpp" #include "TEST_HPP.hpp" defines_A3.hpp: class IGUIBack; class RscPicture; class RscFrame; class RscText; class RscEdit; class RscListbox; class RscControlsGroup; class RscCombo; class RscButton; class RscStructuredText; class RscButtonMenu; TEST_HPP.hpp (just one of many tests, from @MKD3-FHI above): When I use my own defines it works: defines.hpp: Hopefully someone can help me :S
×