Jump to content

Horner

Member
  • Content Count

    627
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by Horner

  1. For a script I'd do this. Start off with this in it's init line. this setFuelCargo 0; this setVariable ["Fuel",10,true]; null = this addAction ["Refuel","refuel.sqf",]; In refuel.sqf you could use something along the lines of. private["_tank","_vcls","_vcl","_remFuel"]; _tank = _this select 0; _vcls = nearestObjects [getPos player, ["LandVehicle","Air","Ship","Tank"], 5]; if (count _vcls < 1) exitWith {}; _vcl = _vcls select 0; if (fuel _vcl > 0.95) exitWith {}; if (_tank getVariable "Fuel" <= 0) exitWith {hint "Tank out of fuel!"}; _remFuel = 1 - fuel _vcl; _tank setVariable ["Fuel",(_tank getVariable "Fuel") - _remFuel,true]; _vcl setFuel 0; hint "Refueling..."; sleep 5; hint "Vehicle Refueled!"; _vcl setFuel 1; You can add other features using a similar system, Hope this helped.
  2. Player means the character of the client the script is running on.
  3. Not quite sure, it may be something to do with SQS's compatibility with FSM, or lack-there-of in this case?
  4. This is the current setup. _vcl = vehicle player; _maxSpeed = [_vcl] call LP_Vcl_fnc_getVclSpeed; _maxSpeed = _maxSpeed + ((_vcl getVariable "SpeedUpgrade") * 10); _speed = speed _vcl; _vel = velocity _vcl; _add = 1; _vcl setVelocity [(_vel select 0) * _add, (_vel select 1) * _add, (_vel select 2) * 0.99]; This is run from an onKeyPress display EH, I've tried a lot of different methods and I just can't get a product I'm happy with. I'd like to make it so the variable _add is calculated, so that according to the speed and maxSpeed of the vehicle it makes it so that the acceleration (or value) of _add drops as the speed gets higher. I'm not a math wiz in any way but this is the simplest thing I could think of for you guys to base your ideas off of. _add = 1 + (_maxSpeed - _speed) / 1000; This would always be under 1.2, which is a fairly high acceleration rate in arma, again, I'd like to make it so as the speed gets higher the acceleration decreases. As in if the vehicle has a max speed of 200 kph it would be accelerating faster at 120 kph then at 180 kph. Any insight will help :)
  5. Horner

    Public variables

    If one side consists of the "cops" you could just use something like this, you could run it on the server if (!isServer) exitWith {}; FNC_UpdateCopCount = { private["_iUnit"]; copcount = 0; for "_i" from 0 to (count playableUnits) do { _iUnit = playableUnits select _i; if (side _iUnit == WEST) then { copcount = copcount + 1; }; }; publicVariable "copcount"; }; private["_units"]; while {true} do { _units = playableUnits; [] call FNC_UpdateCopCount; waitUntil {count _units != count playableUnits}; }; To keep track of the number of "cops" assuming they're on blufor, may be a bit too complicated but it should work anyways.
  6. And I'm sure by "Giving Blood" you've lost a lot of us, this is why I suggested you ask this question on the DayZ forums :)
  7. Horner

    Public variables

    You only need to rebroadcast a publicVariable whenever it's value is changed.
  8. Should have been asked in the config section :) Try messing with your requiredAddons[], and add whichever addon your top config entry came from.
  9. Questions about DayZ should be asked on the DayZ forum, my guess is yes, though I've never worked with the DayZ mod (except for playing it back when it first came out, in like, april or march and playing it a few times after that.).
  10. Usually easiest to just use the pbo name for everything, I usually omit addon prefixes when working with scripts and code inside an addon (easiest way).
  11. Welcome to the forums. A quick google search found me several related threads. http://forums.bistudio.com/showthread.php?77669-AI-Respawn-w-waypoints http://www.ofpec.com/forum/index.php?topic=33732.0 http://forums.bistudio.com/showthread.php?77886-Scripting-Help-Respawning-AI-units Norrin seems to have a script that works well for AI respawning, I'd look into that.
  12. 1. Highlight Units/Waypoints 2. Ctrl+C 3. Ctrl+V And you have another unit/group with the same exact waypoints :D
  13. You may have better luck on the DayZ forums.
  14. When adding to an array the value you're adding with needs to be in the form of an array, I didn't understand this at first either. The result will always result with one less set of square brackets (As in, if you add [[]] what will really be added is []) . So.. _arr = []; _arr = _arr + [[1,10],[2,20]]; The value for _arr would actually be [[1,10],[2,20]] instead of [[[1,10],[2,20]]] as you would think, therefore using no brackets will make for an error. (Same applies for strings aswell, makes sense if you think about it but kind of confusing as the concept is adding.)
  15. Horner

    SQF Encryptor

    I guess I was using the term "open source" in more of a literal way instead of what is popularly means, but whatever. Getting sidetracked here, I do have a question though, if you don't return decrypt back to a nil status, can't someone just print out the code in "decrypt.sqf"?
  16. _side = side player; switch _side do { case WEST: { //code and such }; case EAST: { //other code and such }; }; You can do similar for the faction.
  17. Horner

    SQF Encryptor

    Problem with ArmA and encryption is that all code is open source and people can find out exactly how a script/mission works simply by cracking it open. Encryption could be good for things like protecting passwords or usernames to SQL servers or stuff like that, but if you're encrypting a pilot training mission because you don't want another group to use it, that's kind of upsetting to hear....
  18. Not that I know of in a technical aspect, obviously you could just place down similar waypoints, but I know that's too easy of a solution. You can also just put them in a group and not have them follow a certain formation, which would be easiest
  19. Using a position and not an object may have caused arma to keep searching for the nearestObject (nearestObject/nearestObjects are some of the most performance un-friendly commands in arma), so that may have crashed your game.
  20. If no "il_money_stack_500s" is found _cashpile1 will be nil. Assign _cashpile1 as objNull first to get a definite isNull check. _posCashpile1 = getMarkerPos "posCashpile1"; _cashpile1 = objNull; _cashpile1 = nearestObject [_posCashPile1, "il_money_stack_500s"]; if (isNull _cashpile1) then { _cashpile1 = "il_money_stack_500s" createvehicle _posCashpile1; }; EDIT: Since I didn't test this I'll add in something else, not sure if the nearestObject check, if something is not found will it return the value to objNull, therefore it may be best to use a check if the above doesn't work. _posCashpile1 = getMarkerPos "posCashpile1"; _cashpile1 = objNull; if ((count (nearestObjects [_posCashpile1, ["il_money_stack_500s"], 5])) > 0) then { _cashpile1 = nearestObject [_posCashPile1, "il_money_stack_500s"]; }; if (isNull _cashpile1) then { _cashpile1 = "il_money_stack_500s" createvehicle _posCashpile1; };
  21. Very true, I personally just go for a quick way to do things. PVEHs are nice for a lot of things, I just think for small amounts of code such as hints it's easier to use what's already there :)
  22. My point cuel, was that there is already a system in place that BIS developed and there is no sense in making your own, if you want to do things easily. Adding in suggestions, ya know.
  23. You don't need PVEHs or anything like that. BIS is nice enough to add in a Remote Execution function ya'll, learn to use it :) private["_units","_iUnit"]; _units = ["USMC_Soldier_Officer","USMC_Soldier_TL","USMC_Soldier_SL"]; for "_i" from 0 to (count playableUnits) do { _iUnit = playabeUnits select _i; if (typeOf _iUnit in _units) then { [nil,_iUnit,rHINT,"Message to officers and NCOs"] call RE; }; };
  24. If cashpile1 is a handler, as in, if it is used like so... [color="#FF0000"]cashpile1[/color] = "il_money_stack_500s" createVehicle (getPos poscashpile1); Then, you need to be aware that "cashpile1", if not defined before (which is why you're checking isNull), is NOT defined as an object, therefore it will never meet your isNull check because isNull only checks against objects, so if the handler is not assigned to an object then "cashpile1" cannot be checked using isNull. isNull is really only effective for checking to see if an object that you defined before exists. Here is an example. private["_car"]; _car = (nearestObjects [getPos player, ["LandVehicle"], 20] select 0); waitUntil {isNull _car}; hint "_car is null";
×