Jump to content

kresjah

Member
  • Content Count

    11
  • Joined

  • Last visited

  • Medals

  • Medals

Community Reputation

1 Neutral

About kresjah

  • Rank
    Private First Class
  1. Using a stacked event handler never occured to me. That's something I need to keep in mind. The reason I considered a while-loop was as mentioned so that I could add a sleep. The main reason for exiting the FSM when the variable is set to disabled is to reduce the workload. Instead of being checked every frame (or similar) I can probably get away with a 1 second sleep without it being very noticable. I did find BIS_fnc_runLater. Any experience with it? Was wondering how it compared vs. the while+sleep solution. I would presume that the while+sleep would be less taxing based on its simplicity, but I have to wonder: What about using the runLater with a 1 second delay, with its code set to check the list of disabled object and do another 1 second runLater (essentially creating a loop)?
  2. Long story short, I am trying to monitor a variable I have set on an object (via setVariable). I want to trigger certain events based on the value of said variable. In my mind, the ideal scenario would have an event handler trigger on changes to the variable. The entire script is supposed to be run serverside. I couldn't find any event handlers which reacted to variable changes on an object, apart from addPublicVariableEventHandler. It is close to what I'm looking for, but it only acts on public variables (which is unnecessary if the script runs mainly serverside) and it seems to only trigger on machines which the variable is broadcast too, so it wouldn't fire on the server itself when it changes the variable. Whilst I'm interested in a general solution to this as I'm sure to run into similar issues with future plans as well, the context is the disabling and enabling of a FSM state machine. When an "enabled" variable of an object change from true to false, the state machine will exit by its own means. However, when changing from false to true, the FSM would need to be restarted. Currently the solution is to use a while-loop with sleep to check up on objects whose "enabled" variable is set to false. I'm curious as to what other potential solutions exist. Could anyone shed a light on this?
  3. @Evil Organ I did look around for such scripts before starting my own and found that exact one. Took a peek through the code. However, I found that it was focused on a more player practical, whereas I am aiming for a somewhat more realistic approach. Frankly, whilst they do similar things, the approach and techniques (for lack of better words) we aim for are very different. @beno_83au Trying to tame your anaconda can be quite a hazardous business. :P Jokes aside, I starting to think this is the only solution, although I've been trying to avoid it. I haven't benchmarked it (which I might have to do at a later point), but I imagine that it will actually will eat a significant chunk of perfromance compared to using triggers. The only way I could save a bit of performance as far as I see would be to change it to nearObjects to save some processing by not sorting the array. After all, I'm not looking for the nearest object, just if there are any objects at all in range.
  4. I am indeed aiming for at least some level of realism. You're right in that jogging would certainly make you hit the door. I realize now that I might have to add a few extra details. It's not so much the fact that the player is bumping into the door as it is the fact that the delay due to trigger intervals is far too high. I have been forced to counteract this with a fairly large radius on the trigger simply to allow it more time to detect a presence before it reaches the door. I honestly doubt that most downwards facing sensors that hang over the doors (like on the Altis airport) would have a detection radius of 4 meters. That puts someone quite far from the door when it starts opening. If I had it at what I'd imagine are more realistic ranges the delay before opening would be even worse. That said, I admit I haven't found and gathered any data on actual sensor ranges.
  5. I'm in the process of polishing and optimizing my script for automatic doors. Whilst it works as intended, there is certainly a lot of room for improvement in terms of performance, and minor visuals. There are some parts in particular I've been trying to resolve, but I'm coming up empty-handed here. The effect I'm trying to achieve is essentially that there is a sensor detecting people (or other things for that matter) near the door. The door opens, stays open for a set amount of time, then closes again. Now, if someone remains within the sensor area when the door is about to close, it should start closing for about 0.1-0.2 seconds then reopen. Imagine it as if the sensor shutting itself off when it detects a person (to conserve power or "increase" its lifetime), stays off while the door is opened, and the reactivates itself shortly after the door starts closing. I've added a video to the end of the post to help clarify. This works mostly like I intend to. The biggest problem here is that I've been using a trigger as my door sensor. On the basis that it is an engine-native functionality alone I'd assume it would be better in terms of performance than a scripted solution, but it has the drawback of only checking its condition every 0.5 sec. This is often more than enough time for a player to run into the trigger's area and reach the door and get stopped before the trigger evaluates its condition. I have an FSM running for the door which checks the trigger when the door is in the "closed". If it detects someone, it moves to the "opening" state where it disables the trigger with an enableSimulation false command. It waits in an "open" state for a preset time, then moves to a "closing, no sensor" state for a tiny bit (something akin to 0.2 seconds). During this entire time from the "opening" state to "closing, no sensor" state the sensor remains disabled (no simulation). The next state, "closing", reactivates the sensor. Unfortunately, due to the timing of triggers, this can mean that if someone is within the trigger area, instead of the intended 0.2 second timing from it starts to close until the the trigger actually evaluates its condition, it can also take half a second (or more maybe) after the door starts closing before it starts reopening, which is ample time for it reach around the half-way point before reopening. As far as I know there is no way to individually set the timing of any trigger below 0.5 seconds (if I'm wrong, feel free to correct me). Is my only option here a heavier script-based solution? Any suggestions on how to implement such a solution? Video of script (and timing issues) in action https://youtu.be/Xy3rXCx40AY Image of FSM with some details http://imgur.com/wBfvjPy
  6. Thank you both for your answers. -------- EDIT: I've gotten replies on the ticket, and it was indeed me who was misinterpreting the command. I missed this little detail on the BIKI: "Returns value of given scenario attribute from the 1st tier." The key words here being "1st tier". An honest mistake, but still a mistake. Regardless, I think it is a shame there is no native alternative for returning a value without resorting to scripting solutions for returning the right type of value. Leaving the link to the ticket though in just in case: http://feedback.arma3.com/view.php?id=27936 -------- @dreadedentity Nah, not really assuming that they always work as intended, but rather that there is always a higher likelihood of user error (yep, me doing something wrong like using incorrect syntax or misunderstanding its purpose) than actual bugs. I couldn't find anything about it in the bugtracker nor when searching the forums either. I did forget to mention that I had tried the count/for/select variant. Thing is that it doesn't quite work. Well, your example works, as it requests data from the base class (Land_Airport_side_base_F). If you trying doing the exact same and just change Land_Airport_side_base_F with Land_Airport_left_F (which inherits from the same base class) you end up getting nothing. Sure, as mentioned, I can get it to work using getText/getNumber/getArray combined with getMissionConfig, but as far as I've understood the entire point of getMissionConfigValue was to be able to get a value without knowing in advance what type of value would be returned and having to create special cases for it. @larrow It is a bit worrying indeed. By all means, I think it is a good move per se, but it requires that the framework around it works. I did look at the BIKI but for some reason the configProperties command had completely eluded me. Haven't gotten around to testing it, but it seems like it should do the trick. Whilst the difference is probably neglible, I still think using configClasses would be a better solution (that is, if it read from classes it is inherited from). After all, configProperties requires a scripted condition check to only return subclasses, whilst configClasses would do it natively. But yeah, I don't think anyone would notice the performance difference - it's just the perfectionist in me. :P Regarding parsing via classes inherited from, I did find a ticket on the tracker today... but it worries me that it was reported in 2014 with version 1.26, that it was assigned in 2014 and nothing has happened since: http://feedback.arma3.com/view.php?id=20479
  7. Quick background I've created a script for automatic doors. It works more or less as intended, however, I'm now in the process of polishing it as much as possible. As part of that process, I plan to move some of the settings away from the actual scripts and into description.ext as classes. I'm currently running the 1.56 RC. I've run into some behaviour I find confusing with fetching both lists of subclasses with inheritance, as well as getting values "the correct way". I'll explain the problems first, but if needed, you'll find the description.ext at the bottom of the post. First problem First things first, fetching values from these classes. After reading on the BIKI, using getMissionConfigValue seemed like the way to go. However, instead of returning values, it seems to return a hash. Example: hint format["Value: %1", getMissionConfigValue "CfgAutodoor" >> "Vehicles" >> "Land_Airport_left_F" >> "Door_8" >> "disablerBIS" >> "value"]; // Displays Value: 02558CB8 I'd expected this to return 1 (in reference to the description.ext I've attached below). Ok, so I tried getMissionConfig combined with getNumber, which does indeed fetch the right value. I was, however, under the impression that the whole point of the getMissionConfigValue command was to be able to do just that. Have I misunderstood something here? hint format["Value: %1", getNumber(getMissionConfig "CfgAutodoor" >> "Vehicles" >> "Land_Airport_left_F" >> "Door_8" >> "disablerBIS" >> "value")]; // Displays Value: 1 Second problem Now, I want to return the children of some of the subclasses so I can use their data to set up the doors. My attempts fail though, as it seems not to return the children of classes that have a parent. Oddly enough, fetching a value from within the inherited class still works. Let's look at the CfgAutodoor / Vehicles / Land_Airport_left_F class. Land_Airport_left_F here inherits from Land_Airport_side_base_F. As you might have noticed, Land_Airport_left_F is the same class I fetched the value from in the first problem, which should as far as I can see indicate that it does indeed inherit its properties correctly. What I want to do is use the script is to look up Land_Airport_left_F, then get an array in return which contains its children (which would be Door_7 and Door_8). I've tried two methods here which both return an empty array for some reason. _autodoorObjectCfg = getMissionConfig "CfgAutodoor" >> "Vehicles" >> "Land_Airport_left_F"; _autodoorObjectCfg = "true" configClasses (getMissionConfig "CfgAutodoor" >> "Vehicles" >> "Land_Airport_left_F"); This had me stumped at first. I could fetch the actual values from inside it as detailed in the first problem, but from some reason it refuses to list the children. Then I tried the following: _autodoorObjectCfg = "true" configClasses (getMissionConfig "CfgAutodoor" >> "Vehicles" >> "Land_Airport_side_base_F"); Lo, and behold, the array suddenly has the two expected entries. So, it doesn't work with the class I want, but if I fetch the parent I can get its children? Is there no way to do this by requesting the inherited children from Land_Airport_left_F instead of using a workaround by asking its parent (Land_Airport_side_base_F) instead? Am I missing something here? Description.ext For the sake of clearing up things, and incase I've done something wrong with the classes themselves triggering my problems, here's the description.ext I am using:
  8. EDIT: Apparently it was a matter of me coding when I was obviously too tired or something like that. Used the wrong syntax for selectionPosition... either you use it straight with a string, or you use an array with two arguments. I used an array with a single argument for some absurd reason. Making it just a string fixed the problem... so, in the end it should have been like this: // ... _memoryPoint = _airport selectionPosition "Door_7_trigger"; // ... ------------ Thanks for your answer! It's not entirely what I'm looking for though. Perhaps it'll become a bit clearer if I add a few more details as of what I'm trying to do. Currently I'm working on a script to simulate automatically opening/closing doors. I know other people have made scripts for this already, but both for the sake of learning and for tailoring it to my specific needs I am trying to create my own from scratch. Getting the actual opening and closing of the doors to work is no problem, that part works like a charm. However, right now I'm using a preplaced map trigger to get it going. When the player enters the trigger, both of the doors open. Being somewhat nitpicky and a perfectionist I want to programatically find a location to generate the trigger from a script. At least this way you won't have to place a trigger for each and every set of such doors in a building, and when using it on multiple buildings of the same class the trigger will always be in the same (relative) place. It should also future proof it better so that I don't have to edit a ton of triggers manually if I at some point change the params the script uses. I see two potential solutions: Extrapolate the data by finding the center point between the two doors (or something like that). Pseudocode: _difference = getPos "Door_B" - getPos "Door_A"; _centerpoint = getPos "Door_A" + (_difference / 2); Considering the config for the building open both doors in one fell swoop with a single UserAction whose position is defined as "Door_7_trigger" instead of a location array, I figured it had to be defined somewhere and was hoping to simply fetch that position. I first started looking for it in the config, but to no avail. As it was not there, I thought as such that it would instead be a memory point on the model, and that I could thus fetch it with selectionPosition... which leads me to where I am now. Am I wrong in thinking that it is a memory point location on the model? If not, where is it? Is it at all possible to fetch that location programatically? Sure, the first solution should work and I'll fall back on that one if necessary, but I by far prefer the second one.
  9. Long story short, I'd like to get the position for the trigger of the airport entryway doors. The config files for the airport states the following: configfile >> "CfgVehicles" >> "Land_Airport_right_F" >> "UserActions" >> "OpenDoor_7" >> position = "Door_7_trigger"; So, I want to get the position of this door trigger. I've tried using selectionPosition but always get a [0, 0, 0] result (which means it didn't find the memory point). Am I doing something wrong here? Does anyone have a solution for this? This is the code I use to check for the position: * Player object's Init field player addAction ["<t color='#FFFF00'>DEBUG: </t><t>Show memory point 7 on Airport</t>", { execVM "getMemoryPointDoor.sqf"; }, nil, 9999, false, true, "", ""]; * getMemoryPointDoor.sqf private["_airport", "_memoryPoint"]; // Find nearest Airport object within a 100m radius of player _airport = (nearestObjects [player, ["Land_Airport_left_F", "Land_Airport_right_F"], 100]) select 0; if (isnil "_airport") exitwith { hint "No airport object found."; }; // Studying Land_Airport_*_F and its respective configs you'll find that the UserActions for the double sliding door entryways has trigger positions named Door_7_trigger and Door_8_trigger. // I'd assume these refer to memory points on the model? I can find no indication in the config viewer of these points being defined somewhere in the config class for the set pieces. // For this example, I've chosen to use Door_7_trigger. _memoryPoint = _airport selectionPosition ["Door_7_trigger"]; if (_memoryPoint isEqualTo [0, 0, 0]) exitwith { hint "Airport object found, but failed to retrieve memory point position."; }; hint format["Position of memory point: %1", _memoryPoint];
  10. Thanks for your reply. I can understand why they'd put in a limit (avoid spam and to some degree unserious thread creators), although it is a shame when you have something you actually want to ask about. Considering, understandably, that it is bad form and etiquette to hijack other people's threads in order to ask a question, I now have to find random stuff to reply to for the sake of getting enough points to create a thread so I can ask my actual question. On one hand, it deters people joining to create a single silly thread, but on the other hand it encourages post count bumping (at least initially). Oh well, nothing I can do about that. To avoid derailing the thread, I might as well add a suggestion while I'm at it; making the thread creation prerequisite clearer in the rules. I read through the rules several times both when I created the account in March and the other day trying to find out why I couldn't create threads, but only found it today; at the very bottom of the rules, in a different looking "note" box. Even then, there is no clear indication as to how much active you have to be to transition from "new member" to "regular user". Some more clarification would go a long way, as the current system feels a bit off-putting. I guess I'll just have to wait a few days hoping to find a few topics that I have something I can actually contribute with so I can finally ask my question. I'd rather not do the "hey! cool mod!!!11 bye" kinda posts. Once again, thanks for your reply!
  11. I registered for the forums in March as I wanted help with an Arma 3 script I was working on for a mission. Unfortunately I couldn't find a thread relating to my problem then and as such wanted to start a new one. That's when I realized I couldn't create threads. Can't remember all the things I tried back then, but I simply couldn't find a way to create new threads. I eventually solved my scripting problems and just ignored the whole thread issue for the time being. Now I'm back with another problem I need help with, and I still don't have thread creating privileges. I haven't checked every single subforum, but it seems the inability to create new threads applies to the whole forums (I can't create threads in this subforum either). Are there some rules stating prerequisites to be given privileges for creating threads that I have missed? Or is there an unwritten rule about it? Or is this a bug of some sort? For the record, these are the privileges I have:
×