McSpeed 1 Posted April 1, 2012 This might get me an infraction since i added this question to an old thread but i dont know if people read through old threads at all. And this has been wrecking my head for over a month now. So, if this is breaking the rules i do apologise , but my scripting knowledge is limited and google isnt much help either. I have a bargate which i want to open for pilots and stay locked for all other units. I did get it working perfectly in single player / editor preview but have no success in MP. The reason i am not simply grouping the units with the gate is because players can leave the group. here is what i have: my bar gate: gate2 init field: this animate ["Bargate", 1]; gate=this execVM "gate.sqf"; this addEventHandler ["HandleDamage", {false}]; (gate sqf keeps the gate locked and prevents others from opening it via action menu) lock = true; while {lock} do { gate2 animate ["Bargate",1]; sleep 0.01; }; now i placed 2 triggers: - to open the gate for pilots: activation: Blufor / repeatedly / present / timeout type: none condition: Pilot1 in thislist or Pilot2 in thislist or Pilot3 in thislist or Pilot4 in thislist on act: gate2 animate ["Bargate", 0] on deact: gate2 animate ["Bargate", 1] - to exclude pilots from the gate.sqf lock activation: Blufor / repeatedly / present / timeout type: none condition: Pilot1 in thislist or Pilot2 in thislist or Pilot3 in thislist or Pilot4 in thislist on act: lock= false OK, as i said, in single player this works like a charm. I walk up to it with a pilot and it opens up. I try it with any other unit and it stays locked. what am i missing to apply this to MP? Share this post Link to post Share on other sites
mikie boy 18 Posted April 2, 2012 try scripting it instead - see if that makes a difference? - can work out the locality issue then - sometimes the triggers can be funny (in my useage). or post here code here so others can test it for u. Share this post Link to post Share on other sites
McSpeed 1 Posted April 2, 2012 (edited) i'd love to do it via script, sure. but i wouldnt even know where to start with that. best i can do is look at existing scripts and try to edit them / apply them to what i want. My limited knowledge doesnt allow me to create a script from scratch unfortunately.... :banghead: Edited April 2, 2012 by McSpeed Share this post Link to post Share on other sites
mikie boy 18 Posted April 2, 2012 post your code and ill have a look - most likely triggers being local to the server. Share this post Link to post Share on other sites
McSpeed 1 Posted April 2, 2012 apart from what i have explained in the first post i have no further code. i am trying to add this to a domination mission. i have been following this thread with great interest as it seems to be starting to head into the direction i need :) Share this post Link to post Share on other sites
giallustio 770 Posted April 2, 2012 Use a loop on the server and check if there're pilots close to the gate...Pretty easy...Something like: while {true} do { if ((nearestObjects [gate2, ["pilots"], 5]) count > 0) then {gate2 animate ["Bargate",0];} else {gate2 animate ["Bargate",1];}; sleep 0.1; }; Share this post Link to post Share on other sites
mikie boy 18 Posted April 2, 2012 failing the trigger not working - can always add an object next to the said gate and add an addaction - checking if the person activating is a pilot. On doing a quick test there is no real reason why the trigger would not activate on the server - it may be that the animation is local to the server and as such that is why it is not opening. replace the gate opening with a hint, see if that shows up. Share this post Link to post Share on other sites
giallustio 770 Posted April 2, 2012 It doesn't work because the condition in the trigger is local...And there's a loop condition in the server to keep the gate down...Give a try to my code! Share this post Link to post Share on other sites
mikie boy 18 Posted April 2, 2012 To give you a helping hand, Pelham and myself tested this for you - activation: Anybody/ repeatedly / present / timeout Cond={_x in thislist && _x iskindof "US_Soldier_Pilot_EP1"} count allUnits > 0; Activ=hint "woohoo"; gate1 animate ["Bargate",0]; Desactiv=hint "booo";"gate1 animate ["Bargate",1]; works no problem - HOWEVER - if as Giallustio states that there is a code in place on the specific map you are using - Say a custom script in domination, then you will have to edit that code. Otherwise if you have placed the bar gate yourself and named it yourself - then this works for multiplayer. Share this post Link to post Share on other sites
McSpeed 1 Posted April 3, 2012 (edited) wow thank you guys :) i am still trying to understand this script things. so am i getting this right that _x means player? and what does the count allunits >0 at the end do? ill be sure to test this out as soon as i had my first cup of coffee! Will report back asap. .... i dont know.. i tried it just the way you said. my gate is placed by hand, no script referring to it: and the trigger i edited just like you said: and i made sure to use the right kind of units: but i can do what i want.. no luck. The gate wont open. Edited April 3, 2012 by McSpeed Share this post Link to post Share on other sites
buliwyf 4 Posted April 3, 2012 Not all gates have the open/close animation in this game! Keep it in mind... ;) Share this post Link to post Share on other sites
giallustio 770 Posted April 3, 2012 You don't like my code, right? Share this post Link to post Share on other sites
PELHAM 10 Posted April 3, 2012 Well we set it up just the way you have it and tested it on a dedi and it works perfectly with just editor placed objects. Only thing I can think of that we didin't tell you is to put gateName animate ["Bargate", 1]; in the init of the gate so it starts closed. example mission here: http://www.mediafire.com/?2cbcspbm7dwyjdf Share this post Link to post Share on other sites
McSpeed 1 Posted April 3, 2012 You don't like my code, right? uh no dont get me wrong :) i just dont know how to implement it../ Well we set it up just the way you have it and tested it on a dedi and it works perfectly with just editor placed objects. Only thing I can think of that we didin't tell you is to put gateName animate ["Bargate", 1]; in the init of the gate so it starts closed. example mission here: http://www.mediafire.com/?2cbcspbm7dwyjdf maybe it was just the mp editor preview. i'll check it on the normal dedi now. took me a while to wake up :) will report back Share this post Link to post Share on other sites
mousetrap 10 Posted April 3, 2012 Not all gates have the open/close animation in this game! Keep it in mind... ;) Hello Hey that may be what I need ....do you know what gates Do not have open /close animation? ..would it be a class name or what? Thanks ---------- Post added at 09:06 AM ---------- Previous post was at 08:58 AM ---------- Use a loop on the server and check if there're pilots close to the gate...Pretty easy...Something like: while {true} do { if ((nearestObjects [gate2, ["pilots"], 5]) count > 0) then {gate2 animate ["Bargate",0];} else {gate2 animate ["Bargate",1];}; sleep 0.1; }; Hello Giallustio could you use it it a Sample map ? I am of the Monkey see monkey do type of person...lol =BTC= Armament System works great. Thanks Share this post Link to post Share on other sites
PELHAM 10 Posted April 3, 2012 (edited) The bargate you are trying to use has animations @ Giallustio - some errors in that script - it will not work as is - needs checking. Edited April 3, 2012 by PELHAM Share this post Link to post Share on other sites
mousetrap 10 Posted April 3, 2012 The bargate you are trying to use has animations Hello the example mission works for me. The pilots walk up and the gate automatically opens and close only for them But for one thing how can we make it so the Default addaction open /close is removed from the gate ...because anyone can use it defeats the pilots only purposes of it. if A gate without the animations was used would the animate ["Bargate", 1]; make it work but not give the Addaction open/close? thanks for your help Share this post Link to post Share on other sites
mikie boy 18 Posted April 3, 2012 No idea how to remove default addactions - bit of a tricky one. As for the gate - scripting the code to keep it closed will probably be the only way - with the trigger setting the condition to true so that the gate opens. Share this post Link to post Share on other sites
giallustio 770 Posted April 3, 2012 Yeah sure because "pilots" it isn't a class :) I'm not at my pc so i can't check the code but it should work...Obviously you have to call the gate "gate2" and add the pilot class Share this post Link to post Share on other sites
McSpeed 1 Posted April 3, 2012 (edited) ok it works :D woot! thanks guys so i set that trigger on the outside and another one (triggered by anybody) on the inside to prevent ppl from getting trapped in case someone manages to follow a pilot in. but, yes, as mousetrap said, being able to keep it locked would be nice, the lock gate.sqf i am using seems to get broken when a pilot AND a non-pilot are in the trigger area. but this is the closest i have been to what i want in a month. who said "forums are useless" ? :D thanks again. btw you may ask why i want to be such a control freak? :) well, its one thing to have the "only pilots can fly" option, but that doesnt prevent people from getting in and trying to fly... and since the first 7 choppers turn on but kick non-pilots out one of the other 10 may just work... having all choppers kick up dust at base does hit the frame rate somewhat i noticed. ___________________________ bleh, edit... it seems to work only sporadically... Edited April 3, 2012 by McSpeed Share this post Link to post Share on other sites
PELHAM 10 Posted April 3, 2012 (edited) Yeah sure because "pilots" it isn't a class :) I'm not at my pc so i can't check the code but it should work...Obviously you have to call the gate "gate2" and add the pilot class No there is far more wrong not just "pilots" - check it. edit: got it to work like this - it wasn't returning a boolean - it could probably be neatened further but not got the time. while {true} do { _arr = nearestObjects [gate3, ["US_Soldier_Pilot_EP1"], 10]; if (count _arr > 0) then {gate3 animate ["Bargate",0];} else {gate3 animate ["Bargate",1];}; sleep 0.1; }; ---------- Post added at 05:12 PM ---------- Previous post was at 05:01 PM ---------- but this is the closest i have been to what i want in a month. Lets get you closer - locking gates! Lock the gate for everyone: init.sqf: [] execVM "gatelock.sqf"; while{true}do{ if(gate1 animationPhase "Bargate" < 1)then{gate1 animate ["Bargate",1]}; sleep 0.1; }; Lock the gate except for pilots, single player, add these to existing code in trigger: on Act: varlockg1=0; on Dea: varlockg1=1; init.sqf: [] execVM "gatelock.sqf"; varlockg1=1; while{true}do{ if((gate1 animationPhase "Bargate" < 1) && (varlockg1==1))then{gate1 animate ["Bargate",1]}; sleep 0.1; }; For multiplayer (untested, will test this evening) change these to publicVariables by adding this after every variable change: publicVariable "varlockg1"; You can find this info in the object config by going to the 6 config browser: =vehicleclass&options[sort_by]=name&options[faction]=&options[vehicleclass]=Misc"]http://browser.six-projects.net/ find the object and click on config: http://browser.six-projects.net/cfg_vehicles/ZavoraAnim/config?version=58 Edited April 3, 2012 by PELHAM Share this post Link to post Share on other sites
mikie boy 18 Posted April 3, 2012 further to the above - you will have to look at add Public variable "varlockg1"; at the end of each - to ensure everyone connected knows the get should be locked or unlocked. Also need to define in init if (isNil "artyarraycontrol") then { artyarraycontrol = 0; }; or if the code gatelock isonly activated once - define the starting value for varlockg1. Share this post Link to post Share on other sites
McSpeed 1 Posted April 4, 2012 i really appreciate the help you guys are providing here :) But when you start throwing this kind of lingo around you are loosing me "change these to publicVariables by adding this after every variable change" Did i mention i have no programming background at all? :) hehe, i was really proud of myself when i understood certain things about scripting from reading the DAC pdf guide, which i think btw was excellently written so even a complete newb at this could make sense of it. I tried to read up on what a "Boolean" is, for example, but the explanation on the wiki had me more stumped than the term itself. For now i got the trigger to work on its own, and disabled the "manual gate open" by burying half the gate inside barriers, leaving enough space to walk through. Of course, the very first public player to join managed to break it by placing a MASH inside the trigger area. It took a few minutes for the trigger to work again. Even with an empty trigger area it seems to be somewhat temperamental. sometimes i can see the gate wants to open but then changes its mind and slams shut again. Its strange that something so seemingly simple turns out to be oh so complex :) but then, this is the ARMA universe, hehe ... Share this post Link to post Share on other sites
giallustio 770 Posted April 4, 2012 To remove an action from an object try to lock it! Share this post Link to post Share on other sites
PELHAM 10 Posted April 4, 2012 To remove an action from an object try to lock it! Doesn't work on this gate Share this post Link to post Share on other sites