Jump to content

Bl44a

Member
  • Content Count

    9
  • Joined

  • Last visited

  • Medals

Community Reputation

0 Neutral

About Bl44a

  • Rank
    Private
  1. ahh, I never looked into count. I didn't know it was an alternative to forEach (minus the indexing variable). Thanks, for the input everyone
  2. Right, which is why my intuition is that for a large number of players, the first method (checking the distance of each player) is not good. This is added to a missioneventhandler (draw3d), so each frame. now that I think about, I could just rearrange my conditionals.. I could do: if on team then if distance < 1000 then if !incapacitated that way the beefy distance check will only run on players on the same team. Which is at most n/2. In this case it might be better than nearentities. I'm not at my gaming PC so I can't go look at the function in functionviewer do any testing. That's why I was curious if anyone had an idea of how nearentities specifically worked. For all I know it could get every entity on the map, check its distance, and then return an array of only those entities that are closer than the provided distance... In which case it would run horribly. This is an exaggeration and likely not the case but just an example.
  3. I will do some testing next week with the built in timers, but I wanted to see if someone with more detailed knowledge of the functions had input, or if anyone had a better solution they could propose. So a summary of what I am doing is; cycling through players (80 players max); checking their distance from client running the script; checking their side; checking their conscious state. My initial method which I am looking to optimize does the following: { if _x distance player < 1000 then if side _x == side player then if !unconscious then <all conditions met, do something> } forEach playableUnit My idea to improve the script is to do something like this: { if side _x == side player then if !unconscious then <all conditions met, do something> } forEach (player nearEntities 1000) My initial assumption without testing or doing a proof is that for a low number of players, the first method would be better, but as the number of players increases, the second would be quicker. Is there a much better solution that I am missing? Thanks.
  4. https://community.bistudio.com/wiki/say3D A quick look at the documentation shows that our syntax is wring. Try this: _car say3d ROOT + "music\song2.ogg";
  5. Updated per grumpy's comment below: Give this a try: init: this addAction ["Toggle siren","togglesiren.sqf",[this],0,false,true,""," driver _target == _this"]; this setVariable["siren", false]; togglesiren.sqf: _car = _this select 0; //this will get the car object passed from addAction //Thanks to KK: ROOT = call { private "_arr"; _arr = toArray __FILE__; _arr resize (count _arr - 15); //subtract length of "togglesiren.sqf" (15 characters) to get directory toString _arr }; if(_car getVariable "siren") then { //siren is on, turn it off say3D [ROOT + "music\song2.ogg", _car]; _car setVariable["siren", false]; } else { //siren is off, turn it on say3D [ROOT + "music\song1.ogg", _car]; _car setVariable["siren", true]; };
  6. Why are you against using an sqf file? Also what I gave you was pseudo code. It was more of an idea for implementation rather than the exact implementation itself. I can write the exact code if you're unfamiliar
  7. Ah yea it could be tricky to use playSound3D. Go here: https://community.bistudio.com/wiki/playSound3D And take a look at Jacmac's comment at the bottom. That will show you how to use your sound file.
  8. Scripts can be called as many times as youd lke. Quick question, why not use playSound3D and attach it to the car? The current set up seems like an odd workaround. Maybe try something like this (pseudo code): Init Addaction ["toggle siren", togglesiren.sqf, this] This setVariable["siren", false]; // boolean to tell if on or off togglesiren.sqf: car = _this select 0; If (car getVariable "siren") then { // turn off sound car set variable sound false } else { PlaySound3D myaudio, car; Car set variable sound true; }; Sorry, doing this on my phone so I got lazy towards the end with syntax
  9. There is a new revive version. You must use the eden editor attribute. Also note that (I think) it only works when there is more than 1 person on your team
×