Jump to content

dreadedentity

Member
  • Content Count

    1224
  • Joined

  • Last visited

  • Medals

Everything posted by dreadedentity

  1. dreadedentity

    Hunger/Thirst System (Done but with issues)

    @EGW use systemChat or sideChat to give information to your players. This has an added bonus of players being able to look back at them at any time. :p
  2. dreadedentity

    Help with an action

    Thanks, Iceman. I remember Larrow giving this code to me in a previous topic. I was trying to find a way to add it to the objects themselves without breaking the toggle-ability of them. I just wrote up this small init.sqf, it should be a good starting point for something like this. boxes = []; _playerPos = position player; for "_i" from 0 to 2 do { _position = [((_playerPos select 0) - 5) + (_i * 5), (_playerPos select 1) + 10, 0]; _obj = createVehicle ["Box_NATO_Wps_F", _position, [], 0, "None"]; boxes pushBack [_obj, str _obj]; }; hintSilent format["%1", boxes]; It simply spawns 3 boxes, 10 meters in front of the player, 5 meters apart from each other. Use any map you want, save, then create an init.sqf and drop that code in it. It saves an array of arrays, the first value is the object itself, and the second value is a string of the object's handle (my thinking is that since all of these strings are unique, and addAction handles must be unique this would be a good naming scheme). Going to start messing with the actions now. ---------- Post added at 17:56 ---------- Previous post was at 17:34 ---------- Well, I got it finished, and it was actually a lot easier than I thought. Just put this in your init.sqf. init.sqf boxes = []; actionStatus = false; _playerPos = position player; for "_i" from 0 to 2 do { _position = [((_playerPos select 0) - 5) + (_i * 5), (_playerPos select 1) + 10, 0]; _obj = createVehicle ["Box_NATO_Wps_F", _position, [], 0, "None"]; boxes pushBack [_obj, str _obj]; //Unnecessary _obj addAction ["Pick Up", { if (!actionStatus) then { (_this select 0) attachTo [(_this select 1)]; (_this select 0) setUserActionText [(_this select 2), "Drop"]; }else { detach (_this select 0); (_this select 0) setUserActionText [(_this select 2), "Pick Up"]; }; actionStatus = !actionStatus; },[],1,true,true,"",""]; }; hintSilent format["%1", boxes]; Problem with this is that if you happen to move your mouse over another object, you'll get the option to pick it up, and if you use that action twice you actually will pick it up. But since this is going to be used privately and not in a script I will release, this is where I stop :p EDIT: 2 things I forgot to say. 1. I believe the easiest way by far to do this is to add your action when you create the object so you still have access to the local variable you should be using to refer to the object in your spawning function. An alternative way to do this is to add your created object to a global array with pushBack, then spawn a seperate thread with a while loop that simply waits for the size of the array to change, then adds the action to the last object in the array. 2. Any unit that you want to be able to use the actions needs to have actionStatus declared (not necessarily in init, but before they encounter any situation where the action is available to them). If you use the exact code from above, actionStatus needs to be declared as a boolean.
  3. dreadedentity

    Help with an action

    Yes. I'm trying to play around with it, but I'm really bad with actions
  4. dreadedentity

    Simple Icons

    Thanks. I didn't do any tests in multiplayer, but all of the icon drawing is done locally. It should work for JIP's, as I believe they do run init.sqf at some point. The idea I had behind this was to create a local-area effect, like a UAV flying overhead and relaying enemy positions. The only problem with that is there is no guarantee that JIP's will see the same units because some could have gotten outside the search area, or some could have entered the search area. Even having players standing around in different positions could make them show different units. I may hack together another script that allows you to input an array of OBJECTS and place markers over their heads. In fact, now that I think about it, it probably should have been that way all along. EDIT: I edited the original post with a second script that should be perfect for JIP's EDIT2: @MacintoshRUS it wasn't with the version of the script you saw, at least I don't think it was. I just updated the script to include being able to use custom icons. Since I don't know the effect of using the side command on a non-unit object, I strongly recommend specifying the icon you want to use to prevent the script trying to use it.
  5. dreadedentity

    Simple Icons

    Yes, something like this should work default {drawIcon3D[MISSION_ROOT + "\icons\targetEast.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1];}; Usage: switch (something) do { case a: {}; case b: {}; case c: {}; default {}; }; I'll look into creating a better way to do this, but ideally, you want to put a little code as possible in since it will be running at least 50-60 times per second.
  6. The problem with random numbers is that every client will get a different result, so sometimes one player might hear the enemy yell, and another one won't. Another problem with putting the code in a unit's initialization is that I'm pretty sure unit inits are non-scheduled enviornments (I could be wrong though), this means that using pauses won't work (sleep, waitUntil, etc, it will throw an error). You'll have to use either spawn {code} or execVM "script.sqf" Last thing I saw, you don't have to spawn a thread in your init.sqf if you're going to execVM "script.sqf", execVM already spawns a new thread to not interrupt with script operation. Great work though, and glad you were able to get it done
  7. Like greenfist said time = distance/speed, so solve the equation for time and you'll get distance = time * speed. So fill in the numbers you know, distance = 60s * 100km/h. You'll have to convert hours to seconds, distance = 60s * (google says)0.02777777777km/s Then multiply, 1.6666666662km = 60s * 0.02777777777km/s convert km to meters and then round to the nearest significant figure, 1666.6666662m = 1666 meters I miss physics.
  8. dreadedentity

    Create a Cut Scene Tutorials???

    Something like this? It's very basic and the guy has an extremely annoying microphone, but it could work perfectly depending on your needs.
  9. From what I understand, this isn't possible with only scripting. You'll need to make an addon. I think you have to make a custom configFile. The guys over at the Addon section of the forum should be able to point you in the right direction.
  10. You might be interested in goggles, addGoggles, and removeGoggles. Also, if I remember correctly, if use addGoggles on a unit that has glasses from their preferences equipped, it will just overwrite them. Lastly, for your flowery bandanas on guerrilla units, click here for a full list of headgear and their classnames. Using that webpage in combination with headgear, addHeadgear, https://community.bistudio.com/wiki/removeHeadgear, you should never have to see another flowery bandana again.
  11. First you need to register your sounds in description.ext to use them in the game. Then it is very possible with something like this: _object = NAMEOFMAN; _distance = 10; //player must be within this many meters before the sound will play _random = 5; //equal chance for 0, 1, 2, 3, or 4 if (player distance _object <= _distance) then // <= means 'is less then or equal to', it's not an arrow. { _randomResult = floor(random _random); switch (_randomResult) do { case 0: {_object say3D "sound1";}; case 1: {_object say3D "sound2";}; case 2: {_object say3D "sound3";}; case 3: {_object say3D "sound4";}; case 4: {_object say3D "sound5";}; //you need to manually add more "cases" if you want more than 5 sounds }; }; Personally, I would use playSound3D (click me) over say3D any day because of the control you get over the sound and you don't need to do any extra work except fill out a few more parameters in the command.
  12. You may be interested in these 2 commands velocity, speed
  13. dreadedentity

    how to change unit TAG NAME

    I believe this falls under setIdentity
  14. dreadedentity

    Simple Icons

    Thanks, overall I'm happy with how it turned out. I only wish that I could find the magical algorithm I'm looking for to make accurately sized icons depending on distance from the unit. Also, I hope somebody can find something cool to do with this.
  15. So I'm making a small script that will display icons over the heads of units you specify (by classname). Commented where I get errors. MISSION_ROOT = call { private "_arr"; _arr = toArray __FILE__; _arr resize (count _arr - 8); toString _arr }; //Kudos to Killzone_Kid for this enemies = []; { enemies pushBack _x; }forEach (allMissionObjects "O_SOLDIER_F"); //comment this forEach statement out and all is right { enemies pushBack _x; }forEach (allMissionObjects "O_OFFICER_F"); onEachFrame { { _iSize = (0.5) - (0.01 / (player distance _x)); hintSilent format ["%1", player distance _x]; _unitPos = [(getPos _x) select 0, (getPos _x) select 1, ((getPos _x) select 2) + 2]; // if (!alive _x) then //generic error here for some reason // { drawIcon3D[MISSION_ROOT + "target.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, "Kill"]; // }; }forEach enemies; }; Not sure why the first forEach throws an "Error Zero Divisor" error. Also not sure why my alive check throws a generic error. Any help is appreciated. You can download "target.jpg" here (Dropbox) EDIT: How do I use the passed arguments with BIS_fnc_addStackedEventHandler? I rewrote this code using it because of the overwrite issues Larrow explained to me. MISSION_ROOT = call { private "_arr"; _arr = toArray __FILE__; _arr resize (count _arr - 8); toString _arr }; //Kudos to Killzone_Kid for this _enemies = []; { _enemies pushBack _x; }forEach (allMissionObjects "O_SOLDIER_F"); { _enemies pushBack _x; }forEach (allMissionObjects "O_OFFICER_F"); ["eachFrame", "onEachFrame", { _enemies = _this select 3; //Error Zero Divisor because _this select 3 doesn't exist { _iSize = (0.5) - (0.01 / (player distance _x)); hintSilent format ["%1", player distance _x]; _unitPos = [(getPos _x) select 0, (getPos _x) select 1, ((getPos _x) select 2) + 2]; // if (!alive _x) then // { drawIcon3D[MISSION_ROOT + "target.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, "Kill"]; // }; }forEach _enemies; }, [_enemies]] call BIS_fnc_addStackedEventHandler; EDIT2: I replaced _this select 3 with _this select 0 and everything seemed to work fine, but there's now an "Error Zero Divisor" error in _iSize = (0.5) - (0.01 #/ (player distance _x)); (error location shown with "#" just like how -showscripterrors works). Uncommenting the alive check breaks everything again.
  16. dreadedentity

    Error zero divisor & Generic Error

    Not sure if it was a timing issue like you guys said but adding waitUntil {time > 0}; at the beginning of the script didn't/couldn't hurt. @Larrow I actually was a "O_SOLDIER_F" while testing, because I didn't want to get shot at. So it makes sense that (player distance player) = 0 I'm going to throw some more things around in here and then I'll probably release it in 1-2 hours.
  17. dreadedentity

    Error zero divisor & Generic Error

    Changed my pushBack's to "_enemies set [count _enemies, _x];" then previewed again. It seems the first "Error Zero Divisor" was being caused by using a normal onEachFrame function because now that I'm using a stacked event handler, that error cleared up and the swapped code had no effect. Error Zero Divisor still exists in the "_iSize" variable declaration. EDIT: I was only using pushBack because it's about 43% faster than set (read notes)
  18. Sorry, I'm really just too inexperienced with multiplayer scripting. We'll just have to wait for someone more experienced to come along and help us out. I'm interested in the answer now, too.
  19. dreadedentity

    Error zero divisor & Generic Error

    I think they might be related also, did some more testing and edited my original post.
  20. dreadedentity

    Power outage

    Try it now, I had to do something similar in a different script I wrote. I had to look at that old script to see how I took the trigger position. forEach nearestObjects [_trigger, _objectArray, 5000]; replace with forEach nearestObjects [getPos _trigger, _objectArray, 5000]; It should work after this, I made a typo
  21. dreadedentity

    Power outage

    Since you're using the trigger to run a script, you need to pass the variables to the script when you run it. Take this: null = [thisTrigger] execVM "powerOut.sqf" And this: _trigger = _this select 0; _objectArray = ["Lamps_Base_F", "PowerLines_base_F", "Land_PowerPoleWooden_F", "Land_LampHarbour_F", "Land_LampShabby_F", "Land_PowerPoleWooden_L_F", "Land_PowerPoleWooden_small_F", "Land_LampDecor_F", "Land_LampHalogen_F", "Land_LampSolar_F", "Land_LampStreet_small_F", "Land_LampStreet_F", "Land_LampAirport_F", "Land_PowerPoleWooden_L_F"]; { _x setHit ["light_1_hitpoint", 0.97]; _x setHit ["light_2_hitpoint", 0.97]; _x setHit ["light_3_hitpoint", 0.97]; _x setHit ["light_4_hitpoint", 0.97]; } forEach nearestObjects [getPos _trigger, _objectArray, 5000]; Come on JShock you knew the answer to that! :p
  22. Rain and clouds have a local effect so that code will need to be run on every client in a mission. Put it in your init.sqf
  23. dreadedentity

    Power outage

    KK's code works The only problem is that the spotlights on the airfields actually have 4 lights so you should use something like this instead. _objectArray = ["Lamps_Base_F", "PowerLines_base_F", "Land_PowerPoleWooden_F", "Land_LampHarbour_F", "Land_LampShabby_F", "Land_PowerPoleWooden_L_F", "Land_PowerPoleWooden_small_F", "Land_LampDecor_F", "Land_LampHalogen_F", "Land_LampSolar_F", "Land_LampStreet_small_F", "Land_LampStreet_F", "Land_LampAirport_F", "Land_PowerPoleWooden_L_F"]; { _x setHit ["light_1_hitpoint", 0.97]; _x setHit ["light_2_hitpoint", 0.97]; _x setHit ["light_3_hitpoint", 0.97]; _x setHit ["light_4_hitpoint", 0.97]; } forEach nearestObjects [player, _objectArray, 500]; Also, there were a few errors in my code. And allMissionObjects didn't do what I thought it was going to do. allMissionObjects only returns objects that have been spawned in or placed during the editor, not default objects already in the map. Otherwise it would have worked with a little debugging, and it would have been spectacular.
  24. Febriannas don't spam other threads. This probably hasn't been answered because it's not possible. Even I looked everywhere and couldn't find anything. Also, I don't think getDescription does what you think it does. getDescription returns an array of 4 strings with what the character is wearing, so you could make a unit wear different clothes, which would make his getDescription change. But that's not what you're asking about.
  25. //gameDuration = "TimeLimit" call BIS_fnc_getParamValue; //probably unnecessary line [[TimeLimit] call BIS_fnc_getParamValue] spawn { _time = time; _gameDuration = _this select 0; while {true} do { sleep 1; _countdown = _gameDuration - (time - _time); if (_countdown < -2) exitWith {"SideTickets" call BEAKS_fnc_endMissionServer}; //if (_countdown < 10) exitWith {"end1" call BIS_fnc_endMission}; }; }; not sure if you're talking about initplayerlocal.sqf, but _countdown will never reach 10 or -2 with the code you posted lets say time = 10 //gameDuration = "TimeLimit" call BIS_fnc_getParamValue; //unnecessary line //[[TimeLimit] call BIS_fnc_getParamValue] spawn { _time = time; // _gameDuration = _this select 0; // while {true} do { // sleep 1; _countdown = _gameDuration - (time - _time); // if (_countdown < -2) exitWith {"SideTickets" call BEAKS_fnc_endMissionServer}; //if (_countdown < 10) exitWith {"end1" call BIS_fnc_endMission}; // }; //}; _countdown = _gameDuration - (10 - 10); _countdown = _gameDuration - 0 ; Time never runs out. EDIT: nevermind
×