Jump to content

mrcurry

Member
  • Content Count

    641
  • Joined

  • Last visited

  • Medals

Everything posted by mrcurry

  1. mrcurry

    Help Creating a While Loop

    Up _duration = 4; _maxB = 1; _minB = 0; _startAt = time; _stopAt = time + _duration; waitUntil { insertHeliLight setLightBrightness linearConversion [_startAt, _stopAt, time, _maxB, _minB, true ]; time >= _stopAt }; insertHeliLight setLightBrightness _minB; Here's another way to do it using waitUntil, the following gives direct control over duration without the stepping issue, the light should be updated each frame giving optimal smoothness. (I'm sorry about the formatting, I can't access the code tool on my phone. Fixed!) _duration = 4; _maxB = 1; _minB = 0; _startAt = time; _stopAt = time + _duration; waitUntil { insertHeliLight setLightBrightness linearConversion [_startAt, _stopAt, time, _maxB, _minB, true ]; time < _stopAt }; insertHeliLight setLightBrightness _minB; Simply change maxB, minB and duration to your liking. Works for turning on lights too, to do that switch min and max values.
  2. Class controlsBackground {} is, as the name implies, for background controls. Background in this case means not interactable. Any control put in there will never (AFAIK) take focus and will always appear behind the ones in class controls {}. Within both controlsBackground {} and controls {} each control is ordered in the order they are defined, first = back, last = front. My personal rule (well it's more what you call a guideline than an actual rule): If the user is supposed to interact with it in some way put it in controls {} otherwise it belongs in controlsBackground {} I've always wondered what that one was for, neat. You learn something new every day.
  3. Update: I haven't managed to get the selection parameter to work on addAction. Seems like there's is no valid selection in the geometry. I have got a workaround though! So if anyone is trying to achieve separat actions on each monitor of the Dual Monitor you can do this: 1. Place the Dual Monitor Stand. 2. Place two Spheres 100 cm (found under Helpers, make sure it's the ones with geometry). 3. Position each sphere so it covers each monitor and then go in and change the alpha channel on the sphere's texture to 0. 4. Add actions to each sphere. 5. Profit! This should work with any other stationary object too if you want an action that is available only when looking at a certain part of the object.
  4. Right... If you mean to pass the uid and name into the action code do that via the argument parameter (see https://community.bistudio.com/wiki/addAction). Example: { _uid = getPlayerUID _x; _name = name _x; _x addAction [ "Title", { private _args = _this select 3; //Fetch arguments private _uid = _args select 0; //Parse them into local vars (or dont, your choice). private _name = _args select 1; hint format ["Hello! My name is %1 and my UID is %2. What is your name?", _name, _uid]; //Use in fancy ways }, [_uid, _name] //Arguments parameter ]; } forEach allPlayers; If you mean just executing stuff on all players do: //If local effect { //Your stuff here, _x refers to each player respectivly _x addAction ["Meeh", {}]; } forEach allPlayers; //If global effect [ [], { if(hasinterface) then { player addAction ["Meeh", {}]; }; } ] remoteExec ["call"]; If I completely misunderstood you provide a fully fledged example of what exactly you'd like to do, preferably with a step by step description.
  5. My practice when working with onEachFrame and similar is to move the data crunching into a separate scripted loop (like a while do for instance) and I let the onEachFrame code read from a common data set all required parameters. It sacrifices a bit of memory but doesn't clog up the unscheduled code with expensive operations. It also gives easy control over the update rate through sleep and waitUntil etc.
  6. What exactly are you trying to accomplish? Do you want to add actions to all players? Do you want to add an action for each player? Do you want to add action to players filtered by their uid? Need more information...
  7. Hehe yeah. Doubt it was considered a high priority feature. It comes with a setter too which is nice, gives me some neat ideas.
  8. This is a bit of a touchy subject but in short: The details of it depends on what exactly your code is supposed to do. The basics: 1 Move relevant code to the server 2 When client needs certain data you send a request to the server which then computes and returns the data to the client. If done right client performance would be slightly improved, especially if its heavy-lifting code that's moved to the server, but you have to be careful with your data transfers or the network perf will take a hit. The trade-off is that the server gets more work which also can impact the client's experience. The main use for this technique really lies in that it protects the code that is on the server from unauthorised access. Some relevant commands: preprocessFile loadFile remoteExec
  9. mrcurry

    Hide and reveal markers

    Would deffo give you more control and perf impact is pretty low nowadays.
  10. mrcurry

    Hide and reveal markers

    It takes quite some time for knowsAbout values to decay. 3-4 min of no contact if I remember correctly. With your current setup the marker tracks the enemy's position even though you have lost sight cause knowsAbout stays >0 during this extended time. A better approach would be to use targetKnowledge and check for last seen.
  11. setUnitTrait also provides an option. player setUnitTrait ["loadCoef", (player getUnitTrait "loadCoef")/2]; Where the 2 is the factor which your stamina is increased. Execute once in initPlayerLocal.sqf for best effect.
  12. In initPlayerLocal.Sqf: [] spawn { waitUntil {!isNull findDisplay 12}; //your script here } ;
  13. I think they might get out cause the vehicle is deemed knocked out. Have you tried: vehicle allowCrewInImmobile bool vehicle setUnloadInCombat [allowCargo, allowTurrets]
  14. Short answer is yes. Long answer is: [[], {CheckThis = true;}] remoteExec ["spawn", _group]; (minimize network traffic, only execute where group is local)
  15. Don't have access to my armatop right now but I would assume that the condition is only checked where the group is local. For AI groups that most likely is the server. If my assumption is correct then AI groups, which most often are local to the server, will start moving just fine. That's assuming my initial assumption is true. To test it put some debug print in the condition and check.
  16. mrcurry

    Solo Tank Script

    I'm on the phone so not tested... But something like this: this addEventHandler ["GetIn", { _tank = _this select 0; _unit = _this select 2; If(isplayer _unit) then { createVehicleCrew _tank; crew _tank select {!isplayer _x} joinSilent group player; } ; }] ; this addEventHandler ["GetOut", { _tank = _this select 0; _unit = _this select 2; If(isplayer _unit) then { {deleteVehicle _x;} forEach crew _tank; }; }]; I haven't accounted for all edge cases but should get ball rolling for a singleplayer thing. If not I'll check back with something more solid later.
  17. mrcurry

    Solo Tank Script

    Use the GetIn and GetOut event handlers (addEventhandler) On get in - create the crew and join them to the player, On get out - delete any remaining crew
  18. All directions used ingame works of compass direction (0 = North, 90=east) which is not technically mathematically "correct". Switching sin and cos around in your code should do it. There are multiple commands to help with this conversion, such as getPos (see alternative syntax)
  19. Yes we can, it's up to the person who wants a message delivered to make sure that the message is received and understood correctly. That is a core basis for good communication.
  20. I think doTarget will make AI aim on anything you desire. I used that to get AI to aim on target at a simulated firing range. The forceWeaponFire cmd is your friend to get them to shoot. Like grumpy said max the skills.
  21. I updated me previous post just as you posted. There are no script commands that will do what you ask. A workaround or a different testbed is required if you want to do it the "legitimate" way. Like I suggested above it might be possible to use an AI to do the shooting. If that fails take multiple measurements, the average result might not be as accurate but will get you closer to the actual value. Consider that you have things like breathing and other "human" effects simulated in the game which might skew your results. Btw, it always helps to specify your intentions when asking for assistance. Those that help you can better understand what you need and offer deeper insights and alternative solutions that you might not even have considered. It's just good communication.
  22. You should have started with that then. You would have received a better reception. :) The answer's the same though. Maybe use an AI to do your gun holding instead.
  23. True. For those who read this that aren't trying to make an aimbot: Snapping the camera view around is jarring and bad design. If you want the player to look at a certain spot use visual cues instead. DrawIcon3D is a good place to start.
  24. Put the players on another side such as independent but make them wear civilian clothing. Make the player side enemy to blufor. If you ever need the players to be considered civilian use setCaptive on them.
  25. For a full list of icons Icaruk on the Biki has a good tip (at the bottom of the comments): https://community.bistudio.com/wiki/drawIcon
×