Jump to content

Sokoloft

Member
  • Content Count

    70
  • Joined

  • Last visited

  • Medals

Everything posted by Sokoloft

  1. I would like in my vehicles init a code snippet that determines once the vehicle is at speed 0/stopped, it opens it's door? How do I do that? :( As well as I'm down to make it a fnc call as well! idc, and name it fnc_checkSpeed I would of imagined this would be a BIS_fnc, however I have yet to find it if it is >_< Edit: I feel what I'm looking for is a getSpeed command, but that isn't correct, is it? Edit2: Would I have to have 2 getPos commands, and then have some logic in between to determine the speed?? Then have it do animateDoor command? As well as how do I determine what the door I'm trying to open is? Door_L, Door_R, Door_F? As well as I'm currious if this is going to do the same as when the player opens the door via the addaction option. When the player does it the infantry disembark, so if triggering animateDoor doesn't, then I need a way to tell a unit to do a addAction option? Going to go test that now.
  2. Based on that info, I re did the trigger on condition since I don't see getVariable in the script {_vehicle = _x; if (typeOf _vehicle in ["CLASSNAMEHERE"]) then { if ((_vehicle getVariable ["autounload",0]) == 0) then { _vehicle setVariable ["autounload", [_vehicle, this] spawn fnc_autounload_trg ,true]; };};} forEach thisList; this However I still get an error: Thanks :D
  3. So, this is the error that pops up in the black box, really don't know what I'm doing >_< Not sure what to do, let me know! Will check back tomorrow when I feel better.
  4. Hey @theend3r, I tried adding (systemchat "Debug 1";) after every line, however it will only do the last entry. Probably because it was past the ending }; idk tho, plus it only throws the error when the specific vehicle goes into the area. So if I execVM it just goes through, what should I do, this is what I've got: fnc_autounload_trg = { systemchat "Debug 1"; params ["_veh","_trigger"]; systemchat "Debug 2"; while { _veh inArea _trigger} do { systemchat "Debug 3"; if ((_veh animationPhase "ramp_rotate") == 0) then { systemchat "Debug 4"; if (speed _veh < 5) then { systemchat "Debug 5"; _veh animate ["ramp_rotate",1]; systemchat "Debug 6"; sleep 1; systemchat "Debug 7"; { _unit = _x; systemchat "Debug 8"; unassignVehicle _unit; systemchat "Debug 9"; doGetOut _unit; systemchat "Debug 10"; _unit action ["Eject",_veh]; systemchat "Debug 11"; sleep 0.5; systemchat "Debug 12"; } forEach crew _veh; systemchat "Debug 13"; }; }; if ((_veh animationPhase "ramp_rotate") == 1) then { systemchat "Debug 14"; if (speed _veh > 5) then { systemchat "Debug 15"; _veh animate ["ramp_rotate",0]; systemchat "Debug 16"; }; }; sleep 1; systemchat "Debug 17"; }; _veh setVariable ["autounload",nil,true]; systemchat "Debug 18"; }; systemchat "Debug END"; Let me know were I went wrong! Thanks!
  5. Hey das, I should of known that! I changed it however now I'm just getting more errors. Tried to fix it but yet again I don't know what I'm doing, maybe you can find were the error is, either that when @Tajin checks out the forum post he can look at it, but this is my fn_autounload_trg.sqf file: params ["_veh","_trigger"]; while { _veh inArea _trigger} do { if ((_veh animationPhase "ramp_rotate") == 0) then { if (speed _veh < 5) then { _veh animate ["ramp_rotate",1]; sleep 1; { _unit = _x; unassignVehicle _unit; doGetOut _unit; _unit action ["Eject",_veh]; sleep 0.5; } forEach crew _veh; }; }; if ((_veh animationPhase "ramp_rotate") == 1) then { if (speed _veh > 5) then { _veh animate ["ramp_rotate",0]; }; }; sleep 1; }; _veh setVariable ["autounload",nil,true]; Thanks again! Edit: Error generic error in expression?
  6. Hey man, been busy the past couple days and haven't had time to look at the post. I tried that condition field, but I still get the error on the script on this line, says it's missing a ) and I'm not sure were, maybe you do? if ((_veh animationPhase "ramp_rotate") = 0) then { Thanks again, hope to hear from you soon!
  7. Hey man, thanks for not forgetting about me! I tried fnc_autounload.sqf and I got a result, the AI disembarked, however they get slaughtered by both hostile MG's and the driver of the boat itself, because sometimes the boats get caught up on coastal defenses, and the AI have to navigate there way in, it thinks that it has come to it's final resting point. So possibly a longer sleep between speed checks? Maybe a 10 second sleep, and as well as changing the speed to open the door to maybe like 2-3 kmh. As well as a stop command for the driver, so he doesn't run over friendly's disembarking. As for the second method, I got the condition field entered and configured correctly. However when it goes to call it says there is an error on this line, missing )( someweres. if ((_veh animationPhase "ramp_rotate") = 0) then { Thanks so much again! Almost there for a pub release on my mission! Just need to configure ALiVE and other odds and ends like this! Hope to hear from you soon! Edit: Any surviving AI try to return to the boat, is it possible to have a command to tell the AI to advance at a certain bearing? Going to look into the command, just don't know were to implement it, probably towards the end once they disembark? Not sure
  8. Well, as for the first solution fnc_autounload I couldn't get to work, says there is an error between the following line and the ending line } forEach crew _vehicle; and }; As for the second solution I tried first, I couldn't get the code to go into the on condition field, it said "Type nothing, expected bool"?? So a true or false some weres? Not sure, thanks for the info! Hope to hear from you soon!
  9. Hey! I got all my fnc's running via that method, so I can view all of my mission related fnc's via the fnc viewer. However it's being a bit weird to my other fncs, but I'll ask theend3r about that. Now back to trying to get units to disembark automatically, I got your bit of code to open the door! However, it doesn't have them get out, and so far I've only tested it to were the player drives it into the zone, but it should be the same for AI as well if they're the driver. Going to see now, but any idea's? Thanks! PS: I also have multiple vehicles doing this, with a lot of AI getting out from them. Edit I let it go for a good maybe 20 minutes in the background, and the AI navigate the landing defences, and get to the point to were they open up the doors, however no one gets out :( How would we go about making it to were it's the vehicles model name? So if one spawns in via another script I have "VVS" It has the same things happen to it? Thanks so much man!
  10. Hey @Tajin thanks for the info, going to double and maybe even triple check that documentation during the course of the afternoon and when I can I'll start implementing it to my mission. Reading over it once indicates that this is the method that some of my other downloaded scripts like VVS or bons Inf recruit system use, and then is called via the #include option in my desc.ext if I make a cpp or hpp. Thanks again! Will post once I have any news!
  11. Hey there! Thanks for the response, now from reading what you guys said, I'm taking it doesn't matter if I have the code in the init.sqf or have it defined in the init.sqf as the following, just to keep my init clean: fnc_autounload = compileFinal preprocessFileLineNumbers "scripts\functions\fnc_autounload.sqf"; Even having the code @Tajin provided in the init.sqf still does the same thing, it doesn't throw any errors, do I just have it configured incorrectly? I have the following in my fnc_autounload.sqf fnc_autounload = { params ["_vehicle", "_trigger", "_spd","_roles"]; waitUntil {sleep 1; (speed _vehicle < _spd) && (_vehicle inArea _trigger)}; _vehicle animate ["ramp_rotate",1]; sleep 1; { if ((_x select 1) in _roles) then { _unit = _x select 0; unassignVehicle _unit; doGetOut _unit; _unit action ["Eject",_vehicle]; sleep 0.5; }; } forEach fullCrew _vehicle; waitUntil {sleep 1; (speed _vehicle > _spd)}; _vehicle animate ["ramp_rotate",0]; }; is it due to it being defined twice by the fnc_autounload = { ??? Not sure, might try that. Or should I have all of my functions in one .sqf and have each of them defined fnc_fncname = { then execVM the script in my init.sqf so there's 1 line instead of 4 via compileFinal??? Not sure, thanks so much guys! Slowly starting to understand this stuff :D
  12. What's the difference in the way I call it? I would imagine another way to do it would be to make a sqf and call it functions.sqf, with each function defined via fnc_name = { then execute it in my init.sqf via execVM??? Not sure, new to all of this so, let me know if it matters! Thanks again!
  13. I tried the above and still no success, any idea's? nul = [this, missionarea, 5, ["Cargo","Driver"]] spawn fnc_autounload; It isn't even triggering the the door's to open or anything, neither is it telling me if there is an error or not. Not sure if that's a good sign or not but I'm not sure were to go from here. Thanks for all the help! PS: I don't have it in my init.sqf, instead it is it's own .sqf, called in the init by the following line, does that matter or not? fnc_autounload = compileFinal preprocessFileLineNumbers "scripts\functions\fnc_autounload.sqf"; as well as it's still defining itself with fnc_autounload = { does that matter? Let me know! Thanks!
  14. Well it's a good thing to know I'm learning, had already added the _vehicle in front of the animate commands but copied it over again for good measure and still no luck. I'm calling it how @theend3r said, with nul = . However it does nothing, I have a trigger named missionarea, does it need to be a marker or anything different? Not even getting an error :/ I'm calling it via the following in my vehicles init nul = [this, missionarea, 5, ["cargo","gunner","turret","commander"]] spawn fnc_autounload; It just dawned on me that the array might not be configured correctly for my aplication, the boat has 36 passenger seats, and 1 driver seat, so I would imagine I would want ["passenger","driver","cargo"] , gonna go test. Is cargo passenger's because they aren't even getting out :( edit: loading up atm trying: nul = [this, missionarea, 5, ["cargo","driver","passenger"]] spawn fnc_autounload; edit2: Still no luck, any idea's?
  15. Thanks for the reponse! Trying this now, however I had to change spawn to call to be able to put it into the vehicles init. I loaded in and it says there is an error on line 9 missing ; line 9 = animate ["ramp_rotate",1]; to get that command working in game in my testing, I had to use it's defined name I gave it in the editor, so boat1 for example, so: boat1 animate ["ramp_rotate",1]; however, all the boats are defined via an array, in my init, since I have a script that spawns AI into them that way. init line is structured like this: vehicleArray = [boat1, boat2, boat3] how would I make it to were animate uses the vehicle array? is it a different command? I just want it to work at this point, not looking for anything fancy! xD So: vehicleArray animate ["ramp_rotate",1]; ??? Many Thanks! Edit Doing that actually would open all the boats doors >_> Which is not what I want, would it just be "this" instead? Edit2: Just ran the following through my dev console and it went through, gonna check: this animate ["ramp_rotate",1];
  16. Hey! I've been messing with the code that @theend3r gave me and I've come up with this: _handler = [] spawn { waitUntil {sleep 5; speed VARNAME isEqualTo 4}; {unassignVehicle _x} forEach crew this; VARNAME animate ["ramp_rotate",1]; waitUntil {sleep 5; speed VARNAME isEqualTo 5}; VARNAME animate ["ramp_rotate",0]; }; However, on the waituntil line it tells me that after speed "VARNAME"(Was "this") isn't the right variable. Bare with me, I have a vehicleArray = [bunch,of,Var,Names] defined in my init, how would I make it to were it does it to all of the vehicles in the vehicleArray? Tried replacing "VARNAME" with vehicleArray however it throws errors again. Would it be _x and were? Essentially what I want is a fnc that will disembark/open the door once any defined vehicle in the vehicleArray is below 4 kmh. (only in trigger zone) If it goes over 5 kmh(only in trigger zone), the door will close. However, I need this to only work in a specific area, so the fnc would be called by a trigger, and any vehicle defined in the vehicleArray that enters that trigger zone has that fnc applied to it? Still new to all of this, so how would I go about doing that? Thanks! As well as @Tajin I realized you can copy paste from the cfg viewer. Looking at the open door statement, is a long string with many different fnc being called. Not really sure what it all means and I don't think that I can make it applicable to my application. I was just wondering if there was any simple way of doing a player action to simplify things. Like a fnc_doplayerAction or something. Would be handy for simple workarounds like this! So instead of my animate commands, I could use the fnc instead, Ex: ["VARNAME/ARRAY", open_ramp] call fnc_doplayerAction ["VARNAME/ARRAY", close_ramp] call fnc_doplayerAction As well as when the player opens the door, the units auto disembark, therefore I wouldn't have to have the unassignVehicle command or doGetOut. Forgot to put doGetOut as well in the script. Is there a fnc out there that already does that? If so which one?? Thanks again!
  17. Hello, I found this script at armahaulic = www.armaholic.com/page.php?id=26369 With a minute amount of editing, I made it do what I want, which is just force first person on the player. // Author - Sokoloft & Rodeostar42 @ www.armaholic.com/page.php?id=26369 //3rdPersonView.sqf if (!isDedicated) then { waitUntil {!isNull (findDisplay 46)}; if( (difficultyOption "thirdPersonView")isEqualTo 0) then { while {true} do {}; }; if( (difficultyOption "thirdPersonView")isEqualTo 1) then { while {true} do { waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"}; if (((vehicle player) == player) && (speed ( player)) >= 0) then { player switchCamera "INTERNAL"; }; sleep 0.1; }; }; }; How would I go about making it to were the player is kicked after numpad enter is hit more than 3 times. As well as in between, is given a warning via side chat, so people in server can shame the person, as well as it should have the persons name. So: %PlayerName% has tried to enter third person, stop now or you will be kicked! %PlayerName% has tried to enter third person, last chance, stop now! %PlayerName% has tried to enter third person, for the last time, and will now be kicked! As well as the only reason why I want to do this is because if you run, and spam enter, you can slightly get into third person for a second. This is really not a problem, since my mission is vs AI, however if a player decided to spam it, they can slow down the server quite a bit since the script is being done every time they hit numpad enter. As well as there needs to be a grace for players in vehicles, so that they can still go into third person and not be kicked. But not spam it at the same time! Any info would be helpful as I don't know what I'm doing xD
  18. Tried to fix it and now I've got to a point were I can't fix. It says generic error in expression 1 elements provided 2 expected. I have: KEY_MAX_TIMES = 3; KEY_MESSAGES = [ "%1 has tried to enter third person, stop now or you will be kicked!", "%1 has tried to enter third person, last chance, stop now!", "%1 has tried to enter third person, for the last time, and will now be kicked!" ]; player addEventHandler ["PlayerViewChanged"]; _viewName = _this select 0; //Entirly speculation did not test yet if(_viewName == "EXTERNAL") then { _keyTimes = _player getVariable ["keyTimesVar", 0]; _keyTimes = _keyTimes + 1; [[independent,"HQ"], format [KEY_MESSAGES select (_keyTimes-1), name player]] remoteExec ["sideChat"]; if(_keyTimes >= KEY_MAX_TIMES) then { ["3rdPersonExit",false,5] spawn BIS_fnc_endMission; }; player setVariable ["keyTimesVar",_keyTimes]; player switchCamera "INTERNAL"; }; Thanks! Edit: This was on line 15, so the first if statement. Is it actually line 14 causing the issue were _viewName is defined? Should I un-define it? Not sure, let me know!
  19. I just tried this and it kicks me after I press it a second time. What I'm trying to pull off is that the player is warned that they pressed the third person button in side chat, and it sleeps for a second and restarts the script. So it's only if you spam it repeatedly. Not sure what I'm doing wrong >_< Not really sure what I'm doing period... // Author - Sokoloft & das attorney @ BIS forums mission editing & scripting. //fnc_keyCheck.sqf /*Returns the control, the keyboard code and the state of Shift, Ctrl and Alt.*/ while {true} do { params ["_ctrl","_keyCode","_shiftKey","_ctrlKey","_altKey","_handled","_menuOpen","_keys"]; _handled = false; _keys = actionKeys "PersonView"; if (_keyCode in _keys) then { _times = player getVariable ["badBoyAccess",0]; call { if (_times == 0) exitWith { player sideChat "has tried to enter third person, stop now or you will be kicked!"; }; if (_times == 1) exitWith { player sideChat "has tried to enter third person, last chance, stop now!"; }; if (_times == 2) exitWith { player sideChat "has tried to enter third person, for the last time, and will now be kicked!"; ["3rdPersonExit",false,5] spawn BIS_fnc_endMission; }; }; if (_times < 3) then { player setVariable ["badBoyAccess",_times + 1]; }; _handled = true; }; player sideChat "has pressed 3rd Person Button"; Sleep 1; }; _handled Let me know were I went wrong!!!
  20. Hello! I just made a slight edit to the script to it exit's with the BIS preferred fnc. Instead of the endMission command, I then found out I could have my own debriefing, so I put one saying the player messed up xD. I'm still not sure how to implement the said loop I was talking about in my prior post, any help will be much appreciated! // Author - Sokoloft & das attorney @ BIS forums mission editing & scripting. //fnc_keyCheck.sqf /*Returns the control, the keyboard code and the state of Shift, Ctrl and Alt.*/ params ["_ctrl","_keyCode","_shiftKey","_ctrlKey","_altKey","_handled","_menuOpen","_keys"]; _handled = false; _keys = actionKeys "PersonView"; if (_keyCode in _keys) then { player sideChat "has pressed 3rd Person Button"; _times = player getVariable ["badBoyAccess",0]; call { if (_times == 0) exitWith { player sideChat "has tried to enter third person, stop now or you will be kicked!"; }; if (_times == 1) exitWith { player sideChat "has tried to enter third person, last chance, stop now!"; }; if (_times == 2) exitWith { player sideChat "has tried to enter third person, for the last time, and will now be kicked!"; ["3rdPersonExit",false,5] spawn BIS_fnc_endMission; }; }; if (_times < 3) then { player setVariable ["badBoyAccess",_times + 1]; }; _handled = true; }; _handled Thanks again!
  21. Well I just tried this in testing and I got units to disembark by doing either of these two things via just putting it in the vehicles init. doGetOut _x doGetOut this Not sure which one did it, but they got out. However, they did not open the door as I hoped for, and animateSource doesn't look right, so now I think what needs to be looked into is how do I open the door in a script exactly like the player does? As driver of the boat, there is an open door scroll wheel option, and when you open the door, the gate drops and the units disembark, it's quite a sight to see honestly if you're the driver. xD
  22. Alright, @theend3r I could not get the following to work :( It does not throw any errors, but just doesn't do what it's supposed to. Even putting it on the vehicles init. _handler = [] spawn { waitUntil {sleep 5; speed VARNAMEHERE isEqualTo 0}; {unassignVehicle _x} forEach crew VARNAMEHERE; }; As well as @veles-zv animDoor isn't going to work for my application. I had hoped that when triggering that, it would be similar to when the player triggers opening the door. However it is not. It does no sound or animation and just toggles it in place. As well as it doesn't disembark the troops like it normally does when the player opens the door. As well as I can't get into too many details about what the application is for or else it would give away my mission, however if you look hard enough you could probably figure out what it is ;) As well as I found out animateDoor wouldn't work, animateSource was what I was looking for.
  23. I still can't get animationNames to work, figured I'd try to get them to disembark but I can't even get that to work as a fnc. I tried the following: //Author - Sokoloft //fnc_checkSpeed.sqf if (speed _x = 0) then { sleep 5; }; if (speed _x = 0) then { {unassignVehicle _x} forEach vehicleArray; }; As well as I have vehicleArray and vehicleArray1 defined in my init now instead of the trigger :D From the previous post about AI spawning. Idk, let me know were I went wrong >_< Ugh.
  24. Hey @theend3r! How's it going? Thanks for the info! I tried animationNames and It went through fine in my debug console, however I get nothing back, do I need to have RPT logs on? Currently have them disabled, if so I'll go get a log viewer app and enable logs again. Thanks!
  25. Well, contacting the author got me a little further. In game there is a splendid config viewer, and in there I found the vehicle and found it's animation sources. From what I found there I tried the following: vehicle player animateDoor ["ramp_rotate", 0]; Tried changing the 0 to different values as well, 1,2 no luck. Talking to someone on Discord and they say that if you shoot at the vehicle I'm talking about, they disembark and open the door. So how's about a trigger, and in it's condition put the pseudo code from second post: if (this speed == 0; sleep 5; this speed == 0;) then {Disembark units} But what would I need for {Disembark units} ? Would that even work? Edit: Did a search on the community wiki, came up with this = https://community.bistudio.com/wiki/unassignVehicle
×